Classes | |
class | Buffer |
Audio data class. More... | |
class | BufferDecoder |
struct | BufferDescription_t |
class | SoundCardDescription |
class | Voice |
Audio playback class. More... | |
Public Types | |
enum | { FLAGDOUBLEBUFFER =0x4000 } |
enum | eCodecCommand { CODECBUFFERSIZE , CODECINIT , CODECSHUTDOWN , CODECDECODE , CODECRESET } |
enum | eDataType { TYPEBYTE , TYPECHAR , TYPELSHORT , TYPEBSHORT , TYPEADPCM , TYPEDVIPCM , TYPEMP3 , TYPEULAW , TYPEALAW , TYPEMACE3 , TYPEMACE6 , TYPEOGG , TYPELFLOAT , TYPEBFLOAT , TYPEMASK = 0x3FFF , TYPESTEREO =0x8000 , TYPESHORT =TYPEBSHORT , TYPEFLOAT =TYPEBFLOAT } |
typedef void(*) | CompletionProc(void *) |
Function prototype for sound event callbacks. | |
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
SoundManager (GameApp *pGameApp) | |
Constructor. | |
virtual | ~SoundManager () |
Release all resources. | |
uint_t | Init (void) |
Initialize a SoundManager. | |
void | Shutdown (void) |
Shut down a SoundManager. | |
uint_t | Play (Buffer *pInput, Voice **ppCookie=0) |
Play a sound. | |
uint_t | Stop (void) |
Stop all sound. | |
uint_t | Pause (void) |
Pause sound. | |
uint_t | Resume (void) |
Resume sound. | |
void | SetMaxVoices (uint_t uMax) |
Set the maximum number of voices to mix. | |
uint_t | GetMaxVoices (void) const |
uint_t | GetActiveVoiceCount (void) const |
Return the number of free voices. | |
uint_t | IsStereoSupported (void) const |
uint_t | IsVolumeAdjustSupported (void) const |
void | SetVolume (uint_t uVolume) |
Set the master volume. | |
uint_t | GetVolume (void) const |
Buffer * | NewBuffer (void *pWaveFile, uintptr_t uLength) |
Create a new sound buffer. | |
IXAudio2 * | GetXAudio2 (void) const |
IXAudio2MasteringVoice * | GetXAudio2MasteringVoice (void) const |
IDirectSound8 * | GetDirectSound8 (void) const |
IDirectSound3DListener * | GetDirectSound3DListener (void) const |
IDirectSoundBuffer * | GetPrimaryDirectSoundBuffer (void) const |
OpaqueAUGraph * | GetGraph (void) const |
ComponentInstanceRecord * | GetAudioUnit (void) const |
ComponentInstanceRecord * | GetMixerUnit (void) const |
int32_t | GetMixerNode (void) const |
uint32_t | GetDeviceID (void) const |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static SoundManager * | New (GameApp *pGameApp) |
Allocate and initialize a SoundManager. | |
static uint_t | GetAudioModes (ClassArray< SoundCardDescription > *pOutput) |
Get a list of available audio modes. | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
static const int16_t | g_DirectSoundVolumes [256] |
static const uint_t | cMaxVoiceCount = 32 |
Maximum number of simultaneous tones to mix for output. | |
static const uint_t | cMaxVolume = 255 |
Maximum volume value. | |
static const uint_t | cPanLeft = 0x0000 |
Pan left value. | |
static const uint_t | cPanCenter = 0x8000U |
Pan center value. | |
static const uint_t | cPanRight = 0xFFFFU |
Pan right value. | |
static const uint_t | cWAVHeaderSize = 0x2C |
Size in bytes of a WAV file header. | |
static const uint32_t | cRIFFASCII = 0x52494646U |
'RIFF' | |
static const uint32_t | cAIFFASCII = 0x41494646U |
'AIFF' | |
static const uint32_t | cAIFCASCII = 0x41494643U |
'AIFC' | |
static const uint32_t | cWAVEASCII = 0x57415645U |
'WAVE' | |
static const uint32_t | cFORMASCII = 0x464F524DU |
'FORM' | |
static const uint32_t | cDATAASCII = 0x64617461U |
'data' | |
static const uint32_t | cMAC6ASCII = 0x4D414336U |
'MAC6' | |
static const uint32_t | cMAC3ASCII = 0x4D414333U |
'MAC3' | |
static const uint32_t | cOggSASCII = 0x4F676753U |
'OggS' | |
static const uint32_t | cCOMMASCII = 0x434F4D4DU |
'COMM' | |
static const uint32_t | cSSNDASCII = 0x53534E44U |
'SSND' | |
static const uint32_t | calawASCII = 0x616C6177U |
'alaw' | |
static const uint32_t | culawASCII = 0x756C6177U |
'ulaw' | |
static const uint32_t | cfl32ASCII = 0x666C3332U |
'fl32' | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Protected Member Functions | |
Voice * | AllocVoice (void) |
Find a free voice channel. | |
Static Protected Member Functions | |
static unsigned long __stdcall | ThreadCallback (void *pThis) |
Protected Attributes | |
GameApp * | m_pGameApp |
Reference to the game application. | |
IXAudio2 * | m_pIXAudio2 |
XAudio2 object (Xbox 360, XBone, Windows Store) | |
IXAudio2MasteringVoice * | m_pIXAudio2MasteringVoice |
XAudio2 mastering voice buffer (Xbox 360, XBone, Windows Store) | |
IDirectSound8 * | m_pDirectSound8Device |
Primary DirectSound Device (Windows Only) | |
IDirectSound3DListener * | m_pDirectSound3DListener |
Object for 3D audio origin (Windows Only) | |
IDirectSoundBuffer * | m_pDirectSoundBuffer |
Primary DirectSoundBuffer (Windows Only) | |
void * | m_hCallback |
HANDLE of the callback thread (Windows only) | |
unsigned long | m_uCallbackID |
ID of the callback thread (Windows only) | |
uint_t | m_uBufferAllocationType |
Preferred method of allocating audio memory (Windows Only) | |
void * | m_hEvents [cMaxVoiceCount] |
Events for DirectSound completion functions (Windows Only) | |
OpaqueAUGraph * | m_pGraph |
Main audio rendering graph. | |
ComponentInstanceRecord * | m_pOutputUnit |
Audio component instance. | |
ComponentInstanceRecord * | m_pMixerUnit |
Main mixer unit. | |
ComponentInstanceRecord * | m_pSoundUnits [cMaxVoiceCount] |
Waveform generator unit. | |
int32_t | m_iSoundNodes [cMaxVoiceCount] |
Waveform node. | |
int32_t | m_iOutputNode |
Audio output node index. | |
int32_t | m_iMixerNode |
Mixer node index. | |
uint32_t | m_uDeviceID |
Audio device ID. | |
Voice | m_ActiveVoices [cMaxVoiceCount] |
Array of active sound buffers being played. | |
uint_t | m_uMaxVoices |
Maximum number of voices supported for mixing. | |
uint_t | m_uVolume |
Current volume. | |
uint_t | m_bStereoAvailable |
TRUE if stereo is supported | |
uint_t | m_bMasterVolumeAvailable |
TRUE if a master volume is supported | |
uint_t | m_uBufferDepth |
Bits per sample the output DAC supports (8 or 16 bit) | |
uint_t | m_uOutputSamplesPerSecond |
Maximum sample rate the mixer supports. | |
Private Member Functions | |
SoundManager (const SoundManager &)=delete | |
SoundManager & | operator= (const SoundManager &)=delete |
SoundManager (SoundManager &&)=delete | |
SoundManager & | operator= (SoundManager &&)=delete |
This class manages sound output to the application's speakers
All of the underlying code is system specific
void( *) Burger::SoundManager::CompletionProc(void *) |
Function prototype for sound event callbacks.
|
privatedelete |
|
privatedelete |
Burger::SoundManager::SoundManager | ( | GameApp * | pGameApp | ) |
Constructor.
Initialize the variables to defaults. Follow up with a call to Init().
pGameApp | Pointer to the parent game application |
|
virtual |
Release all resources.
Shut down the Sound class by calling Shutdown() to release all of the resources.
|
protected |
Find a free voice channel.
Scan the array of voices and locate a free slot
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::Base.
uint_t BURGER_API Burger::SoundManager::GetActiveVoiceCount | ( | void | ) | const |
|
static |
Get a list of available audio modes.
pOutput | Pointer to array of SoundCardDescription entries |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
uint_t BURGER_API Burger::SoundManager::Init | ( | void | ) |
|
inline |
|
inline |
|
static |
Allocate and initialize a SoundManager.
pGameApp | Pointer to the parent game application |
Burger::SoundManager::Buffer *BURGER_API Burger::SoundManager::NewBuffer | ( | void * | pWaveFile, |
uintptr_t | uLength ) |
Create a new sound buffer.
|
privatedelete |
|
privatedelete |
uint_t BURGER_API Burger::SoundManager::Pause | ( | void | ) |
Pause sound.
uint_t BURGER_API Burger::SoundManager::Play | ( | Buffer * | pBuffer, |
Voice ** | ppCookie = 0 ) |
Play a sound.
uint_t BURGER_API Burger::SoundManager::Resume | ( | void | ) |
Resume sound.
void BURGER_API Burger::SoundManager::SetMaxVoices | ( | uint_t | uMax | ) |
Set the maximum number of voices to mix.
uMax | Number of voices to allow to use |
void BURGER_API Burger::SoundManager::SetVolume | ( | uint_t | uVolume | ) |
Set the master volume.
uVolume | Master volume 0-255 |
void BURGER_API Burger::SoundManager::Shutdown | ( | void | ) |
Shut down a SoundManager.
uint_t BURGER_API Burger::SoundManager::Stop | ( | void | ) |
Stop all sound.
|
staticprotected |
|
static |
'AIFC'
|
static |
'AIFF'
|
static |
'alaw'
|
static |
'COMM'
|
static |
'data'
|
static |
'fl32'
|
static |
'FORM'
|
static |
'MAC3'
|
static |
'MAC6'
|
static |
Maximum number of simultaneous tones to mix for output.
|
static |
Maximum volume value.
|
static |
'OggS'
|
static |
Pan center value.
|
static |
Pan left value.
|
static |
Pan right value.
|
static |
'RIFF'
|
static |
'SSND'
|
static |
'ulaw'
|
static |
'WAVE'
|
static |
Size in bytes of a WAV file header.
|
static |
Table used for quick Direct sound volume conversion from 0-255 to Decibels
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
This record contains the name of this class and a reference to the parent
|
protected |
Array of active sound buffers being played.
|
protected |
TRUE if a master volume is supported
|
protected |
HANDLE of the callback thread (Windows only)
|
protected |
Events for DirectSound completion functions (Windows Only)
|
protected |
Mixer node index.
|
protected |
Audio output node index.
|
protected |
Waveform node.
|
protected |
Object for 3D audio origin (Windows Only)
|
protected |
Primary DirectSound Device (Windows Only)
|
protected |
Primary DirectSoundBuffer (Windows Only)
|
protected |
Reference to the game application.
|
protected |
Main audio rendering graph.
|
protected |
XAudio2 object (Xbox 360, XBone, Windows Store)
|
protected |
XAudio2 mastering voice buffer (Xbox 360, XBone, Windows Store)
|
protected |
Main mixer unit.
|
protected |
Audio component instance.
|
protected |
Waveform generator unit.
|
protected |
Preferred method of allocating audio memory (Windows Only)
|
protected |
Bits per sample the output DAC supports (8 or 16 bit)
|
protected |
ID of the callback thread (Windows only)
|
protected |
Audio device ID.
|
protected |
Maximum number of voices supported for mixing.
|
protected |
Maximum sample rate the mixer supports.
|
protected |
Current volume.