Added a workaround for a bug in the OS X implementation of OpenAL (unsupported channel count no properly detected) (#201)
This commit is contained in:
parent
5552cd5cc5
commit
947ab5fd87
@ -101,16 +101,23 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount)
|
||||
ensureALInit();
|
||||
|
||||
// Find the good format according to the number of channels
|
||||
int format = 0;
|
||||
switch (channelCount)
|
||||
{
|
||||
case 1 : return AL_FORMAT_MONO16;
|
||||
case 2 : return AL_FORMAT_STEREO16;
|
||||
case 4 : return alGetEnumValue("AL_FORMAT_QUAD16");
|
||||
case 6 : return alGetEnumValue("AL_FORMAT_51CHN16");
|
||||
case 7 : return alGetEnumValue("AL_FORMAT_61CHN16");
|
||||
case 8 : return alGetEnumValue("AL_FORMAT_71CHN16");
|
||||
default : return 0;
|
||||
case 1 : format = AL_FORMAT_MONO16; break;
|
||||
case 2 : format = AL_FORMAT_STEREO16; break;
|
||||
case 4 : format = alGetEnumValue("AL_FORMAT_QUAD16"); break;
|
||||
case 6 : format = alGetEnumValue("AL_FORMAT_51CHN16"); break;
|
||||
case 7 : format = alGetEnumValue("AL_FORMAT_61CHN16"); break;
|
||||
case 8 : format = alGetEnumValue("AL_FORMAT_71CHN16"); break;
|
||||
default : format = 0; break;
|
||||
}
|
||||
|
||||
// Fixes a bug on OS X
|
||||
if (format == -1)
|
||||
format = 0;
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
Loading…
Reference in New Issue
Block a user