mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
refs #381, adjust GUI for new voice vatlib
* Only 1 volume * No tests (squelch ...) * loopback * required backed functions in context
This commit is contained in:
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||
|
||||
//! Factory method
|
||||
static IContextAudio *create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn);
|
||||
static IContextAudio *create(CRuntime *runtime, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn);
|
||||
|
||||
//! \brief Destructor
|
||||
virtual ~IContextAudio() {}
|
||||
@@ -137,6 +137,9 @@ namespace BlackCore
|
||||
//! Set voice output volume (0..300)
|
||||
virtual void setVoiceOutputVolume(int volume) = 0;
|
||||
|
||||
//! Voice output volume (0..300)
|
||||
virtual int getVoiceOutputVolume() const = 0;
|
||||
|
||||
//! Set mute state
|
||||
virtual void setMute(bool mute) = 0;
|
||||
|
||||
@@ -156,6 +159,9 @@ namespace BlackCore
|
||||
//! Enable audio loopback
|
||||
virtual void enableAudioLoopback(bool enable = true) = 0;
|
||||
|
||||
//! Is loobback enabled?
|
||||
virtual bool isAudioLoopbackEnabled() const = 0;
|
||||
|
||||
//! Command line was entered
|
||||
virtual bool parseCommandLine(const QString &commandLine) = 0;
|
||||
};
|
||||
|
||||
@@ -211,11 +211,18 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::setVoiceOutputVolume(int volume)
|
||||
{
|
||||
Q_ASSERT(m_voiceOutputDevice);
|
||||
m_outDeviceVolume = volume;
|
||||
if (!isMuted()) m_voiceOutputDevice->setOutputVolume(m_outDeviceVolume);
|
||||
if (!isMuted()) { m_voiceOutputDevice->setOutputVolume(m_outDeviceVolume); }
|
||||
emit changedAudioVolume(volume);
|
||||
}
|
||||
|
||||
int CContextAudio::getVoiceOutputVolume() const
|
||||
{
|
||||
Q_ASSERT(m_voiceOutputDevice);
|
||||
return m_voiceOutputDevice->getOutputVolume();
|
||||
}
|
||||
|
||||
void CContextAudio::setMute(bool muted)
|
||||
{
|
||||
if (this->isMuted() == muted) { return; } // avoid roundtrips / unnecessary signals
|
||||
@@ -407,12 +414,23 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextAudio::enableAudioLoopback(bool enable)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (enable)
|
||||
{
|
||||
m_audioMixer->makeMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_audioMixer->removeMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
}
|
||||
|
||||
bool CContextAudio::isAudioLoopbackEnabled() const
|
||||
{
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
return this->m_audioMixer->hasMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
|
||||
bool CContextAudio::parseCommandLine(const QString &commandLine)
|
||||
@@ -439,10 +457,11 @@ namespace BlackCore
|
||||
}
|
||||
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
||||
{
|
||||
qint32 v = parser.toInt(1);
|
||||
int v = parser.toInt(1);
|
||||
if (v >= 0 && v <= 300)
|
||||
{
|
||||
setVoiceOutputVolume(v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -473,7 +492,7 @@ namespace BlackCore
|
||||
break;
|
||||
case IVoiceChannel::ConnectingFailed:
|
||||
case IVoiceChannel::DisconnectedError:
|
||||
qWarning() << "Voice room COM1 error";
|
||||
CLogMessage(this).warning("Voice channel disconnecting error");
|
||||
// intentional fall-through
|
||||
case IVoiceChannel::Disconnected:
|
||||
if (this->getIContextOwnAircraft())
|
||||
|
||||
@@ -78,9 +78,12 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||
|
||||
//!\copydoc IContext::setVoiceOutputVolume
|
||||
//! \copydoc IContext::setVoiceOutputVolume
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
|
||||
//! \copydoc IContext::getVoiceOutputVolume
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
|
||||
//! \copydoc ICOntext::setMute
|
||||
virtual void setMute(bool muted) override;
|
||||
|
||||
@@ -96,14 +99,15 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::enableAudioLoopback()
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
|
||||
//! \copydoc ICOntextAudio::isAudioLoopbackEnabled
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
|
||||
//! \addtogroup commandline
|
||||
//! @{
|
||||
//! <pre>
|
||||
//! .mute mute CContextAudio
|
||||
//! .unmute unmute CContextAudio
|
||||
//! .vol .volume volume 0..100 set volume CContextAudio
|
||||
//! .vol1 .volume1 volume 0..100 set volume COM1 CContextAudio
|
||||
//! .vol2 .volume2 volume 0..100 set volume COM2 CContextAudio
|
||||
//! .vol .volume volume 0..300 set volume CContextAudio
|
||||
//! </pre>
|
||||
//! @}
|
||||
//! \copydoc IContextAudio::parseCommandLine
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackCore
|
||||
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
bool s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedVoiceRooms", this, SIGNAL(changedVoiceRooms(BlackMisc::Audio::CVoiceRoomList, bool)));
|
||||
"changedVoiceRooms", this, SIGNAL(changedVoiceRooms(BlackMisc::Audio::CVoiceRoomList, bool)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedAudioVolume", this, SIGNAL(changedAudioVolume(int)));
|
||||
@@ -151,6 +151,11 @@ namespace BlackCore
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setVoiceOutputVolume"), volume);
|
||||
}
|
||||
|
||||
int CContextAudioProxy::getVoiceOutputVolume() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<int>(QLatin1Literal("getVoiceOutputVolume"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle mute
|
||||
*/
|
||||
@@ -172,7 +177,15 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextAudioProxy::enableAudioLoopback(bool enable)
|
||||
{
|
||||
return this->m_dBusInterface->callDBus(QLatin1Literal("enableAudioLoopback"), enable);
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("enableAudioLoopback"), enable);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loopback
|
||||
*/
|
||||
bool CContextAudioProxy::isAudioLoopbackEnabled() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isAudioLoopbackEnabled"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace BlackCore
|
||||
//!\copydoc IContext::setVoiceOutputVolume
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
|
||||
//! \copydoc IContext::getVoiceOutputVolume
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
|
||||
//! \copydoc IContextAudio::setMute
|
||||
virtual void setMute(bool muted) override;
|
||||
|
||||
@@ -99,6 +102,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::enableAudioLoopback()
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
|
||||
//! \copydoc IContextAudio::isAudioLoopbackEnabled()
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user