This class implements an audio source.
More...
#include <CAudioSource.h>
|
| | cAudioSource () |
| | Constructor of cAudioSource.
|
| |
| virtual | ~cAudioSource () |
| | Destructor of cAudioSource.
|
| |
| bool | setAudioBuffer (cAudioBuffer *a_audioBuffer) |
| | This method sets the audio buffer.
|
| |
| cAudioBuffer * | getAudioBuffer () |
| | This method returns the audio buffer.
|
| |
| bool | play () |
| | This method plays the audio buffer.
|
| |
| bool | isPlaying () |
| | This method returns true if the audio source is currently playing, false otherwise.
|
| |
| bool | pause () |
| | This method pauses the audio source from playing.
|
| |
| bool | stop () |
| | This method stops the audio source from playing.
|
| |
| bool | rewind () |
| | This method rewinds the audio source.
|
| |
| bool | setPosTime (const float a_time) |
| | This method set the current playing position of the audio buffer.
|
| |
| float | getPosTime () |
| | This method returns the current playing position on audio buffer.
|
| |
| short | getSampleLeft (double a_time) |
| |
| short | getSampleRight (double a_time) |
| |
| bool | setPitch (const float a_pitch) |
| | This method sets the audio pitch. The default value is 1.0.
|
| |
| float | getPitch () |
| | This method returns the audio pitch value.
|
| |
| bool | setGain (const float a_gain) |
| | This method sets the audio gain value. Set value to 0.0 to disable sound.
|
| |
| float | getGain () |
| | This method returns the audio gain value.
|
| |
| bool | setSourcePos (const cVector3d a_sourcePos) |
| | This method sets the position of the audio source in world coordinates.
|
| |
| cVector3d | getSourcePos () |
| | This method returns the position of the audio source in world coordinates.
|
| |
| bool | setSourceVel (const cVector3d a_sourceVel) |
| | This method sets the velocity of the audio source in world coordinates.
|
| |
| cVector3d | getSourceVel () |
| | This method returns the velocity of the audio source in world coordinates.
|
| |
| bool | setLoop (const bool a_loop) |
| | This method enables or disables loop playing.
|
| |
| bool | getLoop () |
| | This method returns the status of loop playing.
|
| |
|
| bool | checkError () |
| | This method checks for any OpenAL errors.
|
| |
This class implements an audio source. An audio source is a sound generator that is placed inside the world at a specific location. A sound generator plays sounds that are stored by audio buffers.
◆ cAudioSource()
| chai3d::cAudioSource::cAudioSource |
( |
| ) |
|
◆ ~cAudioSource()
| chai3d::cAudioSource::~cAudioSource |
( |
| ) |
|
|
virtual |
◆ setAudioBuffer()
| bool chai3d::cAudioSource::setAudioBuffer |
( |
cAudioBuffer * |
a_audioBuffer | ) |
|
This method assigns an audio buffer to this audio source.
- Returns
- true if operation succeeds, false otherwise.
◆ getAudioBuffer()
◆ play()
| bool chai3d::cAudioSource::play |
( |
| ) |
|
This method begins playing the audio source.
- Returns
- true if operation succeeds, false otherwise.
◆ isPlaying()
| bool chai3d::cAudioSource::isPlaying |
( |
| ) |
|
This method checks if the audio source is currently playing.
- Returns
- true if audio source is playing, false otherwise.
◆ pause()
| bool chai3d::cAudioSource::pause |
( |
| ) |
|
This method pauses the audio source from playing.
- Returns
- true if operation succeeds, false otherwise.
◆ stop()
| bool chai3d::cAudioSource::stop |
( |
| ) |
|
This method stops the audio source from playing.
- Returns
- true if operation succeeds, false otherwise.
◆ rewind()
| bool chai3d::cAudioSource::rewind |
( |
| ) |
|
This method rewinds the audio source.
- Returns
- true if operation succeeds, false otherwise.
◆ setPosTime()
| bool chai3d::cAudioSource::setPosTime |
( |
const float |
a_time | ) |
|
This method sets the playing position of the audio source to a desired value a_time passed as argument and defined in seconds.
- Parameters
-
| a_time | Playing position defined in seconds. |
- Returns
- true if operation succeeds, false otherwise.
◆ getPosTime()
| ALfloat chai3d::cAudioSource::getPosTime |
( |
| ) |
|
This method returns the current playing position of the audio source.
- Returns
- Current playing position time in seconds.
◆ getSampleLeft()
| short chai3d::cAudioSource::getSampleLeft |
( |
double |
a_time | ) |
|
This method returns the left sample at a given time.
- Parameters
-
- Returns
- Current playing position time in seconds.
◆ getSampleRight()
| short chai3d::cAudioSource::getSampleRight |
( |
double |
a_time | ) |
|
This method returns the right sample at a given time.
- Parameters
-
- Returns
- Current playing position time in seconds.
◆ setPitch()
| bool chai3d::cAudioSource::setPitch |
( |
const float |
a_pitch | ) |
|
This method sets the audio pitch.
- Parameters
-
| a_pitch | Pitch value. This value must be positive. |
- Returns
- true if operation succeeds, false otherwise.
◆ getPitch()
| float chai3d::cAudioSource::getPitch |
( |
| ) |
|
|
inline |
◆ setGain()
| bool chai3d::cAudioSource::setGain |
( |
const float |
a_gain | ) |
|
This method sets the audio gain.
- Parameters
-
| a_gain | Gain value. The value must be positive. |
- Returns
- true if operation succeeds, false otherwise.
◆ getGain()
| float chai3d::cAudioSource::getGain |
( |
| ) |
|
|
inline |
◆ setSourcePos()
| bool chai3d::cAudioSource::setSourcePos |
( |
const cVector3d |
a_sourcePos | ) |
|
This method sets the position of the audio source in world coordinates.
- Parameters
-
| a_sourcePos | Position of the audio source in world coordinates. |
- Returns
- true if operation succeeds, false otherwise.
◆ getSourcePos()
| cVector3d chai3d::cAudioSource::getSourcePos |
( |
| ) |
|
|
inline |
◆ setSourceVel()
| bool chai3d::cAudioSource::setSourceVel |
( |
const cVector3d |
a_sourceVel | ) |
|
This method sets the velocity of the audio source in world coordinates.
- Parameters
-
| a_sourceVel | Velocity of the audio source in world coordinates. |
- Returns
- true if operation succeeds, false otherwise.
◆ getSourceVel()
| cVector3d chai3d::cAudioSource::getSourceVel |
( |
| ) |
|
|
inline |
◆ setLoop()
| bool chai3d::cAudioSource::setLoop |
( |
const bool |
a_loop | ) |
|
This method enables or disables loop playing. Set argument a_loop to true to enable loop playing, false otherwise.
- Parameters
-
- Returns
- true if operation succeeds, false otherwise.
◆ getLoop()
| bool chai3d::cAudioSource::getLoop |
( |
| ) |
|
|
inline |
◆ checkError()
| bool chai3d::cAudioSource::checkError |
( |
| ) |
|
|
protected |
This method checks for any OpenAL errors.
- Returns
- true if no errors occurred, false otherwise.
◆ m_source
| unsigned int chai3d::cAudioSource::m_source |
|
protected |
◆ m_pitch
| float chai3d::cAudioSource::m_pitch |
|
protected |
◆ m_gain
| float chai3d::cAudioSource::m_gain |
|
protected |
◆ m_sourcePos
◆ m_sourceVel
◆ m_loop
| bool chai3d::cAudioSource::m_loop |
|
protected |
◆ m_audioBuffer
The documentation for this class was generated from the following files: