mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 12:36:42 +00:00
Merge branch 'audio-device-close-error' into 'master'
don't forget to close the audio device after you're done with it. See merge request OpenMW/openmw!759
This commit is contained in:
commit
138d3b65a3
1 changed files with 17 additions and 11 deletions
|
@ -37,7 +37,9 @@ std::vector<const char *> Launcher::enumerateOpenALDevicesHrtf()
|
||||||
std::vector<const char *> ret;
|
std::vector<const char *> ret;
|
||||||
|
|
||||||
ALCdevice *device = alcOpenDevice(nullptr);
|
ALCdevice *device = alcOpenDevice(nullptr);
|
||||||
if(device && alcIsExtensionPresent(device, "ALC_SOFT_HRTF"))
|
if(device)
|
||||||
|
{
|
||||||
|
if(alcIsExtensionPresent(device, "ALC_SOFT_HRTF"))
|
||||||
{
|
{
|
||||||
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr;
|
||||||
void* funcPtr = alcGetProcAddress(device, "alcGetStringiSOFT");
|
void* funcPtr = alcGetProcAddress(device, "alcGetStringiSOFT");
|
||||||
|
@ -45,11 +47,15 @@ std::vector<const char *> Launcher::enumerateOpenALDevicesHrtf()
|
||||||
ALCint num_hrtf;
|
ALCint num_hrtf;
|
||||||
alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtf);
|
alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtf);
|
||||||
ret.reserve(num_hrtf);
|
ret.reserve(num_hrtf);
|
||||||
for(ALCint i = 0;i < num_hrtf && i < 20;++i)
|
for(ALCint i = 0;i < num_hrtf;++i)
|
||||||
{
|
{
|
||||||
const ALCchar *entry = alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
|
const ALCchar *entry = alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
|
||||||
|
if(strcmp(entry, "") == 0)
|
||||||
|
break;
|
||||||
ret.emplace_back(entry);
|
ret.emplace_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
alcCloseDevice(device);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
Loading…
Reference in a new issue