mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
qtox will now attempt to default to the first audio output device
This commit is contained in:
parent
fa1e79787c
commit
1d9e89f318
|
@ -242,7 +242,29 @@ bool Audio::openOutput(const QString &outDevDescr)
|
||||||
if (outDevDescr != "none")
|
if (outDevDescr != "none")
|
||||||
{
|
{
|
||||||
if (outDevDescr.isEmpty())
|
if (outDevDescr.isEmpty())
|
||||||
alOutDev = alcOpenDevice(nullptr);
|
{
|
||||||
|
// Attempt to default to the first available audio device.
|
||||||
|
const ALchar *pDeviceList;
|
||||||
|
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||||
|
pDeviceList = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
|
else
|
||||||
|
pDeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||||
|
if (pDeviceList)
|
||||||
|
{
|
||||||
|
alOutDev = alcOpenDevice(pDeviceList);
|
||||||
|
int len = strlen(pDeviceList);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QString outDev = QString::fromUtf8(pDeviceList, len);
|
||||||
|
#else
|
||||||
|
QString outDev = QString::fromLocal8Bit(pDeviceList, len);
|
||||||
|
#endif
|
||||||
|
Settings::getInstance().setOutDev(outDev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alOutDev = alcOpenDevice(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());
|
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user