[AFV] Ref T731, Ref T739 register devices so we can also obtain remote devices

This commit is contained in:
Klaus Basan
2019-10-30 23:00:01 +01:00
committed by Mat Sutcliffe
parent 80725e96dc
commit 87f078a698
4 changed files with 22 additions and 3 deletions

View File

@@ -46,6 +46,11 @@ namespace BlackCore
// void
}
void IContextAudio::onChangedLocalDevices(const CAudioDeviceInfoList &devices)
{
this->registerDevices(devices);
}
const QString &IContextAudio::InterfaceName()
{
static const QString s(BLACKCORE_CONTEXTAUDIO_INTERFACENAME);
@@ -131,6 +136,7 @@ namespace BlackCore
{
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
myself->onChangedAudioSettings();
myself->onChangedLocalDevices(m_activeLocalDevices);
});
}
@@ -177,6 +183,13 @@ namespace BlackCore
connect(m_voiceClient, &CAfvClient::startedAudio, this, &CContextAudioBase::startedAudio, Qt::QueuedConnection);
connect(m_voiceClient, &CAfvClient::stoppedAudio, this, &CContextAudioBase::stoppedAudio, Qt::QueuedConnection);
connect(m_voiceClient, &CAfvClient::ptt, this, &CContextAudioBase::ptt, Qt::QueuedConnection);
const CAudioDeviceInfoList devices = CAudioDeviceInfoList::allDevices();
if (devices != m_activeLocalDevices)
{
m_activeLocalDevices = devices;
emit this->changedLocalAudioDevices(devices);
}
}
void CContextAudioBase::terminateVoiceClient()

View File

@@ -105,6 +105,9 @@ namespace BlackCore
protected:
//! Constructor
IContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime);
//! Devices have been changed
void onChangedLocalDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
};
//! Audio context interface
@@ -240,7 +243,7 @@ namespace BlackCore
void changedMute(bool muted);
//! Changed audio devices (e.g. device enabled/disable)
void changedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
void changedLocalAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
//! Audio started with devices
void startedAudio(const BlackMisc::Audio::CAudioDeviceInfo &input, const BlackMisc::Audio::CAudioDeviceInfo &output);
@@ -320,6 +323,7 @@ namespace BlackCore
// AFV
Afv::Clients::CAfvClient *m_voiceClient = nullptr;
bool m_winCoInitialized = false;
BlackMisc::Audio::CAudioDeviceInfoList m_activeLocalDevices;
// Players
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;

View File

@@ -25,7 +25,7 @@ namespace BlackCore
CContextAudio::CContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
CContextAudioBase(mode, runtime)
{
// void
connect(this, &CContextAudio::changedLocalAudioDevices, this, &CContextAudio::onChangedLocalDevices, Qt::QueuedConnection);
}
CContextAudio *CContextAudio::registerWithDBus(CDBusServer *server)

View File

@@ -32,6 +32,8 @@ namespace BlackCore
{
m_dBusInterface = new CGenericDBusInterface(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(), connection, this);
this->relaySignals(serviceName, connection);
connect(this, &CContextAudioProxy::changedLocalAudioDevices, this, &CContextAudioProxy::onChangedLocalDevices, Qt::QueuedConnection);
}
void CContextAudioProxy::unitTestRelaySignals()
@@ -74,7 +76,7 @@ namespace BlackCore
"changedMute", this, SIGNAL(changedMute(bool)));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
"changedAudioDevices", this, SIGNAL(changedAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
"changedLocalAudioDevices", this, SIGNAL(changedLocalAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
**/
this->relayBaseClassSignals(serviceName, connection, IContextAudio::ObjectPath(), IContextAudio::InterfaceName());