This class implements an audio buffer.
More...
#include <CAudioBuffer.h>
|
| cAudioBuffer () |
| Constructor of cAudioBuffer. More...
|
|
virtual | ~cAudioBuffer () |
| Destructor of cAudioBuffer. More...
|
|
bool | setup (unsigned char *a_data, const unsigned int a_size, int a_frequency, bool a_stereo, unsigned short a_bitsPerSample) |
| This method sets a buffer by passing a pointer to the audio data and defines the data specifications. More...
|
|
bool | loadFromFile (const std::string &a_filename) |
| This method loads an audio file by passing the filename as argument. More...
|
|
std::string | getFilename () const |
| This method returns the filename from which this audio data was most recently loaded. More...
|
|
unsigned int | getBuffer () |
| This method returns the OpenAL buffer ID. More...
|
|
int | getSize () |
| This method returns the size in bytes of the audio data. More...
|
|
int | getNumSamples () |
| This method returns the number of samples that compose the audio data. More...
|
|
int | getFrequency () |
| This method returns the sampling frequency of the audio data. More...
|
|
bool | getStereo () |
| This method returns true if the audio data in in stereo format, otherwise false. More...
|
|
int | getBitsPerSample () |
| This method returns the sample format of the audio data. More...
|
|
unsigned char * | getData () |
| This method returns a pointer to the audio data. More...
|
|
short | getSampleLeft (const double a_time, const bool a_loop) |
| This method returns the current sample on the left channel. More...
|
|
short | getSampleRight (const double a_time, const bool a_loop) |
| This method returns the current sample on the right channel. More...
|
|
bool | convertToMono () |
| This method converts a stereo stream to mono. More...
|
|
This class implements an audio buffer. An audio buffer contains audio data and information that describes the specifications of the sound signal such as frequency, length, and format.
chai3d::cAudioBuffer::cAudioBuffer |
( |
| ) |
|
chai3d::cAudioBuffer::~cAudioBuffer |
( |
| ) |
|
|
virtual |
bool chai3d::cAudioBuffer::setup |
( |
unsigned char * |
a_data, |
|
|
const unsigned int |
a_size, |
|
|
int |
a_frequency, |
|
|
bool |
a_stereo, |
|
|
unsigned short |
a_bitsPerSample |
|
) |
| |
This method sets a buffer by passing a pointer to the audio data and defines the data specifications which are passed by argument.
- Parameters
-
a_data | Pointer to the audio data. |
a_size | Audio data size in bytes. |
a_frequency | Audio data frequency. |
a_stereo | true for stereo, false for mono. |
a_bitsPerSample | Number of bits per sample (8 or 16). |
- Returns
- true if the operation succeeds, false otherwise.
bool chai3d::cAudioBuffer::loadFromFile |
( |
const std::string & |
a_filename | ) |
|
This method loads an audio file by passing the path and name as argument.
- Parameters
-
- Returns
- true if the operation succeeds, false otherwise.
std::string chai3d::cAudioBuffer::getFilename |
( |
| ) |
const |
|
inline |
unsigned int chai3d::cAudioBuffer::getBuffer |
( |
| ) |
|
|
inline |
int chai3d::cAudioBuffer::getSize |
( |
| ) |
|
|
inline |
int chai3d::cAudioBuffer::getNumSamples |
( |
| ) |
|
This method returns the number of samples of the audio data. Please note that this value does not correspond to the number of bytes of the audio buffer.
- Returns
- Number of audio samples stored in this buffer.
int chai3d::cAudioBuffer::getFrequency |
( |
| ) |
|
|
inline |
bool chai3d::cAudioBuffer::getStereo |
( |
| ) |
|
|
inline |
int chai3d::cAudioBuffer::getBitsPerSample |
( |
| ) |
|
|
inline |
unsigned char* chai3d::cAudioBuffer::getData |
( |
| ) |
|
|
inline |
short chai3d::cAudioBuffer::getSampleLeft |
( |
const double |
a_time, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the left sample at a given time. If the a_loop argument is set to true then audiobuffer will return a sample value as it was playing in loop mode.
- Parameters
-
a_time | Sample time. |
a_loop | Loop mode. |
- Returns
- Current playing position time in seconds.
short chai3d::cAudioBuffer::getSampleRight |
( |
const double |
a_time, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the right sample at a given time. If the a_loop argument is set to true then audiobuffer will return a sample value as it was playing in loop mode.
- Parameters
-
a_time | Sample time. |
a_loop | Loop mode. |
- Returns
- Current playing position time in seconds.
bool chai3d::cAudioBuffer::convertToMono |
( |
| ) |
|
This method converts an audio signal from stereo to mono.
- Returns
- true if the operation succeeds, false otherwise.
bool chai3d::cAudioBuffer::checkError |
( |
| ) |
|
|
protected |
This methods checks for any OpenAL errors.
- Returns
- true if no errors have occurred, false otherwise.
bool chai3d::cAudioBuffer::cleanup |
( |
| ) |
|
|
protected |
This method clears audio data from memory.
- Returns
- true if operation succeeds, false otherwise.
std::string chai3d::cAudioBuffer::m_filename |
|
protected |
unsigned char* chai3d::cAudioBuffer::m_data |
|
protected |
unsigned int chai3d::cAudioBuffer::m_buffer |
|
protected |
int chai3d::cAudioBuffer::m_size |
|
protected |
int chai3d::cAudioBuffer::m_frequency |
|
protected |
bool chai3d::cAudioBuffer::m_stereo |
|
protected |
unsigned short chai3d::cAudioBuffer::m_bitsPerSample |
|
protected |
bool chai3d::cAudioBuffer::m_flagDeleteData |
|
protected |
The documentation for this class was generated from the following files: