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:
parent
434808cd67
commit
8ff3d1d960
12
src/core.cpp
12
src/core.cpp
|
@ -72,7 +72,11 @@ Core::Core(Camera* cam, QThread *coreThread, QString loadPath) :
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenAL init
|
// OpenAL init
|
||||||
|
QString outDevDescr = Settings::getInstance().getOutDev(); ;
|
||||||
|
if (outDevDescr.isEmpty())
|
||||||
alOutDev = alcOpenDevice(nullptr);
|
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";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user