mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Changed voice context so it can play SELCAL tones. This makes sense, as I can
use the device information of this context. Sound shall be played on the same computer as the voice. * Adjusted .pro file * Methods for SELCAL in context * New XML file (DBus) * changed the place where I can obtain the current in/output device
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f9225814f9
commit
6485527062
@@ -56,13 +56,17 @@
|
|||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Voice::CAudioDevice"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Voice::CAudioDevice"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="setVolumes">
|
<method name="setVolumes">
|
||||||
<arg name="com1" type="(s(dd(s))(dd(s))iiib)" direction="in"/>
|
<arg name="com1" type="(s(dd(s))(dd(s))iiibu)" direction="in"/>
|
||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CComSystem"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CComSystem"/>
|
||||||
<arg name="com2" type="(s(dd(s))(dd(s))iiib)" direction="in"/>
|
<arg name="com2" type="(s(dd(s))(dd(s))iiibu)" direction="in"/>
|
||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="BlackMisc::Aviation::CComSystem"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="BlackMisc::Aviation::CComSystem"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="isMuted">
|
<method name="isMuted">
|
||||||
<arg type="b" direction="out"/>
|
<arg type="b" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="playSelcalTone">
|
||||||
|
<arg name="selcal" type="(s)" direction="in"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CSelcal"/>
|
||||||
|
</method>
|
||||||
</interface>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ include (../../externals.pri)
|
|||||||
|
|
||||||
# GUI is required for the matrix classes
|
# GUI is required for the matrix classes
|
||||||
# Network for host info etc.
|
# Network for host info etc.
|
||||||
QT += network dbus xml
|
QT += network dbus xml multimedia
|
||||||
|
|
||||||
TARGET = blackcore
|
TARGET = blackcore
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
@@ -23,6 +23,7 @@ precompile_header:!isEmpty(PRECOMPILED_HEADER) {
|
|||||||
# !! Make sure the plugin is available as release build and known QT_PLUGIN_PATH
|
# !! Make sure the plugin is available as release build and known QT_PLUGIN_PATH
|
||||||
QDBUSXML2CPP_ADAPTOR_HEADER_FLAGS = -i blackmisc/blackmiscfreefunctions.h -i blackmisc/blackmiscallvalueclasses.h
|
QDBUSXML2CPP_ADAPTOR_HEADER_FLAGS = -i blackmisc/blackmiscfreefunctions.h -i blackmisc/blackmiscallvalueclasses.h
|
||||||
DBUS_ADAPTORS += blackcore.contextnetwork.xml
|
DBUS_ADAPTORS += blackcore.contextnetwork.xml
|
||||||
|
DBUS_ADAPTORS += blackcore.contextvoice.xml
|
||||||
DBUS_ADAPTORS += blackcore.contextsettings.xml
|
DBUS_ADAPTORS += blackcore.contextsettings.xml
|
||||||
DBUS_ADAPTORS += blackcore.contextapplication.xml
|
DBUS_ADAPTORS += blackcore.contextapplication.xml
|
||||||
|
|
||||||
@@ -34,8 +35,8 @@ DEFINES += LOG_IN_FILE
|
|||||||
HEADERS += *.h
|
HEADERS += *.h
|
||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
|
|
||||||
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib
|
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib ../../lib/blacksound.lib
|
||||||
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a
|
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a ../../libblacksound.a
|
||||||
|
|
||||||
DESTDIR = ../../lib
|
DESTDIR = ../../lib
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "context_voice.h"
|
#include "context_voice.h"
|
||||||
#include "context_network.h"
|
#include "context_network.h"
|
||||||
#include "coreruntime.h"
|
#include "coreruntime.h"
|
||||||
|
#include "../blacksound/soundgenerator.h"
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
@@ -18,15 +18,12 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Init this context
|
* Init this context
|
||||||
*/
|
*/
|
||||||
CContextVoice::CContextVoice(CCoreRuntime *runtime) :
|
CContextVoice::CContextVoice(CCoreRuntime *runtime) : IContextVoice(runtime), m_voice(nullptr)
|
||||||
IContextVoice(runtime), m_voice(nullptr), m_currentInputDevice(), m_currentOutputDevice()
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(runtime);
|
Q_ASSERT(runtime);
|
||||||
|
|
||||||
// 1. Init by "network driver"
|
// 1. Init by "network driver"
|
||||||
this->m_voice = new CVoiceVatlib(this);
|
this->m_voice = new CVoiceVatlib(this);
|
||||||
this->m_currentInputDevice = this->m_voice->defaultAudioInputDevice();
|
|
||||||
this->m_currentOutputDevice = this->m_voice->defaultAudioOutputDevice();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -104,8 +101,8 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
CAudioDeviceList devices;
|
CAudioDeviceList devices;
|
||||||
devices.push_back(this->m_currentInputDevice);
|
devices.push_back(this->m_voice->getCurrentInputDevice());
|
||||||
devices.push_back(this->m_currentOutputDevice);
|
devices.push_back(this->m_voice->getCurrentOutputDevice());
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,12 +116,10 @@ namespace BlackCore
|
|||||||
if (audioDevice.getType() == CAudioDevice::InputDevice)
|
if (audioDevice.getType() == CAudioDevice::InputDevice)
|
||||||
{
|
{
|
||||||
this->m_voice->setInputDevice(audioDevice);
|
this->m_voice->setInputDevice(audioDevice);
|
||||||
this->m_currentInputDevice = audioDevice;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_voice->setOutputDevice(audioDevice);
|
this->m_voice->setOutputDevice(audioDevice);
|
||||||
this->m_currentOutputDevice = audioDevice;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +196,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Room 1 users
|
* Room 2 users
|
||||||
*/
|
*/
|
||||||
Network::CUserList CContextVoice::getCom2RoomUsers() const
|
Network::CUserList CContextVoice::getCom2RoomUsers() const
|
||||||
{
|
{
|
||||||
@@ -212,4 +207,13 @@ namespace BlackCore
|
|||||||
getUsersForCallsigns(this->getCom2RoomCallsigns());
|
getUsersForCallsigns(this->getCom2RoomCallsigns());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SELCAL tone
|
||||||
|
*/
|
||||||
|
void CContextVoice::playSelcalTone(const CSelcal &selcal) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(this->m_voice);
|
||||||
|
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
|
||||||
|
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -146,10 +146,14 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual bool isMuted() const;
|
virtual bool isMuted() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Play selcal tone
|
||||||
|
* \param selcal
|
||||||
|
*/
|
||||||
|
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CVoiceVatlib *m_voice; //!< underlying voice lib
|
CVoiceVatlib *m_voice; //!< underlying voice lib
|
||||||
BlackMisc::Voice::CAudioDevice m_currentInputDevice; //!< input device
|
|
||||||
BlackMisc::Voice::CAudioDevice m_currentOutputDevice; //!< current output device
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc::Voice;
|
using namespace BlackMisc::Voice;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -86,6 +87,14 @@ namespace BlackCore
|
|||||||
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getCurrentAudioDevices"));
|
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getCurrentAudioDevices"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set current audio device
|
||||||
|
*/
|
||||||
|
void IContextVoice::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
||||||
|
{
|
||||||
|
this->m_dBusInterface->callDBus(QLatin1Literal("setCurrentAudioDevice"), audioDevice);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Voice rooms, with audio status
|
* Voice rooms, with audio status
|
||||||
*/
|
*/
|
||||||
@@ -127,11 +136,11 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set current audio device
|
* Play SELCAL tone
|
||||||
*/
|
*/
|
||||||
void IContextVoice::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
void IContextVoice::playSelcalTone(const CSelcal &selcal) const
|
||||||
{
|
{
|
||||||
this->m_dBusInterface->callDBus(QLatin1Literal("setCurrentAudioDevice"), audioDevice);
|
this->m_dBusInterface->callDBus(QLatin1Literal("playSelcalTone"), selcal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -187,6 +187,10 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual bool isMuted() const;
|
virtual bool isMuted() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Play SELCAL tone
|
||||||
|
*/
|
||||||
|
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "../blackmisc/context.h"
|
#include "../blackmisc/context.h"
|
||||||
#include "../blackmisc/avcallsignlist.h"
|
#include "../blackmisc/avcallsignlist.h"
|
||||||
|
#include "../blackmisc/avselcal.h"
|
||||||
#include "../blackmisc/nwuserlist.h"
|
#include "../blackmisc/nwuserlist.h"
|
||||||
#include "../blackmisc/vvoiceroomlist.h"
|
#include "../blackmisc/vvoiceroomlist.h"
|
||||||
#include "../blackmisc/vaudiodevicelist.h"
|
#include "../blackmisc/vaudiodevicelist.h"
|
||||||
@@ -117,15 +118,25 @@ namespace BlackCore
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Input device to be used
|
* \brief Current input device
|
||||||
*/
|
*/
|
||||||
virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
virtual BlackMisc::Voice::CAudioDevice getCurrentInputDevice() const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Current output device
|
||||||
|
*/
|
||||||
|
virtual BlackMisc::Voice::CAudioDevice getCurrentOutputDevice() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Output device to be used
|
* \brief Output device to be used
|
||||||
*/
|
*/
|
||||||
virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Input device to be used
|
||||||
|
*/
|
||||||
|
virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get COM1/2 voice rooms, which then allows to retrieve information
|
* Get COM1/2 voice rooms, which then allows to retrieve information
|
||||||
* such as audio status etc.
|
* such as audio status etc.
|
||||||
@@ -177,6 +188,18 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const = 0;
|
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Is muted?
|
||||||
|
*/
|
||||||
|
virtual bool isMuted() const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Switch audio output, enable or disable given COM unit.
|
||||||
|
* \param comUnit
|
||||||
|
* \param enable enable or disable output
|
||||||
|
*/
|
||||||
|
virtual void switchAudioOutput(const ComUnit comUnit, bool enable) = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Signals regarding the voice server connection
|
// Signals regarding the voice server connection
|
||||||
void notConnected(const ComUnit comUnit);
|
void notConnected(const ComUnit comUnit);
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ namespace BlackCore
|
|||||||
this->m_voiceRooms.push_back(CVoiceRoom()); // COM2
|
this->m_voiceRooms.push_back(CVoiceRoom()); // COM2
|
||||||
this->m_outputEnabled.insert(COM1, true);
|
this->m_outputEnabled.insert(COM1, true);
|
||||||
this->m_outputEnabled.insert(COM2, true);
|
this->m_outputEnabled.insert(COM2, true);
|
||||||
|
this->m_currentInputDevice = this->defaultAudioInputDevice();
|
||||||
|
this->m_currentOutputDevice = this->defaultAudioOutputDevice();
|
||||||
|
|
||||||
// do processing
|
// do processing
|
||||||
this->startTimer(100);
|
this->startTimer(100);
|
||||||
@@ -87,6 +89,22 @@ namespace BlackCore
|
|||||||
return BlackMisc::Voice::CAudioDevice(BlackMisc::Voice::CAudioDevice::OutputDevice, BlackMisc::Voice::CAudioDevice::defaultDevice(), "default");
|
return BlackMisc::Voice::CAudioDevice(BlackMisc::Voice::CAudioDevice::OutputDevice, BlackMisc::Voice::CAudioDevice::defaultDevice(), "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Current output device
|
||||||
|
*/
|
||||||
|
CAudioDevice CVoiceVatlib::getCurrentOutputDevice() const
|
||||||
|
{
|
||||||
|
return m_currentOutputDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Current input device
|
||||||
|
*/
|
||||||
|
CAudioDevice CVoiceVatlib::getCurrentInputDevice() const
|
||||||
|
{
|
||||||
|
return m_currentInputDevice;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set input device
|
* Set input device
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +127,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
qWarning() << "Input device hit a fatal error";
|
qWarning() << "Input device hit a fatal error";
|
||||||
}
|
}
|
||||||
|
this->m_currentInputDevice = device;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@@ -135,6 +154,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
qWarning() << "Input device hit a fatal error";
|
qWarning() << "Input device hit a fatal error";
|
||||||
}
|
}
|
||||||
|
this->m_currentOutputDevice = device;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ namespace BlackCore
|
|||||||
virtual const BlackMisc::Voice::CAudioDeviceList &audioDevices() const ;
|
virtual const BlackMisc::Voice::CAudioDeviceList &audioDevices() const ;
|
||||||
virtual const BlackMisc::Voice::CAudioDevice defaultAudioInputDevice() const;
|
virtual const BlackMisc::Voice::CAudioDevice defaultAudioInputDevice() const;
|
||||||
virtual const BlackMisc::Voice::CAudioDevice defaultAudioOutputDevice() const;
|
virtual const BlackMisc::Voice::CAudioDevice defaultAudioOutputDevice() const;
|
||||||
virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device);
|
|
||||||
virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device);
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* SETUP TESTS
|
* SETUP TESTS
|
||||||
@@ -121,9 +119,27 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const;
|
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Switch audio output, enable or disable given COM unit.
|
* \copydoc IVoice::setInputDevice
|
||||||
* \param comUnit
|
*/
|
||||||
* \param enable enable or disable output
|
virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \copydoc IVoice::setOutputDevice
|
||||||
|
*/
|
||||||
|
virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Current input device
|
||||||
|
*/
|
||||||
|
virtual BlackMisc::Voice::CAudioDevice getCurrentInputDevice() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Current output device
|
||||||
|
*/
|
||||||
|
virtual BlackMisc::Voice::CAudioDevice getCurrentOutputDevice() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \copydoc IVoice::switchAudioOutput
|
||||||
*/
|
*/
|
||||||
virtual void switchAudioOutput(const ComUnit comUnit, bool enable);
|
virtual void switchAudioOutput(const ComUnit comUnit, bool enable);
|
||||||
|
|
||||||
@@ -281,6 +297,8 @@ namespace BlackCore
|
|||||||
BlackMisc::Aviation::CCallsign m_aircraftCallsign; /*!< own callsign to join voice rooms */
|
BlackMisc::Aviation::CCallsign m_aircraftCallsign; /*!< own callsign to join voice rooms */
|
||||||
BlackMisc::Voice::CVoiceRoomList m_voiceRooms;
|
BlackMisc::Voice::CVoiceRoomList m_voiceRooms;
|
||||||
BlackMisc::Voice::CAudioDeviceList m_devices; /*!< in and output devices */
|
BlackMisc::Voice::CAudioDeviceList m_devices; /*!< in and output devices */
|
||||||
|
BlackMisc::Voice::CAudioDevice m_currentOutputDevice;
|
||||||
|
BlackMisc::Voice::CAudioDevice m_currentInputDevice;
|
||||||
QScopedPointer<CKeyboard> m_keyboardPtt; /*!< handler for PTT */
|
QScopedPointer<CKeyboard> m_keyboardPtt; /*!< handler for PTT */
|
||||||
bool m_pushToTalk; /*!< flag, PTT pressed */
|
bool m_pushToTalk; /*!< flag, PTT pressed */
|
||||||
float m_inputSquelch;
|
float m_inputSquelch;
|
||||||
|
|||||||
Reference in New Issue
Block a user