ReactOS  0.4.13-dev-563-g0561610
audio_format Class Reference

#include <audio_format.hpp>

Public Member Functions

 audio_format (unsigned int samples_per_second, unsigned short int bits_per_sample, unsigned short int channels)
 
virtual ~audio_format (void)
 
bool operator== (audio_format &eq) const
 
unsigned int sample_rate (void) const
 
unsigned short int bits (void) const
 
unsigned short int channels (void) const
 
unsigned int byte_rate (void) const
 
unsigned int block_align (void) const
 
unsigned int samples_in_seconds (float seconds) const
 
unsigned int samples_in_bytes (unsigned int bytes) const
 
unsigned int bytes_in_samples (unsigned int samples) const
 

Protected Attributes

unsigned int samples_psec
 
unsigned short int bits_psample
 
unsigned short int chan
 

Detailed Description

Definition at line 15 of file audio_format.hpp.

Constructor & Destructor Documentation

◆ audio_format()

audio_format::audio_format ( unsigned int  samples_per_second,
unsigned short int  bits_per_sample,
unsigned short int  channels 
)
inline

Definition at line 23 of file audio_format.hpp.

25  : samples_psec(samples_per_second),
26  bits_psample(bits_per_sample),
27  chan(channels)
28  {
29  }
unsigned int samples_psec
unsigned short int channels(void) const
unsigned short int chan
unsigned short int bits_psample

◆ ~audio_format()

virtual audio_format::~audio_format ( void  )
inlinevirtual

Definition at line 32 of file audio_format.hpp.

33  {
34  }

Member Function Documentation

◆ bits()

unsigned short int audio_format::bits ( void  ) const
inline

◆ block_align()

unsigned int audio_format::block_align ( void  ) const
inline

Definition at line 68 of file audio_format.hpp.

69  {
70  return (chan * (bits_psample / 8));
71  }
unsigned short int chan
unsigned short int bits_psample

Referenced by audio_resampler_acm::init_(), audio_waveout::open(), and audio_wavein::open().

◆ byte_rate()

◆ bytes_in_samples()

unsigned int audio_format::bytes_in_samples ( unsigned int  samples) const
inline

Definition at line 83 of file audio_format.hpp.

84  {
85  return (samples * ((bits_psample / 8) * chan));
86  }
GLsizei samples
Definition: glext.h:7006
unsigned short int chan
unsigned short int bits_psample

Referenced by audio_waveout::nsample(), and audio_wavein::nsample().

◆ channels()

unsigned short int audio_format::channels ( void  ) const
inline

Definition at line 58 of file audio_format.hpp.

59  {
60  return chan;
61  }
unsigned short int chan

Referenced by audio_resampler_acm::init_(), audio_waveout::open(), and audio_wavein::open().

◆ operator==()

bool audio_format::operator== ( audio_format eq) const
inline

Definition at line 37 of file audio_format.hpp.

38  {
39  /* The same audio format is when samples per second,
40  bit per sample, and channels mono/stereo are equal */
41  return ((samples_psec == eq.samples_psec) &&
42  (bits_psample == eq.bits_psample) &&
43  (chan == eq.chan));
44  }
#define eq(received, expected, label, type)
Definition: locale.c:144
unsigned int samples_psec
unsigned short int chan
unsigned short int bits_psample

◆ sample_rate()

unsigned int audio_format::sample_rate ( void  ) const
inline

Definition at line 48 of file audio_format.hpp.

49  {
50  return samples_psec;
51  }
unsigned int samples_psec

Referenced by audio_resampler_acm::init_(), audio_waveout::open(), and audio_wavein::open().

◆ samples_in_bytes()

unsigned int audio_format::samples_in_bytes ( unsigned int  bytes) const
inline

Definition at line 78 of file audio_format.hpp.

79  {
80  return (bytes / ((bits_psample / 8) * chan));
81  }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
unsigned short int chan
unsigned short int bits_psample

Referenced by audio_membuffer::audio_receive(), audio_membuffer::read(), audio_membuffer::samples_received(), audio_waveout::tot_samples_buf(), and audio_wavein::tot_samples_buf().

◆ samples_in_seconds()

unsigned int audio_format::samples_in_seconds ( float  seconds) const
inline

Definition at line 73 of file audio_format.hpp.

74  {
75  return (unsigned int)(((float)samples_psec * (float) chan) * seconds);
76  }
unsigned int samples_psec
unsigned short int chan

Referenced by audio_membuffer::total_samples().

Member Data Documentation

◆ bits_psample

unsigned short int audio_format::bits_psample
protected

◆ chan

unsigned short int audio_format::chan
protected

◆ samples_psec

unsigned int audio_format::samples_psec
protected

Definition at line 18 of file audio_format.hpp.

Referenced by byte_rate(), operator==(), sample_rate(), and samples_in_seconds().


The documentation for this class was generated from the following file: