mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-11 03:23:50 +00:00
OpenAL device fix (thx PL)
This commit is contained in:
parent
53a2dc6c65
commit
10c8d53e36
3 changed files with 21 additions and 8 deletions
|
@ -980,7 +980,7 @@ class OpenALSystem
|
||||||
public:
|
public:
|
||||||
OpenALSystem();
|
OpenALSystem();
|
||||||
~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 update();
|
||||||
FMOD_RESULT release();
|
FMOD_RESULT release();
|
||||||
FMOD_RESULT getVersion(unsigned int *version);
|
FMOD_RESULT getVersion(unsigned int *version);
|
||||||
|
@ -1130,12 +1130,25 @@ FMOD_RESULT OpenALSystem::getVersion(unsigned int *version)
|
||||||
return FMOD_OK;
|
return FMOD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALBRIDGE(System,init,(int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata),(maxchannels,flags,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)
|
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)
|
if (!dev)
|
||||||
|
{
|
||||||
return FMOD_ERR_INTERNAL;
|
return FMOD_ERR_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
// OpenAL doesn't provide a way to request sources that can be either
|
// 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
|
// mono or stereo, so we need to request both separately (thus allocating
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace FMOD
|
||||||
FMOD_RESULT getDriverCaps(int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency, FMOD_SPEAKERMODE *controlpanelspeakermode);
|
FMOD_RESULT getDriverCaps(int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency, FMOD_SPEAKERMODE *controlpanelspeakermode);
|
||||||
FMOD_RESULT getMasterChannelGroup(ChannelGroup **channelgroup);
|
FMOD_RESULT getMasterChannelGroup(ChannelGroup **channelgroup);
|
||||||
FMOD_RESULT getVersion(unsigned int *version);
|
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 playSound(FMOD_CHANNELINDEX channelid, Sound *sound, bool paused, Channel **channel);
|
||||||
FMOD_RESULT setDSPBufferSize(unsigned int bufferlength, int numbuffers);
|
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);
|
FMOD_RESULT setFileSystem(FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, int blockalign);
|
||||||
|
|
|
@ -326,15 +326,15 @@ SoundManager::SoundManager(const std::string &defaultDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog("init");
|
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... */
|
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");
|
debugLog("err_output_createbuffer, speaker mode");
|
||||||
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
|
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
|
||||||
if (checkError()) goto get_out;
|
if (checkError()) goto get_out;
|
||||||
|
|
||||||
debugLog("init 2");
|
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;
|
if (checkError()) goto get_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue