Merge pull request #16327 from kencooke/audio-device-sleep-wake

DEV-1901: No audio in Interface when restoring from sleep
This commit is contained in:
Ken Cooke 2019-10-10 15:12:07 -07:00 committed by GitHub
commit 8325ee2c8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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();