On waking from sleep/hibernate, restart the audio devices

This commit is contained in:
Ken Cooke 2019-10-10 14:10:47 -07:00
parent 1316f9b046
commit ec67b67966
3 changed files with 8 additions and 0 deletions

View file

@ -974,6 +974,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
QObject::connect(PlatformHelper::instance(), &PlatformHelper::systemWillWake, [] {
QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection);
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "noteAwakening", Qt::QueuedConnection);
});

View file

@ -1998,6 +1998,12 @@ void AudioClient::outputNotify() {
}
}
void AudioClient::noteAwakening() {
qCDebug(audioclient) << "Restarting the audio devices.";
switchInputToAudioDevice(_inputDeviceInfo);
switchOutputToAudioDevice(_outputDeviceInfo);
}
bool AudioClient::switchOutputToAudioDevice(const HifiAudioDeviceInfo outputDeviceInfo, bool isShutdownRequest) {
Q_ASSERT_X(QThread::currentThread() == thread(), Q_FUNC_INFO, "Function invoked on wrong thread");

View file

@ -255,6 +255,7 @@ public slots:
void setOutputGain(float gain) { _outputGain = gain; };
void outputNotify();
void noteAwakening();
void loadSettings();
void saveSettings();