From 526149f94df6aa09980e145034bdf866c235be27 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sun, 13 Apr 2014 18:50:10 +0200 Subject: [PATCH] Move VoiceVatlib into its own thread in ContextAudio refs #183 --- src/blackcore/context_audio_impl.cpp | 7 ++++++- src/blackcore/context_audio_impl.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/blackcore/context_audio_impl.cpp b/src/blackcore/context_audio_impl.cpp index 9a4da578b..d1011ee4b 100644 --- a/src/blackcore/context_audio_impl.cpp +++ b/src/blackcore/context_audio_impl.cpp @@ -28,7 +28,10 @@ namespace BlackCore m_keyboard(nullptr) { // 1. Init by "voice driver" - this->m_voice = new CVoiceVatlib(this); + this->m_voice = new CVoiceVatlib(); + m_voice->moveToThread(&m_threadVoice); + m_threadVoice.start(); + m_keyboard = IKeyboard::getInstance(); // 2. Signal / slots @@ -42,6 +45,8 @@ namespace BlackCore CContextAudio::~CContextAudio() { this->leaveAllVoiceRooms(); + m_threadVoice.quit(); + m_threadVoice.wait(1000); } /* diff --git a/src/blackcore/context_audio_impl.h b/src/blackcore/context_audio_impl.h index d01141794..4b712bba6 100644 --- a/src/blackcore/context_audio_impl.h +++ b/src/blackcore/context_audio_impl.h @@ -13,6 +13,8 @@ #include "voice_vatlib.h" #include "blackcore/keyboard.h" +#include + namespace BlackCore { //! \brief Audio context implementation @@ -114,6 +116,8 @@ namespace BlackCore CVoiceVatlib *m_voice; //!< underlying voice lib IKeyboard *m_keyboard; IKeyboard::RegistrationHandle m_handlePtt; + IContextSettings *m_contextSettings; + QThread m_threadVoice; }; }