mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:28:37 +02:00
repairs to local audio injector cleanup
This commit is contained in:
parent
9461d5d8d1
commit
c9c53453c3
2 changed files with 5 additions and 10 deletions
|
@ -967,15 +967,15 @@ bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector
|
||||||
localFormat.setChannelCount(isStereo ? 2 : 1);
|
localFormat.setChannelCount(isStereo ? 2 : 1);
|
||||||
|
|
||||||
QAudioOutput* localOutput = new QAudioOutput(getNamedAudioDeviceForMode(QAudio::AudioOutput, _outputAudioDeviceName),
|
QAudioOutput* localOutput = new QAudioOutput(getNamedAudioDeviceForMode(QAudio::AudioOutput, _outputAudioDeviceName),
|
||||||
localFormat);
|
localFormat,
|
||||||
|
injector);
|
||||||
localOutput->setVolume(volume);
|
localOutput->setVolume(volume);
|
||||||
|
|
||||||
// move the localOutput to the same thread as the local injector buffer
|
// move the localOutput to the same thread as the local injector buffer
|
||||||
localOutput->moveToThread(injector->getLocalBuffer()->thread());
|
localOutput->moveToThread(injector->getLocalBuffer()->thread());
|
||||||
|
|
||||||
// have it be cleaned up when that thread is done
|
// have it be cleaned up when that injector is done
|
||||||
connect(injector->thread(), &QThread::finished, localOutput, &QAudioOutput::stop);
|
connect(injector, &AudioInjector::finished, localOutput, &QAudioOutput::stop);
|
||||||
connect(injector->thread(), &QThread::finished, localOutput, &QAudioOutput::deleteLater);
|
|
||||||
|
|
||||||
qDebug() << "Starting QAudioOutput for local injector" << localOutput;
|
qDebug() << "Starting QAudioOutput for local injector" << localOutput;
|
||||||
|
|
||||||
|
|
|
@ -108,12 +108,7 @@ void AudioInjector::injectLocally() {
|
||||||
// give our current send position to the local buffer
|
// give our current send position to the local buffer
|
||||||
_localBuffer->setCurrentOffset(_currentSendPosition);
|
_localBuffer->setCurrentOffset(_currentSendPosition);
|
||||||
|
|
||||||
QMetaObject::invokeMethod(_localAudioInterface, "outputLocalInjector",
|
success = _localAudioInterface->outputLocalInjector(_options.stereo, _options.volume, this);
|
||||||
Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(bool, success),
|
|
||||||
Q_ARG(bool, _options.stereo),
|
|
||||||
Q_ARG(qreal, _options.volume),
|
|
||||||
Q_ARG(AudioInjector*, this));
|
|
||||||
|
|
||||||
// if we're not looping and the buffer tells us it is empty then emit finished
|
// if we're not looping and the buffer tells us it is empty then emit finished
|
||||||
connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop);
|
connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop);
|
||||||
|
|
Loading…
Reference in a new issue