From dab907df8ccc21b7c2dff8f3812a99afb1388153 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 26 Mar 2020 19:01:51 +0100 Subject: [PATCH] Graceful shutdown of SELCAL player with audio context --- src/blackcore/context/contextaudio.cpp | 1 + src/blacksound/selcalplayer.cpp | 5 +++++ src/blacksound/selcalplayer.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index 82711772d..cff31e5df 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -231,6 +231,7 @@ namespace BlackCore void CContextAudioBase::gracefulShutdown() { this->terminateVoiceClient(); + m_selcalPlayer->gracefulShutdown(); QObject::disconnect(this); } diff --git a/src/blacksound/selcalplayer.cpp b/src/blacksound/selcalplayer.cpp index f5febd199..9482b71f5 100644 --- a/src/blacksound/selcalplayer.cpp +++ b/src/blacksound/selcalplayer.cpp @@ -24,6 +24,11 @@ namespace BlackSound } CSelcalPlayer::~CSelcalPlayer() + { + this->gracefulShutdown(); + } + + void CSelcalPlayer::gracefulShutdown() { m_threadedPlayer.quitAndWait(); } diff --git a/src/blacksound/selcalplayer.h b/src/blacksound/selcalplayer.h index 4715c2394..7888134cf 100644 --- a/src/blacksound/selcalplayer.h +++ b/src/blacksound/selcalplayer.h @@ -32,6 +32,9 @@ namespace BlackSound //! Destructor virtual ~CSelcalPlayer() override; + //! Stop the player thread + void gracefulShutdown(); + //! Play SELCAL //! \return Time of the played tone BlackMisc::PhysicalQuantities::CTime play(int volume, const BlackMisc::Aviation::CSelcal &selcal);