Microphone enumeration: warn user if ALC_ENUMERATION_EXT is missing.

This commit is contained in:
Megamouse 2023-09-12 20:07:29 +02:00
parent 2a32ded575
commit f398f1113d

View File

@ -1,3 +1,4 @@
#include "stdafx.h"
#include "microphone_creator.h"
#include "Utilities/StrFmt.h"
@ -5,7 +6,7 @@
#include "3rdparty/OpenAL/include/alext.h"
constexpr auto qstr = QString::fromStdString;
LOG_CHANNEL(cfg_log, "CFG");
microphone_creator::microphone_creator()
{
@ -25,11 +26,11 @@ void microphone_creator::refresh_list()
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT") == AL_TRUE)
{
if (const char* devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER); devices != nullptr)
if (const char* devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER))
{
while (*devices != 0)
{
m_microphone_list.append(qstr(devices));
m_microphone_list.append(devices);
devices += strlen(devices) + 1;
}
}
@ -37,9 +38,11 @@ void microphone_creator::refresh_list()
else
{
// Without enumeration we can only use one device
if (const char* device = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER); device != nullptr)
cfg_log.error("OpenAl extension ALC_ENUMERATION_EXT not supported. The microphone list will only contain the default microphone.");
if (const char* device = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER))
{
m_microphone_list.append(qstr(device));
m_microphone_list.append(device);
}
}
}