mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-18 02:12:00 +00:00
Fix getting the actual device name
This commit is contained in:
parent
665d685a44
commit
160e70f8f2
1 changed files with 21 additions and 4 deletions
|
@ -591,7 +591,13 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(" Opened device "TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_DEVICE_SPECIFIER));
|
const ALCchar *current = NULL;
|
||||||
|
if(alcIsExtensionPresent(Device, "ALC_ENUMERATE_ALL_EXT"))
|
||||||
|
current = alcGetString(Device, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
|
if(alcGetError(Device) != ALC_NO_ERROR || !current)
|
||||||
|
current = alcGetString(Device, ALC_DEVICE_SPECIFIER);
|
||||||
|
Printf(" Opened device "TEXTCOLOR_ORANGE"%s\n", current);
|
||||||
|
|
||||||
ALCint major=0, minor=0;
|
ALCint major=0, minor=0;
|
||||||
alcGetIntegerv(Device, ALC_MAJOR_VERSION, 1, &major);
|
alcGetIntegerv(Device, ALC_MAJOR_VERSION, 1, &major);
|
||||||
alcGetIntegerv(Device, ALC_MINOR_VERSION, 1, &minor);
|
alcGetIntegerv(Device, ALC_MINOR_VERSION, 1, &minor);
|
||||||
|
@ -609,7 +615,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
// Make sure one source is capable of stereo output with the rest doing
|
// Make sure one source is capable of stereo output with the rest doing
|
||||||
// mono, without running out of voices
|
// mono, without running out of voices
|
||||||
attribs.push_back(ALC_MONO_SOURCES);
|
attribs.push_back(ALC_MONO_SOURCES);
|
||||||
attribs.push_back((std::max)(*snd_channels, 2) - 1);
|
attribs.push_back(std::max<ALCint>(*snd_channels, 2) - 1);
|
||||||
attribs.push_back(ALC_STEREO_SOURCES);
|
attribs.push_back(ALC_STEREO_SOURCES);
|
||||||
attribs.push_back(1);
|
attribs.push_back(1);
|
||||||
// Other attribs..?
|
// Other attribs..?
|
||||||
|
@ -657,7 +663,8 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
||||||
alcGetIntegerv(Device, ALC_MONO_SOURCES, 1, &numMono);
|
alcGetIntegerv(Device, ALC_MONO_SOURCES, 1, &numMono);
|
||||||
alcGetIntegerv(Device, ALC_STEREO_SOURCES, 1, &numStereo);
|
alcGetIntegerv(Device, ALC_STEREO_SOURCES, 1, &numStereo);
|
||||||
|
|
||||||
Sources.resize((std::min)((std::max)(*snd_channels, 2), numMono+numStereo));
|
Sources.resize(std::min<size_t>(std::max<ALCint>(*snd_channels, 2),
|
||||||
|
numMono+numStereo));
|
||||||
for(size_t i = 0;i < Sources.size();i++)
|
for(size_t i = 0;i < Sources.size();i++)
|
||||||
{
|
{
|
||||||
alGenSources(1, &Sources[i]);
|
alGenSources(1, &Sources[i]);
|
||||||
|
@ -1663,13 +1670,23 @@ void OpenALSoundRenderer::PrintDriversList()
|
||||||
const ALCchar *drivers = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ?
|
const ALCchar *drivers = (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") ?
|
||||||
alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) :
|
alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER) :
|
||||||
alcGetString(NULL, ALC_DEVICE_SPECIFIER));
|
alcGetString(NULL, ALC_DEVICE_SPECIFIER));
|
||||||
const ALCchar *current = alcGetString(Device, ALC_DEVICE_SPECIFIER);
|
|
||||||
if(drivers == NULL)
|
if(drivers == NULL)
|
||||||
{
|
{
|
||||||
Printf(TEXTCOLOR_YELLOW"Failed to retrieve device list: %s\n", alcGetString(NULL, alcGetError(NULL)));
|
Printf(TEXTCOLOR_YELLOW"Failed to retrieve device list: %s\n", alcGetString(NULL, alcGetError(NULL)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ALCchar *current = NULL;
|
||||||
|
if(alcIsExtensionPresent(Device, "ALC_ENUMERATE_ALL_EXT"))
|
||||||
|
current = alcGetString(Device, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
|
if(alcGetError(Device) != ALC_NO_ERROR || !current)
|
||||||
|
current = alcGetString(Device, ALC_DEVICE_SPECIFIER);
|
||||||
|
if(current == NULL)
|
||||||
|
{
|
||||||
|
Printf(TEXTCOLOR_YELLOW"Failed to retrieve device name: %s\n", alcGetString(Device, alcGetError(Device)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Printf("%c%s%2d. %s\n", ' ', ((strcmp(snd_aldevice, "Default") == 0) ? TEXTCOLOR_BOLD : ""), 0,
|
Printf("%c%s%2d. %s\n", ' ', ((strcmp(snd_aldevice, "Default") == 0) ? TEXTCOLOR_BOLD : ""), 0,
|
||||||
"Default");
|
"Default");
|
||||||
for(int i = 1;*drivers;i++)
|
for(int i = 1;*drivers;i++)
|
||||||
|
|
Loading…
Reference in a new issue