kopia lustrzana https://gitlab.com/eliggett/wfview
Try to fix linux audio stopping on latency change
rodzic
64b4ef2019
commit
2cc875ff7c
|
@ -189,12 +189,10 @@ void audioHandler::start()
|
|||
if (setup.isinput) {
|
||||
audioDevice = audioInput->start();
|
||||
connect(audioInput, &QAudioOutput::destroyed, audioDevice, &QIODevice::deleteLater, Qt::UniqueConnection);
|
||||
connect(audioDevice, &QIODevice::destroyed, this, &QAudioInput::deleteLater, Qt::UniqueConnection);
|
||||
}
|
||||
else {
|
||||
audioDevice = audioOutput->start();
|
||||
connect(audioOutput, &QAudioOutput::destroyed, audioDevice, &QIODevice::deleteLater, Qt::UniqueConnection);
|
||||
connect(audioDevice, &QIODevice::destroyed, this, &QAudioOutput::deleteLater, Qt::UniqueConnection);
|
||||
}
|
||||
if (!audioDevice) {
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Audio device failed to start()";
|
||||
|
@ -202,6 +200,23 @@ void audioHandler::start()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void audioHandler::stop()
|
||||
{
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "stop() running";
|
||||
|
||||
if (audioOutput != Q_NULLPTR && audioOutput->state() != QAudio::StoppedState) {
|
||||
// Stop audio output
|
||||
audioOutput->stop();
|
||||
}
|
||||
|
||||
if (audioInput != Q_NULLPTR && audioInput->state() != QAudio::StoppedState) {
|
||||
// Stop audio output
|
||||
audioInput->stop();
|
||||
}
|
||||
audioDevice = Q_NULLPTR;
|
||||
}
|
||||
|
||||
void audioHandler::setVolume(unsigned char volume)
|
||||
{
|
||||
this->volume = audiopot[volume];
|
||||
|
@ -490,22 +505,6 @@ void audioHandler::getNextAudioChunk(QByteArray& ret)
|
|||
}
|
||||
|
||||
|
||||
void audioHandler::stop()
|
||||
{
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "stop() running";
|
||||
|
||||
if (audioOutput != Q_NULLPTR && audioOutput->state() != QAudio::StoppedState) {
|
||||
// Stop audio output
|
||||
audioOutput->stop();
|
||||
}
|
||||
|
||||
if (audioInput != Q_NULLPTR && audioInput->state() != QAudio::StoppedState) {
|
||||
// Stop audio output
|
||||
audioInput->stop();
|
||||
}
|
||||
audioDevice = Q_NULLPTR;
|
||||
}
|
||||
|
||||
|
||||
quint16 audioHandler::getAmplitude()
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue