1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr2633'

This commit is contained in:
tux3 2015-12-07 07:49:17 +01:00
commit 89def77ee6
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -242,7 +242,29 @@ bool Audio::openOutput(const QString &outDevDescr)
if (outDevDescr != "none")
{
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
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());