Move VoiceVatlib into its own thread in ContextAudio

refs #183
This commit is contained in:
Roland Winklmeier
2014-04-13 18:50:10 +02:00
committed by Klaus Basan
parent c04e408844
commit 526149f94d
2 changed files with 10 additions and 1 deletions

View File

@@ -28,7 +28,10 @@ namespace BlackCore
m_keyboard(nullptr) m_keyboard(nullptr)
{ {
// 1. Init by "voice driver" // 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(); m_keyboard = IKeyboard::getInstance();
// 2. Signal / slots // 2. Signal / slots
@@ -42,6 +45,8 @@ namespace BlackCore
CContextAudio::~CContextAudio() CContextAudio::~CContextAudio()
{ {
this->leaveAllVoiceRooms(); this->leaveAllVoiceRooms();
m_threadVoice.quit();
m_threadVoice.wait(1000);
} }
/* /*

View File

@@ -13,6 +13,8 @@
#include "voice_vatlib.h" #include "voice_vatlib.h"
#include "blackcore/keyboard.h" #include "blackcore/keyboard.h"
#include <QThread>
namespace BlackCore namespace BlackCore
{ {
//! \brief Audio context implementation //! \brief Audio context implementation
@@ -114,6 +116,8 @@ namespace BlackCore
CVoiceVatlib *m_voice; //!< underlying voice lib CVoiceVatlib *m_voice; //!< underlying voice lib
IKeyboard *m_keyboard; IKeyboard *m_keyboard;
IKeyboard::RegistrationHandle m_handlePtt; IKeyboard::RegistrationHandle m_handlePtt;
IContextSettings *m_contextSettings;
QThread m_threadVoice;
}; };
} }