Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

AudioSample Class Reference

class representing an audio sample More...

#include <proAudio.h>

List of all members.

Public Member Functions

 AudioSample (unsigned char *data, unsigned int size, unsigned short channels, unsigned int sampleRate, unsigned short bitsPerSample)
 AudioSample (const AudioSample &source)
 ~AudioSample ()
unsigned char * data ()
const unsigned char * data () const
unsigned int size () const
unsigned int frames () const
unsigned int sizeFrame () const
unsigned short channels () const
unsigned int sampleRate () const
unsigned short bitsPerSample () const
bool bitsPerSample (unsigned short bits)
unsigned short bytesPerSample () const
void volume (float f)

Static Public Member Functions

static AudioSampleloadWav (const std::string &fname)
static AudioSamplereadWav (FILE *stream, size_t(*readFunc)(void *, size_t, size_t, FILE *))

Protected Attributes

unsigned char * m_data
unsigned int m_size
unsigned short m_channels
unsigned int m_sampleRate
unsigned short m_bitsPerSample


Detailed Description

class representing an audio sample


Constructor & Destructor Documentation

AudioSample::AudioSample unsigned char *  data,
unsigned int  size,
unsigned short  channels,
unsigned int  sampleRate,
unsigned short  bitsPerSample
[inline]
 

constructor from memory data

AudioSample::AudioSample const AudioSample source  ) 
 

copy constructor

AudioSample::~AudioSample  )  [inline]
 

destructor


Member Function Documentation

bool AudioSample::bitsPerSample unsigned short  bits  ) 
 

converts to a different bit rate, e.g., 8, 16

unsigned short AudioSample::bitsPerSample  )  const [inline]
 

returns number of bits per mono sample, e.g., 8, 16

unsigned short AudioSample::bytesPerSample  )  const [inline]
 

returns number of bytes per sample, e.g., 1, 2

unsigned short AudioSample::channels  )  const [inline]
 

returns number of parallel channels, 1 mono, 2 stereo

const unsigned char* AudioSample::data  )  const [inline]
 

allows reading sample data

unsigned char* AudioSample::data  )  [inline]
 

allows accessing sample data

unsigned int AudioSample::frames  )  const [inline]
 

returns sample size in number of frames

static AudioSample* AudioSample::loadWav const std::string &  fname  )  [static]
 

loads a WAV file

static AudioSample* AudioSample::readWav FILE *  stream,
size_t(*)(void *, size_t, size_t, FILE *)  readFunc
[static]
 

reads WAV data from a stream via a function compatible to std::fread

unsigned int AudioSample::sampleRate  )  const [inline]
 

returns number of frames per second, e.g., 44100, 22050

unsigned int AudioSample::size  )  const [inline]
 

returns sample size in bytes

unsigned int AudioSample::sizeFrame  )  const [inline]
 

returns size of a single frame in bytes

void AudioSample::volume float  f  ) 
 

changes volume by given factor


Member Data Documentation

unsigned short AudioSample::m_bitsPerSample [protected]
 

number of bits per sample, e.g., 8, 16

unsigned short AudioSample::m_channels [protected]
 

number of parallel channels, 1 mono, 2 stereo

unsigned char* AudioSample::m_data [protected]
 

stores sample data

unsigned int AudioSample::m_sampleRate [protected]
 

number of samples per second, e.g., 44100, 22050

unsigned int AudioSample::m_size [protected]
 

sample size in bytes


The documentation for this class was generated from the following file:
© 2009-02-04 by Gerald Franz, www.viremo.de impressum