mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +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) :
|
||||
IVoice(parent),
|
||||
m_audioService(Vat_CreateAudioService()),
|
||||
m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), m_vatsimVoicePortSetting.getThreadLocal()))
|
||||
m_audioService(Vat_CreateAudioService())
|
||||
{
|
||||
const int udpPort = m_vatsimVoiceSettings.get().getVatsimUdpVoicePort();
|
||||
Vat_SetVoiceLogHandler(SeverityLevel::SeverityError, CVoiceVatlib::voiceLogHandler);
|
||||
m_udpPort.reset(Vat_CreateUDPAudioPort(m_audioService.data(), udpPort));
|
||||
|
||||
// do processing
|
||||
this->startTimer(10);
|
||||
@@ -46,6 +47,19 @@ namespace BlackCore
|
||||
|
||||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
QString errorMessage ("vatlib ");
|
||||
QString errorMessage("vatlib ");
|
||||
errorMessage += context;
|
||||
errorMessage += ": ";
|
||||
errorMessage += message;
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
#ifndef BLACKCORE_VOICE_VATLIB_H
|
||||
#define BLACKCORE_VOICE_VATLIB_H
|
||||
|
||||
#include "blackcore/audio/audiosettings.h"
|
||||
#include "blackcore/audiomixer.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/voice.h"
|
||||
#include "blackmisc/audio/settings/voicesettings.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include <vatlib/vatlib.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
#include <QSharedPointer>
|
||||
@@ -33,7 +34,7 @@ template <class T> class QSharedPointer;
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
namespace BlackCore
|
||||
@@ -57,7 +58,13 @@ namespace BlackCore
|
||||
CVoiceVatlib(QObject *parent = nullptr);
|
||||
|
||||
//! 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()
|
||||
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() override;
|
||||
@@ -117,9 +124,7 @@ namespace BlackCore
|
||||
|
||||
static void voiceLogHandler(SeverityLevel severity, const char *context, const char *message);
|
||||
|
||||
// settings
|
||||
BlackMisc::CSettingReadOnly<BlackCore::Audio::TVatsimVoiceUdpPort> m_vatsimVoicePortSetting { this };
|
||||
|
||||
BlackMisc::CSetting<BlackMisc::Audio::Settings::TVoiceSetup> m_vatsimVoiceSettings { this };
|
||||
QScopedPointer<VatAudioService, VatAudioServiceDeleter> m_audioService;
|
||||
QScopedPointer<VatUDPAudioPort, VatUDPAudioPortDeleter> m_udpPort;
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "blackcore/audiomixer.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
@@ -39,6 +40,12 @@ namespace BlackCore
|
||||
//! Virtual destructor.
|
||||
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
|
||||
virtual QSharedPointer<IVoiceChannel> createVoiceChannel() = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user