mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Tone player "myself" guard
This commit is contained in:
committed by
Mat Sutcliffe
parent
5b3c011a15
commit
5718f95819
@@ -28,12 +28,16 @@ namespace BlackSound
|
||||
|
||||
void CThreadedTonePairPlayer::play(int volume, const QList<CTonePair> &tonePairs)
|
||||
{
|
||||
QPointer<CThreadedTonePairPlayer> myself(this);
|
||||
QMutexLocker ml(&m_mutex);
|
||||
if (m_audioOutput->state() != QAudio::StoppedState) { return; }
|
||||
|
||||
m_bufferData = this->getAudioByTonePairs(tonePairs);
|
||||
m_audioOutput->setVolume(static_cast<qreal>(0.01 * volume));
|
||||
QTimer::singleShot(0, this, &CThreadedTonePairPlayer::playBuffer);
|
||||
QTimer::singleShot(0, this, [ = ]
|
||||
{
|
||||
if (myself) { myself->playBuffer(); }
|
||||
});
|
||||
}
|
||||
|
||||
bool CThreadedTonePairPlayer::reinitializeAudio(const CAudioDeviceInfo &device)
|
||||
|
||||
Reference in New Issue
Block a user