1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 06:24:32 +00:00

OpenAL device fix (thx PL)

This commit is contained in:
fgenesis 2011-08-11 23:43:26 +02:00
parent 53a2dc6c65
commit 10c8d53e36
3 changed files with 21 additions and 8 deletions

View file

@ -980,7 +980,7 @@ class OpenALSystem
public:
OpenALSystem();
~OpenALSystem();
FMOD_RESULT init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata);
FMOD_RESULT init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata, std::string defaultDevice);
FMOD_RESULT update();
FMOD_RESULT release();
FMOD_RESULT getVersion(unsigned int *version);
@ -1130,12 +1130,25 @@ FMOD_RESULT OpenALSystem::getVersion(unsigned int *version)
return FMOD_OK;
}
ALBRIDGE(System,init,(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata),(maxchannels,flags,extradriverdata))
FMOD_RESULT OpenALSystem::init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata)
ALBRIDGE(System,init,(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, std::string defaultDevice),(maxchannels,flags,extradriverdata, defaultDevice))
FMOD_RESULT OpenALSystem::init(int maxchannels, const FMOD_INITFLAGS flags, const void *extradriverdata, std::string defaultDevice)
{
ALCdevice *dev = alcOpenDevice(NULL);
ALCdevice *dev = NULL;
if (!defaultDevice.empty())
{
dev = alcOpenDevice(defaultDevice.c_str()); // Try to use device specified in user config
}
if (!dev)
{
dev = alcOpenDevice(NULL); // Fall back to system default device
}
if (!dev)
{
return FMOD_ERR_INTERNAL;
}
// OpenAL doesn't provide a way to request sources that can be either
// mono or stereo, so we need to request both separately (thus allocating