mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Merge pull request #561 from alexey-lysiuk/openal_numsources
Handle inability of OpenAL to return number of sources
This commit is contained in:
commit
71f230dc08
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