Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::SoundManager::Voice Class Reference

Audio playback class. More...

Collaboration diagram for Burger::SoundManager::Voice:

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)
 
SoundManagerm_pManager
 Parent sound manager.
 
uintptr_t m_uCurrentMark
 Mark into the waveform.
 
SmartPointer< Bufferm_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
 

Detailed Description

Audio playback class.


Class containing audio playback state for a single voice. This is the class that controls the playback of a single channel

See also
Buffer or SoundManager

Constructor & Destructor Documentation

◆ Voice()

Burger::SoundManager::Voice::Voice ( )

Constructor.


Initialize the structure to defaults

See also
Shutdown(void)

◆ ~Voice()

Burger::SoundManager::Voice::~Voice ( )

Destructor.


Release all resources

See also
Shutdown(void)

Member Function Documentation

◆ GetCompletionFunction()

CompletionProc Burger::SoundManager::Voice::GetCompletionFunction ( void ) const
inline

◆ GetCompletionFunctionData()

void * Burger::SoundManager::Voice::GetCompletionFunctionData ( void ) const
inline

◆ GetPan()

uint_t Burger::SoundManager::Voice::GetPan ( void ) const
inline

◆ GetSampleRate()

uint_t Burger::SoundManager::Voice::GetSampleRate ( void ) const
inline

◆ GetVolume()

uint_t Burger::SoundManager::Voice::GetVolume ( void ) const
inline

◆ Init()

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.

Parameters
pManagerPointer to the parent SoundManager
pBufferPointer to the buffer to use for playback
Returns
Zero if no error, non-zero if error
See also
Start(void)

◆ IsAvailable()

uint_t Burger::SoundManager::Voice::IsAvailable ( void ) const
inline

◆ IsHeld()

uint_t Burger::SoundManager::Voice::IsHeld ( void ) const
inline

◆ IsPaused()

uint_t Burger::SoundManager::Voice::IsPaused ( void ) const
inline

◆ IsPlaying()

uint_t Burger::SoundManager::Voice::IsPlaying ( void ) const
inline

◆ Pause()

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()

Returns
Zero if no error, non-zero if error
See also
Resume(void)

◆ PlayCallback()

static signed long Burger::SoundManager::Voice::PlayCallback ( void * pData,
unsigned long * pActionFlags,
const AudioTimeStamp * pAudioTimeStamp,
unsigned long uBusNumber,
unsigned long uNumberFrames,
AudioBufferList * pAudioBufferList )
static

◆ ReachedEnd()

void BURGER_API Burger::SoundManager::Voice::ReachedEnd ( void )

Internal callback.


Releases the voice automatically upon completion

◆ Release()

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

See also
Shutdown(void)

◆ Resume()

uint_t BURGER_API Burger::SoundManager::Voice::Resume ( void )

Resume playback.


Start the voice at the location recorded from the last call to Pause()

Returns
Zero if no error, non-zero if error
See also
Pause(void)

◆ SetCompletionFunction()

void Burger::SoundManager::Voice::SetCompletionFunction ( CompletionProc pCompletionProc,
void * pData = 0 )
inline

◆ SetHeld()

void Burger::SoundManager::Voice::SetHeld ( void )
inline

◆ SetPan()

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

Parameters
uPanPan setting from 0 to 0xFFFF with 0 being left, 0x8000 being center and 0xFFFF being right
Returns
Zero if no error, non-zero if error
See also
GetPan(void) const

◆ SetSampleRate()

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

Parameters
uSamplesPerSecondSpeed of playback in samples per second
Returns
Zero if no error, non-zero if error
See also
GetSampleRate(void) const

◆ SetVolume()

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

Parameters
uVolumeVolume from 0 to 255 with 0 being silence and 255 being maximum
Returns
Zero if no error, non-zero if error
See also
GetVolume(void) const

◆ Shutdown()

void BURGER_API Burger::SoundManager::Voice::Shutdown ( void )

Stop playback and release all resources.


Release the resources allocated by this voice.

See also
Stop(void)

◆ Start()

uint_t BURGER_API Burger::SoundManager::Voice::Start ( void )

Start playback.


Start the voice

Returns
Zero if no error, non-zero if error
See also
Stop(void)

◆ Stop()

uint_t BURGER_API Burger::SoundManager::Voice::Stop ( void )

Stop playback.


Stop the voice

Returns
Zero if no error, non-zero if error
See also
Start(void)

Member Data Documentation

◆ m_bAvailable

uint8_t Burger::SoundManager::Voice::m_bAvailable
protected

TRUE if available for allocation

◆ m_bIsHeld

uint8_t Burger::SoundManager::Voice::m_bIsHeld
protected

TRUE if the application is externally controlling this voice

◆ m_bPaused

uint8_t Burger::SoundManager::Voice::m_bPaused
protected

TRUE if the sound was paused

◆ m_bPlaying

uint8_t Burger::SoundManager::Voice::m_bPlaying
protected

TRUE if the sound is currently playing

◆ m_pBuffer

SmartPointer<Buffer> Burger::SoundManager::Voice::m_pBuffer
protected

Sound buffer connected to.

◆ m_pCallBack

CompletionProc Burger::SoundManager::Voice::m_pCallBack
protected

Completion routine.

◆ m_pCallBackData

void* Burger::SoundManager::Voice::m_pCallBackData
protected

Data to pass for completion routine.

◆ m_pDirectSoundBuffer8

IDirectSoundBuffer8* Burger::SoundManager::Voice::m_pDirectSoundBuffer8
protected

DirectSound8 buffer (Windows Only)

◆ m_pDirectSoundNotify

IDirectSoundNotify* Burger::SoundManager::Voice::m_pDirectSoundNotify
protected

DirectSoundNotify for alert when sound is complete (Windows Only)

◆ m_pManager

SoundManager* Burger::SoundManager::Voice::m_pManager
protected

Parent sound manager.

◆ m_uCurrentMark

uintptr_t Burger::SoundManager::Voice::m_uCurrentMark
protected

Mark into the waveform.

◆ m_uLoopEnd

uintptr_t Burger::SoundManager::Voice::m_uLoopEnd
protected

Sample to end the loop (0 for no looping)

◆ m_uLoopStart

uintptr_t Burger::SoundManager::Voice::m_uLoopStart
protected

Sample to start from.

◆ m_uPan

uint_t Burger::SoundManager::Voice::m_uPan
protected

Pan setting.

◆ m_uPausedMark

uintptr_t Burger::SoundManager::Voice::m_uPausedMark
protected

Location of the pause.

◆ m_uSampleRate

uint_t Burger::SoundManager::Voice::m_uSampleRate
protected

Samples per second to play.

◆ m_uVolume

uint_t Burger::SoundManager::Voice::m_uVolume
protected

Volume for the buffer.