1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 06:05:45 +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

View file

@ -158,7 +158,7 @@ namespace FMOD
FMOD_RESULT getDriverCaps(int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency, FMOD_SPEAKERMODE *controlpanelspeakermode);
FMOD_RESULT getMasterChannelGroup(ChannelGroup **channelgroup);
FMOD_RESULT getVersion(unsigned int *version);
FMOD_RESULT init(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata);
FMOD_RESULT init(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, std::string defaultDevice);
FMOD_RESULT playSound(FMOD_CHANNELINDEX channelid, Sound *sound, bool paused, Channel **channel);
FMOD_RESULT setDSPBufferSize(unsigned int bufferlength, int numbuffers);
FMOD_RESULT setFileSystem(FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, int blockalign);

View file

@ -326,15 +326,15 @@ SoundManager::SoundManager(const std::string &defaultDevice)
}
debugLog("init");
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0, defaultDevice); /* Replace with whatever channel count and flags you use! */
if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) /* Ok, the speaker mode selected isn't supported by this soundcard. Switch it back to stereo... */
{
debugLog("err_output_createbuffer, speaker mode");
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
if (checkError()) goto get_out;
debugLog("init 2");
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0, defaultDevice); /* Replace with whatever channel count and flags you use! */
if (checkError()) goto get_out;
}