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

Open the audio in/out devices of the settings

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-28 21:27:51 +01:00
parent 434808cd67
commit 8ff3d1d960
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -72,7 +72,11 @@ Core::Core(Camera* cam, QThread *coreThread, QString loadPath) :
} }
// OpenAL init // OpenAL init
alOutDev = alcOpenDevice(nullptr); QString outDevDescr = Settings::getInstance().getOutDev(); ;
if (outDevDescr.isEmpty())
alOutDev = alcOpenDevice(nullptr);
else
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());
if (!alOutDev) if (!alOutDev)
{ {
qWarning() << "Core: Cannot open output audio device"; qWarning() << "Core: Cannot open output audio device";
@ -88,7 +92,13 @@ Core::Core(Camera* cam, QThread *coreThread, QString loadPath) :
else else
alGenSources(1, &alMainSource); alGenSources(1, &alMainSource);
} }
alInDev = alcCaptureOpenDevice(NULL,av_DefaultSettings.audio_sample_rate, AL_FORMAT_MONO16,
QString inDevDescr = Settings::getInstance().getInDev();
if (inDevDescr.isEmpty())
alInDev = alcCaptureOpenDevice(nullptr,av_DefaultSettings.audio_sample_rate, AL_FORMAT_MONO16,
(av_DefaultSettings.audio_frame_duration * av_DefaultSettings.audio_sample_rate * 4) / 1000);
else
alInDev = alcCaptureOpenDevice(inDevDescr.toStdString().c_str(),av_DefaultSettings.audio_sample_rate, AL_FORMAT_MONO16,
(av_DefaultSettings.audio_frame_duration * av_DefaultSettings.audio_sample_rate * 4) / 1000); (av_DefaultSettings.audio_frame_duration * av_DefaultSettings.audio_sample_rate * 4) / 1000);
if (!alInDev) if (!alInDev)
qWarning() << "Core: Cannot open input audio device"; qWarning() << "Core: Cannot open input audio device";