Audio/AL: Request our default sampling rate (48kHz) from AL when creating the

context.
Otherwise AL might downsample and output in 44.1kHz unnecessarily, which
happens at least on my system. Also tested on an audio device that
doesn't support 48kHz to makes sure that still works.
This commit is contained in:
Oschowa 2021-02-09 13:19:10 +01:00 committed by Ivan
parent 5129d0da45
commit a47bda026b

View File

@ -14,10 +14,12 @@ LOG_CHANNEL(OpenAL);
OpenALBackend::OpenALBackend()
: AudioBackend()
{
ALCint attribs[] = {ALC_FREQUENCY, DEFAULT_AUDIO_SAMPLING_RATE, 0, 0};
ALCdevice* m_device = alcOpenDevice(nullptr);
checkForAlcError("alcOpenDevice");
ALCcontext* m_context = alcCreateContext(m_device, nullptr);
ALCcontext* m_context = alcCreateContext(m_device, attribs);
checkForAlcError("alcCreateContext");
alcMakeContextCurrent(m_context);