mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix audio timers started from wrong thread
This timer never actually worked
This commit is contained in:
parent
a0645d5cba
commit
2b8200aa30
|
@ -65,11 +65,7 @@ Audio::Audio()
|
||||||
, inputVolume(1.0)
|
, inputVolume(1.0)
|
||||||
, alMainSource(0)
|
, alMainSource(0)
|
||||||
, alContext(nullptr)
|
, alContext(nullptr)
|
||||||
, timer(new QTimer(this))
|
|
||||||
{
|
{
|
||||||
timer->setSingleShot(true);
|
|
||||||
connect(timer, &QTimer::timeout, this, &Audio::closeOutput);
|
|
||||||
|
|
||||||
audioThread->setObjectName("qTox Audio");
|
audioThread->setObjectName("qTox Audio");
|
||||||
connect(audioThread, &QThread::finished, audioThread, &QThread::deleteLater);
|
connect(audioThread, &QThread::finished, audioThread, &QThread::deleteLater);
|
||||||
}
|
}
|
||||||
|
@ -403,11 +399,6 @@ void Audio::playMono16Sound(const QByteArray& data)
|
||||||
|
|
||||||
ALint frequency;
|
ALint frequency;
|
||||||
alGetBufferi(buffer, AL_FREQUENCY, &frequency);
|
alGetBufferi(buffer, AL_FREQUENCY, &frequency);
|
||||||
qreal duration = (lengthInSamples / static_cast<qreal>(frequency)) * 1000;
|
|
||||||
int remaining = timer->interval();
|
|
||||||
|
|
||||||
if (duration > remaining)
|
|
||||||
timer->start(duration);
|
|
||||||
|
|
||||||
alDeleteBuffers(1, &buffer);
|
alDeleteBuffers(1, &buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user