SFXDevice
Abstract base class for back-end sound API implementations.
Public Types
ECaps { CAPS_Reverb = BIT( 0 ) CAPS_VoiceManagement = BIT( 1 ) CAPS_Occlusion = BIT( 2 ) CAPS_DSPEffects = BIT( 3 ) CAPS_MultiListener = BIT( 4 ) CAPS_FMODDesigner = BIT( 5 ) }
Device capability flags.
Parent
Protected Types
BufferIterator
VoiceIterator
Protected Attributes
Current set of sound buffers.
The maximum playback buffers this device will use.
The provider which created this device.
Current total memory size of sound buffers. Reflected in $SFX::Device::numBufferBytes.
Current number of buffers. Reflected in $SFX::Device::numBuffers.
Current number of voices. Reflected in $SFX::Device::numVoices.
bool
Should the device try to use hardware processing.
Current set of voices.
Protected Functions
SFXDevice(const String & name, SFXProvider * provider, bool useHardware, S32 maxBuffers)
_addBuffer(SFXBuffer * buffer)
Register a buffer with the device.
Release all resources tied to the device.
_removeBuffer(SFXBuffer * buffer)
Unregister the given buffer.
_removeVoice(SFXVoice * buffer)
Unregister the given voice.
Public Functions
createBuffer(const String & fileName, SFXDescription * description)
Create a sound buffer directly for a file.
createBuffer(const ThreadSafeRef< SFXStream > & stream, SFXDescription * description)
Tries to create a new sound buffer.
SFXVoice *
createVoice(bool is3D, SFXBuffer * buffer)
Tries to create a new voice.
Return the current total number of sound buffers.
The maximum number of playback buffers this device will use.
Returns the provider which created this device.
bool
Is the device set to use hardware processing.
Return the current total number of voices.
Reset the global reverb environment to its default.
setDistanceModel(SFXDistanceModel model)
Set the rolloff curve to be used by distance attenuation of 3D sounds.
setDopplerFactor(F32 factor)
Set the scale factor to use for doppler effects on 3D sounds.
setListener(U32 index, const SFXListenerProperties & listener)
Set the properties of the given listener.
setNumListeners(U32 num)
Set the number of concurrent listeners on the device.
setReverb(const SFXReverbProperties & reverb)
Set the global reverb environment.
setRolloffFactor(F32 factor)
Set the rolloff scale factor for distance attenuation of 3D sounds.
Detailed Description
Abstract base class for back-end sound API implementations.
Public Types
ECaps
Enumerator
- CAPS_Reverb = BIT( 0 )
Device supports reverb environments.
- CAPS_VoiceManagement = BIT( 1 )
Device manages voices on its own; deactivates virtualization code in SFX system.
- CAPS_Occlusion = BIT( 2 )
Device has its own sound occlusion handling (SFXOcclusionManager).
- CAPS_DSPEffects = BIT( 3 )
Device implements DSP effects (SFXDSPManager).
- CAPS_MultiListener = BIT( 4 )
Device supports multiple listeners.
- CAPS_FMODDesigner = BIT( 5 )
FMOD Designer support.
Device capability flags.
typedef void Parent
Protected Types
typedef BufferVector::iterator BufferIterator
typedef Vector< SFXBuffer * > BufferVector
typedef VoiceVector::iterator VoiceIterator
typedef Vector< SFXVoice * > VoiceVector
Protected Attributes
BufferVector mBuffers
Current set of sound buffers.
U32 mCaps
Device capabilities.
S32 mMaxBuffers
The maximum playback buffers this device will use.
String mName
The name of this device.
SFXProvider * mProvider
The provider which created this device.
U32 mStatNumBufferBytes
Current total memory size of sound buffers. Reflected in $SFX::Device::numBufferBytes.
U32 mStatNumBuffers
Current number of buffers. Reflected in $SFX::Device::numBuffers.
U32 mStatNumVoices
Current number of voices. Reflected in $SFX::Device::numVoices.
bool mUseHardware
Should the device try to use hardware processing.
VoiceVector mVoices
Current set of voices.
Protected Functions
SFXDevice(const String & name, SFXProvider * provider, bool useHardware, S32 maxBuffers)
_addBuffer(SFXBuffer * buffer)
Register a buffer with the device.
This also triggers the buffer's stream packet request chain.
_addVoice(SFXVoice * voice)
Register a voice with the device.
_releaseAllResources()
Release all resources tied to the device.
Can be called repeatedly without harm. It is meant for device destructors that will severe the connection to the sound API and thus need all resources freed before the base destructor is called.
_removeBuffer(SFXBuffer * buffer)
Unregister the given buffer.
_removeVoice(SFXVoice * buffer)
Unregister the given voice.
Public Functions
~SFXDevice()
createBuffer(const String & fileName, SFXDescription * description)
Create a sound buffer directly for a file.
This is for devices that implemented their own custom file loading.
note:Only implemented on specific SFXDevices.
Return a new buffer or NULL.
Reimplemented by: SFXFMODDevice
createBuffer(const ThreadSafeRef< SFXStream > & stream, SFXDescription * description)
Tries to create a new sound buffer.
If creation fails freeing another buffer will usually allow a new one to be created.
Parameters:
stream | The sound data stream. |
description | The playback configuration. |
Returns a new buffer or NULL if one cannot be created.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXNullDevice, SFXALDevice, SFXXAudioDevice
createVoice(bool is3D, SFXBuffer * buffer)
Tries to create a new voice.
Parameters:
is3d | True if the voice should have 3D sound enabled. |
buffer | The sound data to play by the voice. |
Returns a new voice or NULL if one cannot be created.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXNullDevice, SFXALDevice, SFXXAudioDevice
getBufferCount()
Return the current total number of sound buffers.
getCaps()
Return the device capability flags.
getMaxBuffers()
The maximum number of playback buffers this device will use.
getName()
Returns the name of this device.
getProvider()
Returns the provider which created this device.
getUseHardware()
Is the device set to use hardware processing.
getVoiceCount()
Return the current total number of voices.
openSlots()
send empty function to all sfxdevices
resetReverb()
Reset the global reverb environment to its default.
Reimplemented by: SFXFMODDevice, SFXALDevice
setDistanceModel(SFXDistanceModel model)
Set the rolloff curve to be used by distance attenuation of 3D sounds.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXALDevice, SFXXAudioDevice
setDopplerFactor(F32 factor)
Set the scale factor to use for doppler effects on 3D sounds.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXALDevice, SFXXAudioDevice
setListener(U32 index, const SFXListenerProperties & listener)
Set the properties of the given listener.
note:On devices that do not support multiple listeners, only setting the properties on index=0 will have a effect.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXALDevice, SFXXAudioDevice
setNumListeners(U32 num)
Set the number of concurrent listeners on the device.
note:On devices that do not support multiple listeners, any value other than 1 will be ignored.
Reimplemented by: SFXFMODDevice
setReverb(const SFXReverbProperties & reverb)
Set the global reverb environment.
Reimplemented by: SFXFMODDevice
setRolloffFactor(F32 factor)
Set the rolloff scale factor for distance attenuation of 3D sounds.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXALDevice, SFXXAudioDevice
update()
Called from SFXSystem to do any updates the device may need to make.
Reimplemented by: SFXDSDevice, SFXFMODDevice, SFXNullDevice, SFXXAudioDevice