Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Audio::Format Struct Reference

#include <Format.h>

Public Member Functions

 Format ()
 
 Format (unsigned int freq, unsigned char bps, unsigned char nch)
 
unsigned int frameSize () const
 
unsigned int bytesPerSecond () const
 
bool operator== (const Format &o) const
 
bool operator!= (const Format &o) const
 

Public Attributes

unsigned int sampleFrequency
 
unsigned char bitsPerSample
 
unsigned char channels
 
int signedSamples: 1
 
int nativeOrder: 1
 

Detailed Description

Audio format information class

Definition at line 13 of file Format.h.

Constructor & Destructor Documentation

Audio::Format::Format ( )
inline

Definition at line 20 of file Format.h.

20 {}
Audio::Format::Format ( unsigned int  freq,
unsigned char  bps,
unsigned char  nch 
)
inline

Definition at line 22 of file Format.h.

22  :
23  sampleFrequency(freq),
24  bitsPerSample(bps),
25  channels(nch),
26  signedSamples((bps>=16)?1:0),
27  nativeOrder(1)
28  {
29  }

Member Function Documentation

unsigned int Audio::Format::bytesPerSecond ( ) const
inline

Definition at line 36 of file Format.h.

References frameSize(), and sampleFrequency.

37  {
38  return frameSize() * sampleFrequency;
39  }
unsigned int Audio::Format::frameSize ( ) const
inline

Definition at line 31 of file Format.h.

References bitsPerSample, and channels.

Referenced by bytesPerSecond(), Audio::SoundBuffer::getSampleCapacity(), and Audio::SoundBuffer::getSampleCount().

32  {
33  return (bitsPerSample * channels + 7) / 8;
34  }
bool Audio::Format::operator!= ( const Format o) const
inline

Definition at line 50 of file Format.h.

51  {
52  return !(*this == o);
53  }
bool Audio::Format::operator== ( const Format o) const
inline

Definition at line 41 of file Format.h.

References bitsPerSample, channels, nativeOrder, sampleFrequency, and signedSamples.

42  {
43  return (sampleFrequency == o.sampleFrequency)
44  && (bitsPerSample == o.bitsPerSample)
45  && (channels == o.channels)
46  && (signedSamples == o.signedSamples)
47  && (nativeOrder == o.nativeOrder);
48  }

Member Data Documentation

unsigned char Audio::Format::bitsPerSample

Definition at line 15 of file Format.h.

Referenced by frameSize(), Audio::OpenALSimpleSound::loadImpl(), and operator==().

unsigned char Audio::Format::channels

Definition at line 16 of file Format.h.

Referenced by frameSize(), and operator==().

int Audio::Format::nativeOrder

Definition at line 18 of file Format.h.

Referenced by Audio::OpenALSimpleSound::loadImpl(), and operator==().

unsigned int Audio::Format::sampleFrequency

Definition at line 14 of file Format.h.

Referenced by bytesPerSecond(), Audio::OpenALSimpleSound::loadImpl(), and operator==().

int Audio::Format::signedSamples

Definition at line 17 of file Format.h.

Referenced by Audio::OpenALSimpleSound::loadImpl(), and operator==().


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