This class implements an audio buffer.
More...
#include <CAudioBuffer.h>
|
| | cAudioBuffer () |
| | Constructor of cAudioBuffer.
|
| |
| virtual | ~cAudioBuffer () |
| | Destructor of cAudioBuffer.
|
| |
| void | clear () |
| | This method clears the audio buffer.
|
| |
| 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.
|
| |
| bool | loadFromFile (const std::string &a_filename) |
| | This method loads an audio file by passing the filename as argument.
|
| |
| std::string | getFilename () const |
| | This method returns the filename from which this audio data was most recently loaded.
|
| |
| unsigned int | getBuffer () |
| | This method returns the OpenAL buffer ID.
|
| |
| unsigned int | getSizeInBytes () |
| | This method returns the size in bytes of the audio data.
|
| |
| unsigned int | getNumSamples () |
| | This method returns the number of samples that compose the audio data.
|
| |
| double | getDuration () |
| | This method returns the duration in seconds of the audio data.
|
| |
| double | getSamplingRate () |
| | This method returns the sampling rate of the audio data.
|
| |
| bool | getStereo () |
| | This method returns true if the audio data in in stereo format, otherwise false.
|
| |
| int | getBitsPerSample () |
| | This method returns the sample format of the audio data.
|
| |
| unsigned char * | getData () |
| | This method returns a pointer to the audio data.
|
| |
| short | getSampleByTimeL (const double a_time, const bool a_loop) |
| | This method returns a sample from the left channel by passing time as argument.
|
| |
| short | getSampleByTimeR (const double a_time, const bool a_loop) |
| | This method returns a sample from the right channel by passing time as argument.
|
| |
| short | getSampleByIndexL (const unsigned int a_index, const bool a_loop) |
| | This method returns the current sample on the left channel.
|
| |
| short | getSampleByIndexR (const unsigned int a_index, const bool a_loop) |
| | This method returns the current sample on the right channel.
|
| |
| bool | convertToMono () |
| | This method converts a stereo stream to mono.
|
| |
|
| bool | checkError () |
| | This methods checks for any OpenAL errors.
|
| |
| bool | cleanup () |
| | This method clears all memory.
|
| |
| void | computeNumSamplesAndDuration () |
| | This method computes the number of samples and duration stored in the audio buffer.
|
| |
|
| std::string | m_filename |
| | Audio filename.
|
| |
| unsigned char * | m_data |
| | Audio data.
|
| |
| unsigned int | m_buffer |
| | OpenAL buffer ID.
|
| |
| unsigned int | m_sizeInBytes |
| | Audio buffer size in bytes.
|
| |
| unsigned int | m_numSamples |
| | Number of audio samples in audio buffer.
|
| |
| double | m_duration |
| | Duration of the audio signal stored in the audio buffer.
|
| |
| double | m_samplingRate |
| | Sampling rate of the audio signal.
|
| |
| bool | m_stereo |
| | Audio data format (stereo = true, mono = false).
|
| |
| unsigned short | m_bitsPerSample |
| | Audio data resolution. Number of bits per sample (8 or 16).
|
| |
| bool | m_flagDeleteData |
| | Audio data ownership flag.
|
| |
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.
◆ cAudioBuffer()
| chai3d::cAudioBuffer::cAudioBuffer |
( |
| ) |
|
◆ ~cAudioBuffer()
| chai3d::cAudioBuffer::~cAudioBuffer |
( |
| ) |
|
|
virtual |
◆ clear()
| void chai3d::cAudioBuffer::clear |
( |
| ) |
|
|
inline |
◆ setup()
| bool chai3d::cAudioBuffer::setup |
( |
unsigned char * |
a_data, |
|
|
const unsigned int |
a_sizeInBytes, |
|
|
int |
a_samplingRate, |
|
|
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_sizeInBytes | Audio data size in bytes. |
| a_samplingRate | Audio data sampling rate. |
| 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.
◆ loadFromFile()
| 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.
◆ getFilename()
| std::string chai3d::cAudioBuffer::getFilename |
( |
| ) |
const |
|
inline |
◆ getBuffer()
| unsigned int chai3d::cAudioBuffer::getBuffer |
( |
| ) |
|
|
inline |
◆ getSizeInBytes()
| unsigned int chai3d::cAudioBuffer::getSizeInBytes |
( |
| ) |
|
|
inline |
◆ getNumSamples()
| unsigned int chai3d::cAudioBuffer::getNumSamples |
( |
| ) |
|
|
inline |
◆ getDuration()
| double chai3d::cAudioBuffer::getDuration |
( |
| ) |
|
|
inline |
◆ getSamplingRate()
| double chai3d::cAudioBuffer::getSamplingRate |
( |
| ) |
|
|
inline |
◆ getStereo()
| bool chai3d::cAudioBuffer::getStereo |
( |
| ) |
|
|
inline |
◆ getBitsPerSample()
| int chai3d::cAudioBuffer::getBitsPerSample |
( |
| ) |
|
|
inline |
◆ getData()
| unsigned char * chai3d::cAudioBuffer::getData |
( |
| ) |
|
|
inline |
◆ getSampleByTimeL()
| short chai3d::cAudioBuffer::getSampleByTimeL |
( |
const double |
a_time, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the audio sample of the left channel given a time value passed as argument.
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 | Time. |
| a_loop | Loop mode. |
- Returns
- Left channel audio sample.
◆ getSampleByTimeR()
| short chai3d::cAudioBuffer::getSampleByTimeR |
( |
const double |
a_time, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the audio sample of the right channel given a time value passed as argument.
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 | Time. |
| a_loop | Loop mode. |
- Returns
- Right channel audio sample.
◆ getSampleByIndexL()
| short chai3d::cAudioBuffer::getSampleByIndexL |
( |
const unsigned int |
a_index, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the audio sample of the left channel given its index number passed as argument.
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_index | Sample index number. |
| a_loop | Loop mode. |
- Returns
- Left channel audio sample.
◆ getSampleByIndexR()
| short chai3d::cAudioBuffer::getSampleByIndexR |
( |
const unsigned int |
a_index, |
|
|
const bool |
a_loop |
|
) |
| |
This method returns the audio sample of the right channel given its index number passed as argument.
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_index | Sample index number. |
| a_loop | Loop mode. |
- Returns
- Right channel audio sample.
◆ convertToMono()
| bool chai3d::cAudioBuffer::convertToMono |
( |
| ) |
|
This method converts an audio signal from stereo to mono.
- Returns
- true if the operation succeeds, false otherwise.
◆ checkError()
| bool chai3d::cAudioBuffer::checkError |
( |
| ) |
|
|
protected |
This methods checks for any OpenAL errors.
- Returns
- true if no errors have occurred, false otherwise.
◆ cleanup()
| bool chai3d::cAudioBuffer::cleanup |
( |
| ) |
|
|
protected |
This method clears audio data from memory.
- Returns
- true if operation succeeds, false otherwise.
◆ computeNumSamplesAndDuration()
| void chai3d::cAudioBuffer::computeNumSamplesAndDuration |
( |
| ) |
|
|
protected |
This method computes the number of samples stored in the audio buffer and the duration of the audio signal.
◆ m_filename
| std::string chai3d::cAudioBuffer::m_filename |
|
protected |
◆ m_data
| unsigned char* chai3d::cAudioBuffer::m_data |
|
protected |
◆ m_buffer
| unsigned int chai3d::cAudioBuffer::m_buffer |
|
protected |
◆ m_sizeInBytes
| unsigned int chai3d::cAudioBuffer::m_sizeInBytes |
|
protected |
◆ m_numSamples
| unsigned int chai3d::cAudioBuffer::m_numSamples |
|
protected |
◆ m_duration
| double chai3d::cAudioBuffer::m_duration |
|
protected |
◆ m_samplingRate
| double chai3d::cAudioBuffer::m_samplingRate |
|
protected |
◆ m_stereo
| bool chai3d::cAudioBuffer::m_stereo |
|
protected |
◆ m_bitsPerSample
| unsigned short chai3d::cAudioBuffer::m_bitsPerSample |
|
protected |
◆ m_flagDeleteData
| bool chai3d::cAudioBuffer::m_flagDeleteData |
|
protected |
The documentation for this class was generated from the following files: