mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
refs #258, notification sound for voice rooms in context
This commit is contained in:
@@ -127,8 +127,9 @@ namespace BlackCore
|
|||||||
/*!
|
/*!
|
||||||
* \brief Play notification sound
|
* \brief Play notification sound
|
||||||
* \param notification CSoundGenerator::Notification
|
* \param notification CSoundGenerator::Notification
|
||||||
|
* \param considerSettings consider settings (notification on/off), false means settings ignored
|
||||||
*/
|
*/
|
||||||
virtual void playNotification(uint notification) const = 0;
|
virtual void playNotification(uint notification, bool considerSettings) const = 0;
|
||||||
|
|
||||||
//! Microphone test
|
//! Microphone test
|
||||||
virtual void runMicrophoneTest() = 0;
|
virtual void runMicrophoneTest() = 0;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using namespace BlackMisc;
|
|||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Audio;
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackMisc::Hardware;
|
using namespace BlackMisc::Hardware;
|
||||||
|
using namespace BlackSound;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -26,9 +27,7 @@ namespace BlackCore
|
|||||||
* Init this context
|
* Init this context
|
||||||
*/
|
*/
|
||||||
CContextAudio::CContextAudio(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
|
CContextAudio::CContextAudio(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
|
||||||
IContextAudio(mode, runtime),
|
IContextAudio(mode, runtime), m_voice(nullptr), m_keyboard(nullptr)
|
||||||
m_voice(nullptr),
|
|
||||||
m_keyboard(nullptr)
|
|
||||||
{
|
{
|
||||||
// 1. Init by "voice driver"
|
// 1. Init by "voice driver"
|
||||||
this->m_voice = new CVoiceVatlib();
|
this->m_voice = new CVoiceVatlib();
|
||||||
@@ -46,6 +45,9 @@ namespace BlackCore
|
|||||||
connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextAudio::audioTestCompleted);
|
connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextAudio::audioTestCompleted);
|
||||||
connect(this->m_voice, &CVoiceVatlib::connectionStatusChanged, this, &CContextAudio::connectionStatusChanged);
|
connect(this->m_voice, &CVoiceVatlib::connectionStatusChanged, this, &CContextAudio::connectionStatusChanged);
|
||||||
if (this->getIContextApplication()) this->connect(this->m_voice, &IVoice::statusMessage, this->getIContextApplication(), &IContextApplication::sendStatusMessage);
|
if (this->getIContextApplication()) this->connect(this->m_voice, &IVoice::statusMessage, this->getIContextApplication(), &IContextApplication::sendStatusMessage);
|
||||||
|
|
||||||
|
// 5. load sounds (init)
|
||||||
|
CSoundGenerator::playNotificationSound(0, CNotificationSounds::NotificationsLoadSounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -188,6 +190,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
Q_ASSERT(newRooms.size() == 2);
|
Q_ASSERT(newRooms.size() == 2);
|
||||||
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, newRooms.toQString());
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, newRooms.toQString());
|
||||||
|
|
||||||
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRooms();
|
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRooms();
|
||||||
CVoiceRoom currentRoom1 = currentRooms[0];
|
CVoiceRoom currentRoom1 = currentRooms[0];
|
||||||
CVoiceRoom currentRoom2 = currentRooms[1];
|
CVoiceRoom currentRoom2 = currentRooms[1];
|
||||||
@@ -275,11 +278,19 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Notification
|
* Notification
|
||||||
*/
|
*/
|
||||||
void CContextAudio::playNotification(uint notification) const
|
void CContextAudio::playNotification(uint notification, bool considerSettings) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(notification));
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(notification));
|
||||||
BlackSound::CSoundGenerator::playNotificationSound(90, static_cast<BlackSound::CNotificationSounds::Notification>(notification));
|
|
||||||
|
BlackSound::CNotificationSounds::Notification notificationSound = static_cast<BlackSound::CNotificationSounds::Notification>(notification);
|
||||||
|
if (considerSettings)
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->getIContextSettings());
|
||||||
|
bool play = this->getIContextSettings()->getAudioSettings().getNotificationFlag(notificationSound);
|
||||||
|
if (!play) return;
|
||||||
|
}
|
||||||
|
BlackSound::CSoundGenerator::playNotificationSound(90, notificationSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -322,6 +333,9 @@ namespace BlackCore
|
|||||||
return static_cast<double>(this->m_voice->inputSquelch());
|
return static_cast<double>(this->m_voice->inputSquelch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Audio loopback
|
||||||
|
*/
|
||||||
void CContextAudio::enableAudioLoopback(bool enable)
|
void CContextAudio::enableAudioLoopback(bool enable)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "blackcore/keyboard.h"
|
#include "blackcore/keyboard.h"
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QQueue>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,7 @@ namespace BlackCore
|
|||||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::playNotification()
|
//! \copydoc IContextAudio::playNotification()
|
||||||
virtual void playNotification(uint notification) const override;
|
virtual void playNotification(uint notification, bool considerSettings) const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::runMicrophoneTest()
|
//! \copydoc IContextAudio::runMicrophoneTest()
|
||||||
virtual void runMicrophoneTest() override;
|
virtual void runMicrophoneTest() override;
|
||||||
@@ -118,6 +119,9 @@ namespace BlackCore
|
|||||||
void connectionStatusChanged(IVoice::ComUnit comUnit, IVoice::ConnectionStatus oldStatus, IVoice::ConnectionStatus newStatus);
|
void connectionStatusChanged(IVoice::ComUnit comUnit, IVoice::ConnectionStatus oldStatus, IVoice::ConnectionStatus newStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
//! Connection in transition
|
||||||
|
bool inTransitionState() const;
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -153,9 +153,9 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Notification sound
|
* Notification sound
|
||||||
*/
|
*/
|
||||||
void CContextAudioProxy::playNotification(uint notification) const
|
void CContextAudioProxy::playNotification(uint notification, bool considerSettings) const
|
||||||
{
|
{
|
||||||
this->m_dBusInterface->callDBus(QLatin1Literal("playNotification"), notification);
|
this->m_dBusInterface->callDBus(QLatin1Literal("playNotification"), notification, considerSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextAudio::isMuted()
|
//! \copydoc IContextAudio::isMuted()
|
||||||
virtual bool isMuted() const override;
|
virtual bool isMuted() const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::playSelcalTone()
|
//! \copydoc IContextAudio::playSelcalTone
|
||||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::playNotification()
|
//! \copydoc IContextAudio::playNotification
|
||||||
virtual void playNotification(uint notification) const override;
|
virtual void playNotification(uint notification, bool considerSettings) const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::runMicrophoneTest()
|
//! \copydoc IContextAudio::runMicrophoneTest()
|
||||||
virtual void runMicrophoneTest() override;
|
virtual void runMicrophoneTest() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user