mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T376, voice (vatlib) getter/setter for CVoiceSetup
This commit is contained in:
@@ -35,10 +35,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
CVoiceVatlib::CVoiceVatlib(QObject *parent) :
|
CVoiceVatlib::CVoiceVatlib(QObject *parent) :
|
||||||
IVoice(parent),
|
IVoice(parent),
|
||||||
m_audioService(Vat_CreateAudioService()),
|
m_audioService(Vat_CreateAudioService())
|
||||||
m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), m_vatsimVoicePortSetting.getThreadLocal()))
|
|
||||||
{
|
{
|
||||||
|
const int udpPort = m_vatsimVoiceSettings.get().getVatsimUdpVoicePort();
|
||||||
Vat_SetVoiceLogHandler(SeverityLevel::SeverityError, CVoiceVatlib::voiceLogHandler);
|
Vat_SetVoiceLogHandler(SeverityLevel::SeverityError, CVoiceVatlib::voiceLogHandler);
|
||||||
|
m_udpPort.reset(Vat_CreateUDPAudioPort(m_audioService.data(), udpPort));
|
||||||
|
|
||||||
// do processing
|
// do processing
|
||||||
this->startTimer(10);
|
this->startTimer(10);
|
||||||
@@ -46,6 +47,19 @@ namespace BlackCore
|
|||||||
|
|
||||||
CVoiceVatlib::~CVoiceVatlib() {}
|
CVoiceVatlib::~CVoiceVatlib() {}
|
||||||
|
|
||||||
|
void CVoiceVatlib::setVoiceSetup(const CVoiceSetup &setup)
|
||||||
|
{
|
||||||
|
if (m_vatsimVoiceSettings.get() == setup) { return; }
|
||||||
|
m_vatsimVoiceSettings.setAndSave(setup);
|
||||||
|
|
||||||
|
// CHANGE VOICE PORT WOULD NEED TO GO HERE
|
||||||
|
}
|
||||||
|
|
||||||
|
CVoiceSetup CVoiceVatlib::getVoiceSetup() const
|
||||||
|
{
|
||||||
|
return m_vatsimVoiceSettings.get();
|
||||||
|
}
|
||||||
|
|
||||||
QSharedPointer<IVoiceChannel> CVoiceVatlib::createVoiceChannel()
|
QSharedPointer<IVoiceChannel> CVoiceVatlib::createVoiceChannel()
|
||||||
{
|
{
|
||||||
return QSharedPointer<IVoiceChannel>(new CVoiceChannelVatlib(m_audioService.data(), m_udpPort.data(), this));
|
return QSharedPointer<IVoiceChannel>(new CVoiceChannelVatlib(m_audioService.data(), m_udpPort.data(), this));
|
||||||
@@ -143,7 +157,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CVoiceVatlib::voiceLogHandler(SeverityLevel /** severity **/, const char *context, const char *message)
|
void CVoiceVatlib::voiceLogHandler(SeverityLevel /** severity **/, const char *context, const char *message)
|
||||||
{
|
{
|
||||||
QString errorMessage ("vatlib ");
|
QString errorMessage("vatlib ");
|
||||||
errorMessage += context;
|
errorMessage += context;
|
||||||
errorMessage += ": ";
|
errorMessage += ": ";
|
||||||
errorMessage += message;
|
errorMessage += message;
|
||||||
|
|||||||
@@ -12,12 +12,13 @@
|
|||||||
#ifndef BLACKCORE_VOICE_VATLIB_H
|
#ifndef BLACKCORE_VOICE_VATLIB_H
|
||||||
#define BLACKCORE_VOICE_VATLIB_H
|
#define BLACKCORE_VOICE_VATLIB_H
|
||||||
|
|
||||||
#include "blackcore/audio/audiosettings.h"
|
|
||||||
#include "blackcore/audiomixer.h"
|
#include "blackcore/audiomixer.h"
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
#include "blackcore/voice.h"
|
#include "blackcore/voice.h"
|
||||||
|
#include "blackmisc/audio/settings/voicesettings.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include <vatlib/vatlib.h>
|
#include <vatlib/vatlib.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
@@ -33,7 +34,7 @@ template <class T> class QSharedPointer;
|
|||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -57,7 +58,13 @@ namespace BlackCore
|
|||||||
CVoiceVatlib(QObject *parent = nullptr);
|
CVoiceVatlib(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CVoiceVatlib();
|
virtual ~CVoiceVatlib() override;
|
||||||
|
|
||||||
|
//! \copydoc IVoice::setVoiceSetup()
|
||||||
|
virtual void setVoiceSetup(const BlackMisc::Audio::CVoiceSetup &setup) override;
|
||||||
|
|
||||||
|
//! \copydoc IVoice::getVoiceSetup()
|
||||||
|
virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::createVoiceChannel()
|
//! \copydoc IVoice::createVoiceChannel()
|
||||||
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() override;
|
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() override;
|
||||||
@@ -117,9 +124,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
static void voiceLogHandler(SeverityLevel severity, const char *context, const char *message);
|
static void voiceLogHandler(SeverityLevel severity, const char *context, const char *message);
|
||||||
|
|
||||||
// settings
|
BlackMisc::CSetting<BlackMisc::Audio::Settings::TVoiceSetup> m_vatsimVoiceSettings { this };
|
||||||
BlackMisc::CSettingReadOnly<BlackCore::Audio::TVatsimVoiceUdpPort> m_vatsimVoicePortSetting { this };
|
|
||||||
|
|
||||||
QScopedPointer<VatAudioService, VatAudioServiceDeleter> m_audioService;
|
QScopedPointer<VatAudioService, VatAudioServiceDeleter> m_audioService;
|
||||||
QScopedPointer<VatUDPAudioPort, VatUDPAudioPortDeleter> m_udpPort;
|
QScopedPointer<VatUDPAudioPort, VatUDPAudioPortDeleter> m_udpPort;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "blackcore/audiomixer.h"
|
#include "blackcore/audiomixer.h"
|
||||||
#include "blackcore/blackcoreexport.h"
|
#include "blackcore/blackcoreexport.h"
|
||||||
|
#include "blackmisc/audio/voicesetup.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
@@ -39,6 +40,12 @@ namespace BlackCore
|
|||||||
//! Virtual destructor.
|
//! Virtual destructor.
|
||||||
virtual ~IVoice() {}
|
virtual ~IVoice() {}
|
||||||
|
|
||||||
|
//! Set voice setup
|
||||||
|
virtual void setVoiceSetup(const BlackMisc::Audio::CVoiceSetup &setup) = 0;
|
||||||
|
|
||||||
|
//! Get voice setup
|
||||||
|
virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const = 0;
|
||||||
|
|
||||||
//! Create voice channel object
|
//! Create voice channel object
|
||||||
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() = 0;
|
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user