improve logging of opened audio device

In fact, ALC_DEVICE_SPECIFIER is only a fallback if the
ALC_ENUMERATE_ALL_EXT extension is not available.

Also added logging the sample rate.

I would have liked to log the used resampler as well, but apparently
this requires jumping through some more loops.
This commit is contained in:
Fabian Greffrath 2023-04-18 11:45:12 +02:00
parent 654ddf6200
commit aa17f83ac0

View File

@ -560,13 +560,20 @@ void I_InitSound(void)
setenv("ALSOFT_CONF", WOOFDATADIR"/alsoft.conf", 0);
#endif
name = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
device = alcOpenDevice(NULL);
device = alcOpenDevice(name);
if (device)
{
name = alcGetString(device, ALC_DEVICE_SPECIFIER);
printf("Using '%s'.\n", name);
ALCint srate = -1;
if (alcIsExtensionPresent(device, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
name = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER);
else
name = alcGetString(device, ALC_DEVICE_SPECIFIER);
alcGetIntegerv(device, ALC_FREQUENCY, 1, &srate);
printf("Using '%s' @ %d Hz.\n", name, srate);
}
else
{