refs #320 Prepare Voice to new vatlib API

This commit is contained in:
Roland Winklmeier
2014-12-25 20:43:56 +01:00
parent 111c539e89
commit 13a05f729e
4 changed files with 45 additions and 25 deletions

View File

@@ -8,7 +8,7 @@
#include "blackmisc/logmessage.h"
#include <QDebug>
#include <QTimer>
#include <memory>
#include <mutex>
using namespace BlackMisc;
@@ -21,10 +21,17 @@ namespace BlackCore
* Constructor
*/
CVoiceVatlib::CVoiceVatlib(QObject *parent) :
IVoice(parent)
IVoice(parent),
m_audioService(Vat_CreateAudioService()),
m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), 3782))
{
Vat_SetVoiceErrorHandler(CVoiceVatlib::voiceErrorHandler);
this->m_currentInputDevice = this->defaultAudioInputDevice();
this->m_currentOutputDevice = this->defaultAudioOutputDevice();
// do processing
this->startTimer(10);
}
/*
@@ -125,6 +132,8 @@ namespace BlackCore
*/
void CVoiceVatlib::timerEvent(QTimerEvent *)
{
Q_ASSERT_X(m_audioService, "CVoiceVatlib", "VatAudioService invalid!");
Vat_ExecuteTasks(m_audioService.data());
}
/*
@@ -154,4 +163,9 @@ namespace BlackCore
(*iterator)->updateRoomStatus(roomStatus);
}
void CVoiceVatlib::voiceErrorHandler(const char *message)
{
CLogMessage(static_cast<CVoiceVatlib*>(nullptr)).error(message);
}
} // namespace