mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
Handle inability of OpenAL implementation to return number of available sources
OpenAL specification doesn't require alcGetIntegerv() to return meaningful values for ALC_MONO_SOURCES and ALC_MONO_SOURCES. At least Apple's OpenAL implementation returns zeroes, although it can generate reasonable number of sources.
This commit is contained in:
parent
01bed05275
commit
ce8b2974a3
1 changed files with 14 additions and 1 deletions
|
@ -781,7 +781,20 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
|||
alcGetIntegerv(Device, ALC_MONO_SOURCES, 1, &numMono);
|
||||
alcGetIntegerv(Device, ALC_STEREO_SOURCES, 1, &numStereo);
|
||||
|
||||
Sources.Resize(MIN<int>(MAX<int>(*snd_channels, 2), numMono+numStereo));
|
||||
// OpenAL specification doesn't require alcGetIntegerv() to return
|
||||
// meaningful values for ALC_MONO_SOURCES and ALC_MONO_SOURCES.
|
||||
// At least Apple's OpenAL implementation returns zeroes,
|
||||
// although it can generate reasonable number of sources.
|
||||
|
||||
const int numChannels = MAX<int>(*snd_channels, 2);
|
||||
int numSources = numMono + numStereo;
|
||||
|
||||
if (0 == numSources)
|
||||
{
|
||||
numSources = numChannels;
|
||||
}
|
||||
|
||||
Sources.Resize(MIN<int>(numChannels, numSources));
|
||||
for(size_t i = 0;i < Sources.Size();i++)
|
||||
{
|
||||
alGenSources(1, &Sources[i]);
|
||||
|
|
Loading…
Reference in a new issue