ReactOS 0.4.15-dev-8339-g4028de8
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),
28 {
29 }
unsigned int samples_psec
unsigned short int chan
unsigned short int bits_psample
unsigned short int channels(void) const

◆ ~audio_format()

virtual audio_format::~audio_format ( void  )
inlinevirtual

Definition at line 32 of file audio_format.hpp.

33 {
34 }

Member Function Documentation

◆ bits()

◆ 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 }

Referenced by audio_resampler_acm::init_(), audio_wavein::open(), and audio_waveout::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

Referenced by audio_wavein::nsample(), and audio_waveout::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 }

Referenced by audio_resampler_acm::init_(), audio_wavein::open(), and audio_waveout::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

◆ 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 }

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

◆ samples_in_bytes()

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

◆ 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 }
static float(__cdecl *square_half_float)(float x

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: