SFX API Changes

DSound has since been deprecated and xaudio2 would require us to write our own 3d spatialization and mixer
Load devices the same way we load in the gfx end
setup sfx provider
run sfx devices on startup
various fixes around sfx null device
added the bitrate and samplerate globals
added the hrtf global code is in to use this but not setup yet
Adds speed of sound to the sound system
SFXAmbience now has a property for speed of sound for different mediums, can also be set directly
This commit is contained in:
marauder2k7 2026-03-13 08:05:42 +00:00
parent 1c6409a485
commit 974f217b96
53 changed files with 1885 additions and 6409 deletions

View file

@ -24,15 +24,30 @@
#include "sfx/null/sfxNullBuffer.h"
#include "sfx/sfxInternal.h"
SFXNullDevice::SFXNullDevice( SFXProvider* provider,
String name,
bool useHardware,
S32 maxBuffers )
: SFXDevice( name, provider, useHardware, maxBuffers )
class SFXNULLRegisterProvider
{
mMaxBuffers = getMax( maxBuffers, 8 );
public:
SFXNULLRegisterProvider()
{
SFXSystem::getRegisterProviderSignal().notify(&SFXNullDevice::enumerateProviders);
}
};
static SFXNULLRegisterProvider pSFXNULLRegisterProvider;
SFXProvider::CreateProviderInstanceDelegate SFXNullDevice::mCreateDeviceInstance(SFXNullDevice::createInstance);
SFXDevice* SFXNullDevice::createInstance(U32 providerIndex)
{
SFXNullDevice* dev = new SFXNullDevice(providerIndex);
return dev;
}
SFXNullDevice::SFXNullDevice( U32 providerIndex )
{
mMaxBuffers = 8;
}
SFXNullDevice::~SFXNullDevice()
@ -65,6 +80,17 @@ SFXVoice* SFXNullDevice::createVoice( bool is3D, SFXBuffer *buffer )
return voice;
}
void SFXNullDevice::enumerateProviders(Vector<SFXProvider*>& providerList)
{
SFXProvider* toAdd = new SFXProvider;
toAdd->mName = String::ToString("SFX Null Device");
toAdd->mIndex = providerList.size();
toAdd->mDeviceType = Output;
toAdd->mType = NullProvider;
toAdd->mCreateDeviceInstanceDelegate = mCreateDeviceInstance;
providerList.push_back(toAdd);
}
void SFXNullDevice::update()
{
// Do nothing. Prevent SFXDevice from running