Merge pull request #5479 from howard-stearns/fix-multiple-local-sounds

All multiple local sounds
This commit is contained in:
Stephen Birarda 2015-08-03 10:23:48 -07:00
commit 7916ca91d5
2 changed files with 8 additions and 12 deletions

View file

@ -1037,9 +1037,14 @@ bool AudioClient::outputLocalInjector(bool isStereo, AudioInjector* injector) {
localOutput->moveToThread(injector->getLocalBuffer()->thread()); localOutput->moveToThread(injector->getLocalBuffer()->thread());
// have it be stopped when that local buffer is about to close // have it be stopped when that local buffer is about to close
connect(localOutput, &QAudioOutput::stateChanged, this, &AudioClient::audioStateChanged); // We don't want to stop this localOutput and injector whenever this AudioClient singleton goes idle,
connect(this, &AudioClient::audioFinished, localOutput, &QAudioOutput::stop); // only when the localOutput does. But the connection is to localOutput, so that it happens on the right thread.
connect(this, &AudioClient::audioFinished, injector, &AudioInjector::stop); connect(localOutput, &QAudioOutput::stateChanged, localOutput, [=](QAudio::State state) {
if (state == QAudio::IdleState) {
localOutput->stop();
injector->stop();
}
});
connect(injector->getLocalBuffer(), &QIODevice::aboutToClose, localOutput, &QAudioOutput::stop); connect(injector->getLocalBuffer(), &QIODevice::aboutToClose, localOutput, &QAudioOutput::stop);
@ -1358,9 +1363,3 @@ void AudioClient::saveSettings() {
windowSecondsForDesiredReduction.set(_receivedAudioStream.getWindowSecondsForDesiredReduction()); windowSecondsForDesiredReduction.set(_receivedAudioStream.getWindowSecondsForDesiredReduction());
repetitionWithFade.set(_receivedAudioStream.getRepetitionWithFade()); repetitionWithFade.set(_receivedAudioStream.getRepetitionWithFade());
} }
void AudioClient::audioStateChanged(QAudio::State state) {
if (state == QAudio::IdleState) {
emit audioFinished();
}
}

View file

@ -209,9 +209,6 @@ protected:
deleteLater(); deleteLater();
} }
private slots:
void audioStateChanged(QAudio::State state);
private: private:
void outputFormatChanged(); void outputFormatChanged();