Audio playback class. More...
Public Member Functions | |
Voice () | |
Constructor. | |
~Voice () | |
Destructor. | |
uint_t | Init (SoundManager *pManager, Buffer *pBuffer) |
Initialize a voice for playback. | |
void | Shutdown (void) |
Stop playback and release all resources. | |
void | Release (void) |
Release the connection to the application. | |
uint_t | Start (void) |
Start playback. | |
uint_t | Stop (void) |
Stop playback. | |
uint_t | Pause (void) |
Pause playback. | |
uint_t | Resume (void) |
Resume playback. | |
uint_t | SetVolume (uint_t uVolume) |
Set the volume of the voice. | |
uint_t | GetVolume (void) const |
uint_t | SetPan (uint_t uPan) |
Set the pan setting of the voice. | |
uint_t | GetPan (void) const |
uint_t | SetSampleRate (uint_t uSamplesPerSecond) |
Set the samples per second setting of the voice. | |
uint_t | GetSampleRate (void) const |
void | SetCompletionFunction (CompletionProc pCompletionProc, void *pData=0) |
CompletionProc | GetCompletionFunction (void) const |
void * | GetCompletionFunctionData (void) const |
uint_t | IsPlaying (void) const |
uint_t | IsPaused (void) const |
uint_t | IsAvailable (void) const |
uint_t | IsHeld (void) const |
void | SetHeld (void) |
void | ReachedEnd (void) |
Internal callback. | |
Static Public Member Functions | |
static signed long | PlayCallback (void *pData, unsigned long *pActionFlags, const AudioTimeStamp *pAudioTimeStamp, unsigned long uBusNumber, unsigned long uNumberFrames, AudioBufferList *pAudioBufferList) |
Protected Attributes | |
IDirectSoundBuffer8 * | m_pDirectSoundBuffer8 |
DirectSound8 buffer (Windows Only) | |
IDirectSoundNotify * | m_pDirectSoundNotify |
DirectSoundNotify for alert when sound is complete (Windows Only) | |
SoundManager * | m_pManager |
Parent sound manager. | |
uintptr_t | m_uCurrentMark |
Mark into the waveform. | |
SmartPointer< Buffer > | m_pBuffer |
Sound buffer connected to. | |
CompletionProc | m_pCallBack |
Completion routine. | |
void * | m_pCallBackData |
Data to pass for completion routine. | |
uintptr_t | m_uLoopStart |
Sample to start from. | |
uintptr_t | m_uLoopEnd |
Sample to end the loop (0 for no looping) | |
uintptr_t | m_uPausedMark |
Location of the pause. | |
uint_t | m_uSampleRate |
Samples per second to play. | |
uint_t | m_uPan |
Pan setting. | |
uint_t | m_uVolume |
Volume for the buffer. | |
uint8_t | m_bPlaying |
TRUE if the sound is currently playing | |
uint8_t | m_bPaused |
TRUE if the sound was paused | |
uint8_t | m_bAvailable |
TRUE if available for allocation | |
uint8_t | m_bIsHeld |
TRUE if the application is externally controlling this voice | |
Audio playback class.
Class containing audio playback state for a single voice. This is the class that controls the playback of a single channel
Burger::SoundManager::Voice::Voice | ( | ) |
Burger::SoundManager::Voice::~Voice | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
uint_t BURGER_API Burger::SoundManager::Voice::Init | ( | SoundManager * | pManager, |
Buffer * | pBuffer ) |
Initialize a voice for playback.
Set up resources needed for playback, sample rate, pan and volume are present.
The voice is ready for playback. Call Start() to start the sound.
pManager | Pointer to the parent SoundManager |
pBuffer | Pointer to the buffer to use for playback |
|
inline |
|
inline |
|
inline |
|
inline |
uint_t BURGER_API Burger::SoundManager::Voice::Pause | ( | void | ) |
Pause playback.
Stop the voice and record the location to allow playback to resume with a call to Resume()
|
static |
void BURGER_API Burger::SoundManager::Voice::ReachedEnd | ( | void | ) |
Internal callback.
Releases the voice automatically upon completion
void BURGER_API Burger::SoundManager::Voice::Release | ( | void | ) |
Release the connection to the application.
If a pointer to a Voice is requested, it's marked as unable to be used and under application control.
Calling this function will release the voice back to the free pool once the playback has stopped automatically.
If the sound is a looping sound, it will stop immediately
uint_t BURGER_API Burger::SoundManager::Voice::Resume | ( | void | ) |
Resume playback.
Start the voice at the location recorded from the last call to Pause()
|
inline |
|
inline |
uint_t BURGER_API Burger::SoundManager::Voice::SetPan | ( | uint_t | uPan | ) |
Set the pan setting of the voice.
Immediately change the pan setting of this specific voice
uPan | Pan setting from 0 to 0xFFFF with 0 being left, 0x8000 being center and 0xFFFF being right |
uint_t BURGER_API Burger::SoundManager::Voice::SetSampleRate | ( | uint_t | uSamplesPerSecond | ) |
Set the samples per second setting of the voice.
Immediately change the playback speed of this specific voice
uSamplesPerSecond | Speed of playback in samples per second |
uint_t BURGER_API Burger::SoundManager::Voice::SetVolume | ( | uint_t | uVolume | ) |
Set the volume of the voice.
Immediately change the volume of this specific voice
uVolume | Volume from 0 to 255 with 0 being silence and 255 being maximum |
void BURGER_API Burger::SoundManager::Voice::Shutdown | ( | void | ) |
Stop playback and release all resources.
Release the resources allocated by this voice.
uint_t BURGER_API Burger::SoundManager::Voice::Start | ( | void | ) |
uint_t BURGER_API Burger::SoundManager::Voice::Stop | ( | void | ) |
|
protected |
TRUE if available for allocation
|
protected |
TRUE if the application is externally controlling this voice
|
protected |
TRUE if the sound was paused
|
protected |
TRUE if the sound is currently playing
|
protected |
Sound buffer connected to.
|
protected |
Completion routine.
|
protected |
Data to pass for completion routine.
|
protected |
DirectSound8 buffer (Windows Only)
|
protected |
DirectSoundNotify for alert when sound is complete (Windows Only)
|
protected |
Parent sound manager.
|
protected |
Mark into the waveform.
|
protected |
Sample to end the loop (0 for no looping)
|
protected |
Sample to start from.
|
protected |
Pan setting.
|
protected |
Location of the pause.
|
protected |
Samples per second to play.
|
protected |
Volume for the buffer.