mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
refs #320 Rename CAudioDevice to CAudioDeviceInfo
CAudioDevice implied a device handler instead of device information
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "blackcore/voice_vatlib.h"
|
#include "blackcore/voice_vatlib.h"
|
||||||
#include "blackmisc/audiodevicelist.h"
|
#include "blackmisc/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/avcallsignlist.h"
|
#include "blackmisc/avcallsignlist.h"
|
||||||
|
|
||||||
using namespace BlackMisc::Audio;
|
using namespace BlackMisc::Audio;
|
||||||
@@ -142,7 +142,7 @@ void Client::terminateConnectionCmd(QTextStream & /** args **/)
|
|||||||
|
|
||||||
void Client::inputDevicesCmd(QTextStream & /** args **/)
|
void Client::inputDevicesCmd(QTextStream & /** args **/)
|
||||||
{
|
{
|
||||||
foreach(BlackMisc::Audio::CAudioDevice device, this->m_voice->audioDevices().getInputDevices())
|
for(auto &device : m_voice->audioDevices().getInputDevices())
|
||||||
{
|
{
|
||||||
std::cout << device.getName().toStdString() << std::endl;
|
std::cout << device.getName().toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ void Client::inputDevicesCmd(QTextStream & /** args **/)
|
|||||||
*/
|
*/
|
||||||
void Client::outputDevicesCmd(QTextStream & /** args **/)
|
void Client::outputDevicesCmd(QTextStream & /** args **/)
|
||||||
{
|
{
|
||||||
foreach(BlackMisc::Audio::CAudioDevice device, this->m_voice->audioDevices().getOutputDevices())
|
for(auto &device : m_voice->audioDevices().getOutputDevices())
|
||||||
{
|
{
|
||||||
std::cout << device.getName().toStdString() << std::endl;
|
std::cout << device.getName().toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "blackcore/context.h"
|
#include "blackcore/context.h"
|
||||||
#include "blackmisc/genericdbusinterface.h"
|
#include "blackmisc/genericdbusinterface.h"
|
||||||
#include "blackmisc/audiodevicelist.h"
|
#include "blackmisc/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/voiceroomlist.h"
|
#include "blackmisc/voiceroomlist.h"
|
||||||
#include "blackmisc/nwuserlist.h"
|
#include "blackmisc/nwuserlist.h"
|
||||||
#include "blackmisc/avaircraft.h"
|
#include "blackmisc/avaircraft.h"
|
||||||
@@ -89,10 +89,10 @@ namespace BlackCore
|
|||||||
void changedMute(bool muted);
|
void changedMute(bool muted);
|
||||||
|
|
||||||
//! Changed audio devices (e.g. device enabled/disable)
|
//! Changed audio devices (e.g. device enabled/disable)
|
||||||
void changedAudioDevices(const BlackMisc::Audio::CAudioDeviceList &devices);
|
void changedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|
||||||
//! Changed slection of audio devices
|
//! Changed slection of audio devices
|
||||||
void changedSelectedAudioDevices(const BlackMisc::Audio::CAudioDeviceList &devices);
|
void changedSelectedAudioDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Get voice rooms for COM1, COM2:
|
//! Get voice rooms for COM1, COM2:
|
||||||
@@ -134,19 +134,19 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const = 0;
|
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const = 0;
|
||||||
|
|
||||||
//! Audio devices
|
//! Audio devices
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const = 0;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getAudioDevices() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get current audio device
|
* \brief Get current audio device
|
||||||
* \return input and output devices
|
* \return input and output devices
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const = 0;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getCurrentAudioDevices() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set current audio device
|
* \brief Set current audio device
|
||||||
* \param audioDevice can be input or audio device
|
* \param audioDevice can be input or audio device
|
||||||
*/
|
*/
|
||||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) = 0;
|
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set volumes via com units, also allows to mute
|
* \brief Set volumes via com units, also allows to mute
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Audio devices
|
* Audio devices
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList CContextAudio::getAudioDevices() const
|
CAudioDeviceInfoList CContextAudio::getAudioDevices() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||||
@@ -137,11 +137,11 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Audio default devices
|
* Audio default devices
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
|
CAudioDeviceInfoList CContextAudio::getCurrentAudioDevices() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||||
CAudioDeviceList devices;
|
CAudioDeviceInfoList devices;
|
||||||
devices.push_back(this->m_voice->getCurrentInputDevice());
|
devices.push_back(this->m_voice->getCurrentInputDevice());
|
||||||
devices.push_back(this->m_voice->getCurrentOutputDevice());
|
devices.push_back(this->m_voice->getCurrentOutputDevice());
|
||||||
return devices;
|
return devices;
|
||||||
@@ -150,13 +150,13 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Set current device
|
* Set current device
|
||||||
*/
|
*/
|
||||||
void CContextAudio::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
void CContextAudio::setCurrentAudioDevice(const CAudioDeviceInfo &audioDevice)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
|
Q_ASSERT(audioDevice.getType() != CAudioDeviceInfo::Unknown);
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << audioDevice;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << audioDevice;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (audioDevice.getType() == CAudioDevice::InputDevice)
|
if (audioDevice.getType() == CAudioDeviceInfo::InputDevice)
|
||||||
{
|
{
|
||||||
if (this->m_voice->getCurrentInputDevice() != audioDevice)
|
if (this->m_voice->getCurrentInputDevice() != audioDevice)
|
||||||
{
|
{
|
||||||
@@ -342,7 +342,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << selcal;
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << selcal;
|
||||||
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
|
CAudioDeviceInfo outputDevice = m_voice->getCurrentOutputDevice();
|
||||||
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,13 +77,13 @@ namespace BlackCore
|
|||||||
virtual void leaveAllVoiceRooms() override;
|
virtual void leaveAllVoiceRooms() override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::getAudioDevices()
|
//! \copydoc IContextAudio::getAudioDevices()
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getAudioDevices() const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getCurrentAudioDevices() const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) override;
|
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::setVolumes
|
//! \copydoc IContextAudio::setVolumes
|
||||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ namespace BlackCore
|
|||||||
"changedAudioVolumes", this, SIGNAL(changedAudioVolumes(qint32, qint32)));
|
"changedAudioVolumes", this, SIGNAL(changedAudioVolumes(qint32, qint32)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||||
"changedAudioDevices", this, SIGNAL(changedAudioDevices(BlackMisc::Audio::CAudioDeviceList)));
|
"changedAudioDevices", this, SIGNAL(changedAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||||
"changedSelectedAudioDevices", this, SIGNAL(changedSelectedAudioDevices(BlackMisc::Audio::CAudioDeviceList)));
|
"changedSelectedAudioDevices", this, SIGNAL(changedSelectedAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||||
"changedMute", this, SIGNAL(changedMute(bool)));
|
"changedMute", this, SIGNAL(changedMute(bool)));
|
||||||
@@ -96,23 +96,23 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Audio devices
|
* Audio devices
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList CContextAudioProxy::getAudioDevices() const
|
CAudioDeviceInfoList CContextAudioProxy::getAudioDevices() const
|
||||||
{
|
{
|
||||||
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getAudioDevices"));
|
return this->m_dBusInterface->callDBusRet<CAudioDeviceInfoList>(QLatin1Literal("getAudioDevices"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get current audio devices
|
* Get current audio devices
|
||||||
*/
|
*/
|
||||||
BlackMisc::Audio::CAudioDeviceList CContextAudioProxy::getCurrentAudioDevices() const
|
CAudioDeviceInfoList CContextAudioProxy::getCurrentAudioDevices() const
|
||||||
{
|
{
|
||||||
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getCurrentAudioDevices"));
|
return this->m_dBusInterface->callDBusRet<CAudioDeviceInfoList>(QLatin1Literal("getCurrentAudioDevices"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set current audio device
|
* Set current audio device
|
||||||
*/
|
*/
|
||||||
void CContextAudioProxy::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
void CContextAudioProxy::setCurrentAudioDevice(const CAudioDeviceInfo &audioDevice)
|
||||||
{
|
{
|
||||||
this->m_dBusInterface->callDBus(QLatin1Literal("setCurrentAudioDevice"), audioDevice);
|
this->m_dBusInterface->callDBus(QLatin1Literal("setCurrentAudioDevice"), audioDevice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "context_audio.h"
|
#include "context_audio.h"
|
||||||
|
|
||||||
#include "blackmisc/genericdbusinterface.h"
|
#include "blackmisc/genericdbusinterface.h"
|
||||||
#include "blackmisc/audiodevicelist.h"
|
#include "blackmisc/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/voiceroomlist.h"
|
#include "blackmisc/voiceroomlist.h"
|
||||||
#include "blackmisc/nwuserlist.h"
|
#include "blackmisc/nwuserlist.h"
|
||||||
#include "blackmisc/avaircraft.h"
|
#include "blackmisc/avaircraft.h"
|
||||||
@@ -82,13 +82,13 @@ namespace BlackCore
|
|||||||
virtual void leaveAllVoiceRooms() override;
|
virtual void leaveAllVoiceRooms() override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::getAudioDevices()
|
//! \copydoc IContextAudio::getAudioDevices()
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getAudioDevices() const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
||||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfoList getCurrentAudioDevices() const override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) override;
|
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||||
|
|
||||||
//! \copydoc IContextAudio::setVolumes()
|
//! \copydoc IContextAudio::setVolumes()
|
||||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "../blackmisc/avselcal.h"
|
#include "../blackmisc/avselcal.h"
|
||||||
#include "../blackmisc/nwuserlist.h"
|
#include "../blackmisc/nwuserlist.h"
|
||||||
#include "../blackmisc/voiceroomlist.h"
|
#include "../blackmisc/voiceroomlist.h"
|
||||||
#include "../blackmisc/audiodevicelist.h"
|
#include "../blackmisc/audiodeviceinfolist.h"
|
||||||
#include "../blackmisc/statusmessage.h"
|
#include "../blackmisc/statusmessage.h"
|
||||||
|
|
||||||
#include <vatlib/vatlib.h>
|
#include <vatlib/vatlib.h>
|
||||||
@@ -57,19 +57,19 @@ namespace BlackCore
|
|||||||
* \brief Audio devices
|
* \brief Audio devices
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Audio::CAudioDeviceList &audioDevices() const = 0;
|
virtual const BlackMisc::Audio::CAudioDeviceInfoList &audioDevices() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Default input device
|
* \brief Default input device
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Audio::CAudioDevice defaultAudioInputDevice() const = 0;
|
virtual const BlackMisc::Audio::CAudioDeviceInfo defaultAudioInputDevice() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Default output device
|
* \brief Default output device
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual const BlackMisc::Audio::CAudioDevice defaultAudioOutputDevice() const = 0;
|
virtual const BlackMisc::Audio::CAudioDeviceInfo defaultAudioOutputDevice() const = 0;
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* SETUP TESTS
|
* SETUP TESTS
|
||||||
@@ -111,22 +111,22 @@ namespace BlackCore
|
|||||||
/*!
|
/*!
|
||||||
* \brief Current input device
|
* \brief Current input device
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Audio::CAudioDevice getCurrentInputDevice() const = 0;
|
virtual BlackMisc::Audio::CAudioDeviceInfo getCurrentInputDevice() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Current output device
|
* \brief Current output device
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Audio::CAudioDevice getCurrentOutputDevice() const = 0;
|
virtual BlackMisc::Audio::CAudioDeviceInfo getCurrentOutputDevice() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Output device to be used
|
* \brief Output device to be used
|
||||||
*/
|
*/
|
||||||
virtual void setOutputDevice(const BlackMisc::Audio::CAudioDevice &device) = 0;
|
virtual void setOutputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Input device to be used
|
* \brief Input device to be used
|
||||||
*/
|
*/
|
||||||
virtual void setInputDevice(const BlackMisc::Audio::CAudioDevice &device) = 0;
|
virtual void setInputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Enable audio loopback to route recorded voice from microphone to speakers
|
* \brief Enable audio loopback to route recorded voice from microphone to speakers
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Devices
|
* Devices
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Audio::CAudioDeviceList &CVoiceVatlib::audioDevices() const
|
const BlackMisc::Audio::CAudioDeviceInfoList &CVoiceVatlib::audioDevices() const
|
||||||
{
|
{
|
||||||
QMutexLocker lockForReading(&m_lockDeviceList);
|
QMutexLocker lockForReading(&m_lockDeviceList);
|
||||||
return m_devices;
|
return m_devices;
|
||||||
@@ -75,25 +75,25 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Default input device
|
* Default input device
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Audio::CAudioDevice CVoiceVatlib::defaultAudioInputDevice() const
|
const BlackMisc::Audio::CAudioDeviceInfo CVoiceVatlib::defaultAudioInputDevice() const
|
||||||
{
|
{
|
||||||
// Constructor creates already a default device
|
// Constructor creates already a default device
|
||||||
return BlackMisc::Audio::CAudioDevice(BlackMisc::Audio::CAudioDevice::InputDevice, BlackMisc::Audio::CAudioDevice::defaultDeviceIndex(), "default");
|
return BlackMisc::Audio::CAudioDeviceInfo(BlackMisc::Audio::CAudioDeviceInfo::InputDevice, BlackMisc::Audio::CAudioDeviceInfo::defaultDeviceIndex(), "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default output device
|
* Default output device
|
||||||
*/
|
*/
|
||||||
const BlackMisc::Audio::CAudioDevice CVoiceVatlib::defaultAudioOutputDevice() const
|
const BlackMisc::Audio::CAudioDeviceInfo CVoiceVatlib::defaultAudioOutputDevice() const
|
||||||
{
|
{
|
||||||
// Constructor creates already a default device
|
// Constructor creates already a default device
|
||||||
return BlackMisc::Audio::CAudioDevice(BlackMisc::Audio::CAudioDevice::OutputDevice, BlackMisc::Audio::CAudioDevice::defaultDeviceIndex(), "default");
|
return BlackMisc::Audio::CAudioDeviceInfo(BlackMisc::Audio::CAudioDeviceInfo::OutputDevice, BlackMisc::Audio::CAudioDeviceInfo::defaultDeviceIndex(), "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current output device
|
* Current output device
|
||||||
*/
|
*/
|
||||||
CAudioDevice CVoiceVatlib::getCurrentOutputDevice() const
|
CAudioDeviceInfo CVoiceVatlib::getCurrentOutputDevice() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_lockCurrentOutputDevice);
|
QMutexLocker locker(&m_lockCurrentOutputDevice);
|
||||||
return m_currentOutputDevice;
|
return m_currentOutputDevice;
|
||||||
@@ -102,7 +102,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Current input device
|
* Current input device
|
||||||
*/
|
*/
|
||||||
CAudioDevice CVoiceVatlib::getCurrentInputDevice() const
|
CAudioDeviceInfo CVoiceVatlib::getCurrentInputDevice() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_lockCurrentInputDevice);
|
QMutexLocker locker(&m_lockCurrentInputDevice);
|
||||||
return m_currentInputDevice;
|
return m_currentInputDevice;
|
||||||
@@ -111,7 +111,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Set input device
|
* Set input device
|
||||||
*/
|
*/
|
||||||
void CVoiceVatlib::setInputDevice(const BlackMisc::Audio::CAudioDevice &device)
|
void CVoiceVatlib::setInputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device)
|
||||||
{
|
{
|
||||||
std::lock_guard<TVatlibPointer> locker(m_vatlib);
|
std::lock_guard<TVatlibPointer> locker(m_vatlib);
|
||||||
Q_ASSERT_X(m_vatlib->IsValid() && m_vatlib->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!");
|
Q_ASSERT_X(m_vatlib->IsValid() && m_vatlib->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!");
|
||||||
@@ -143,7 +143,7 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Set output device
|
* Set output device
|
||||||
*/
|
*/
|
||||||
void CVoiceVatlib::setOutputDevice(const BlackMisc::Audio::CAudioDevice &device)
|
void CVoiceVatlib::setOutputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device)
|
||||||
{
|
{
|
||||||
std::lock_guard<TVatlibPointer> locker(m_vatlib);
|
std::lock_guard<TVatlibPointer> locker(m_vatlib);
|
||||||
Q_ASSERT_X(m_vatlib->IsValid() && m_vatlib->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!");
|
Q_ASSERT_X(m_vatlib->IsValid() && m_vatlib->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!");
|
||||||
@@ -400,7 +400,7 @@ namespace BlackCore
|
|||||||
void CVoiceVatlib::onInputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar)
|
void CVoiceVatlib::onInputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar)
|
||||||
{
|
{
|
||||||
Q_UNUSED(obj)
|
Q_UNUSED(obj)
|
||||||
BlackMisc::Audio::CAudioDevice inputDevice(BlackMisc::Audio::CAudioDevice::InputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDevice::InputDevice), QString(name));
|
BlackMisc::Audio::CAudioDeviceInfo inputDevice(BlackMisc::Audio::CAudioDeviceInfo::InputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDeviceInfo::InputDevice), QString(name));
|
||||||
QMutexLocker lockForWriting(&(cbvar_cast_voice(cbVar)->m_lockDeviceList));
|
QMutexLocker lockForWriting(&(cbvar_cast_voice(cbVar)->m_lockDeviceList));
|
||||||
cbvar_cast_voice(cbVar)->m_devices.push_back(inputDevice);
|
cbvar_cast_voice(cbVar)->m_devices.push_back(inputDevice);
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ namespace BlackCore
|
|||||||
void CVoiceVatlib::onOutputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar)
|
void CVoiceVatlib::onOutputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar)
|
||||||
{
|
{
|
||||||
Q_UNUSED(obj)
|
Q_UNUSED(obj)
|
||||||
BlackMisc::Audio::CAudioDevice outputDevice(BlackMisc::Audio::CAudioDevice::OutputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDevice::OutputDevice), QString(name));
|
BlackMisc::Audio::CAudioDeviceInfo outputDevice(BlackMisc::Audio::CAudioDeviceInfo::OutputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDeviceInfo::OutputDevice), QString(name));
|
||||||
QMutexLocker lockForWriting(&(cbvar_cast_voice(cbVar)->m_lockDeviceList));
|
QMutexLocker lockForWriting(&(cbvar_cast_voice(cbVar)->m_lockDeviceList));
|
||||||
cbvar_cast_voice(cbVar)->m_devices.push_back(outputDevice);
|
cbvar_cast_voice(cbVar)->m_devices.push_back(outputDevice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "voice.h"
|
#include "voice.h"
|
||||||
#include "../blacksound/soundgenerator.h"
|
#include "../blacksound/soundgenerator.h"
|
||||||
#include "../blackmisc/audiodevicelist.h"
|
|
||||||
#include "../blackmisc/nwuserlist.h"
|
#include "../blackmisc/nwuserlist.h"
|
||||||
#include "../blackmisc/avcallsignlist.h"
|
#include "../blackmisc/avcallsignlist.h"
|
||||||
#include "../blackmisc/sharedlockablepointer.h"
|
#include "../blackmisc/sharedlockablepointer.h"
|
||||||
@@ -74,13 +73,13 @@ namespace BlackCore
|
|||||||
// and ATC to headspeakers. Is not important to implement that now, if ever.
|
// and ATC to headspeakers. Is not important to implement that now, if ever.
|
||||||
|
|
||||||
//! \copydoc IVoice::audioDevices()
|
//! \copydoc IVoice::audioDevices()
|
||||||
virtual const BlackMisc::Audio::CAudioDeviceList &audioDevices() const override;
|
virtual const BlackMisc::Audio::CAudioDeviceInfoList &audioDevices() const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::defaultAudioInputDevice()
|
//! \copydoc IVoice::defaultAudioInputDevice()
|
||||||
virtual const BlackMisc::Audio::CAudioDevice defaultAudioInputDevice() const override;
|
virtual const BlackMisc::Audio::CAudioDeviceInfo defaultAudioInputDevice() const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::defaultAudioOutputDevice()
|
//! \copydoc IVoice::defaultAudioOutputDevice()
|
||||||
virtual const BlackMisc::Audio::CAudioDevice defaultAudioOutputDevice() const override;
|
virtual const BlackMisc::Audio::CAudioDeviceInfo defaultAudioOutputDevice() const override;
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* SETUP TESTS
|
* SETUP TESTS
|
||||||
@@ -105,16 +104,16 @@ namespace BlackCore
|
|||||||
virtual IVoiceChannel *getVoiceChannel(qint32 channelIndex) const override;
|
virtual IVoiceChannel *getVoiceChannel(qint32 channelIndex) const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::setInputDevice
|
//! \copydoc IVoice::setInputDevice
|
||||||
virtual void setInputDevice(const BlackMisc::Audio::CAudioDevice &device) override;
|
virtual void setInputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) override;
|
||||||
|
|
||||||
//! \copydoc IVoice::setOutputDevice
|
//! \copydoc IVoice::setOutputDevice
|
||||||
virtual void setOutputDevice(const BlackMisc::Audio::CAudioDevice &device) override;
|
virtual void setOutputDevice(const BlackMisc::Audio::CAudioDeviceInfo &device) override;
|
||||||
|
|
||||||
//! \copydoc IVoice::getCurrentInputDevice()
|
//! \copydoc IVoice::getCurrentInputDevice()
|
||||||
virtual BlackMisc::Audio::CAudioDevice getCurrentInputDevice() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfo getCurrentInputDevice() const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::getCurrentOutputDevice()
|
//! \copydoc IVoice::getCurrentOutputDevice()
|
||||||
virtual BlackMisc::Audio::CAudioDevice getCurrentOutputDevice() const override;
|
virtual BlackMisc::Audio::CAudioDeviceInfo getCurrentOutputDevice() const override;
|
||||||
|
|
||||||
//! \copydoc IVoice::enableAudioLoopback
|
//! \copydoc IVoice::enableAudioLoopback
|
||||||
virtual void enableAudioLoopback(bool enable = true) override;
|
virtual void enableAudioLoopback(bool enable = true) override;
|
||||||
@@ -148,9 +147,9 @@ namespace BlackCore
|
|||||||
void onRoomStatusUpdate(qint32 roomIndex, Cvatlib_Voice_Simple::roomStatusUpdate roomStatus);
|
void onRoomStatusUpdate(qint32 roomIndex, Cvatlib_Voice_Simple::roomStatusUpdate roomStatus);
|
||||||
|
|
||||||
TVatlibPointer m_vatlib;
|
TVatlibPointer m_vatlib;
|
||||||
BlackMisc::Audio::CAudioDeviceList m_devices; /*!< in and output devices */
|
BlackMisc::Audio::CAudioDeviceInfoList m_devices; /*!< in and output devices */
|
||||||
BlackMisc::Audio::CAudioDevice m_currentOutputDevice;
|
BlackMisc::Audio::CAudioDeviceInfo m_currentOutputDevice;
|
||||||
BlackMisc::Audio::CAudioDevice m_currentInputDevice;
|
BlackMisc::Audio::CAudioDeviceInfo m_currentInputDevice;
|
||||||
std::atomic<float> m_inputSquelch;
|
std::atomic<float> m_inputSquelch;
|
||||||
std::atomic<Cvatlib_Voice_Simple::agc> m_micTestResult;
|
std::atomic<Cvatlib_Voice_Simple::agc> m_micTestResult;
|
||||||
QHash<qint32, IVoiceChannel *> m_hashChannelIndex;
|
QHash<qint32, IVoiceChannel *> m_hashChannelIndex;
|
||||||
|
|||||||
@@ -198,53 +198,53 @@ namespace BlackGui
|
|||||||
if (!this->getIContextAudio()) return;
|
if (!this->getIContextAudio()) return;
|
||||||
if (index < 0)return;
|
if (index < 0)return;
|
||||||
|
|
||||||
CAudioDeviceList devices = this->getIContextAudio()->getAudioDevices();
|
CAudioDeviceInfoList devices = this->getIContextAudio()->getAudioDevices();
|
||||||
if (devices.isEmpty()) return;
|
if (devices.isEmpty()) return;
|
||||||
CAudioDevice selectedDevice;
|
CAudioDeviceInfo selectedDevice;
|
||||||
QObject *sender = QObject::sender();
|
QObject *sender = QObject::sender();
|
||||||
if (sender == this->ui->cb_SetupAudioInputDevice)
|
if (sender == this->ui->cb_SetupAudioInputDevice)
|
||||||
{
|
{
|
||||||
CAudioDeviceList inputDevices = devices.getInputDevices();
|
CAudioDeviceInfoList inputDevices = devices.getInputDevices();
|
||||||
if (index >= inputDevices.size()) return;
|
if (index >= inputDevices.size()) return;
|
||||||
selectedDevice = inputDevices[index];
|
selectedDevice = inputDevices[index];
|
||||||
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||||
}
|
}
|
||||||
else if (sender == this->ui->cb_SetupAudioOutputDevice)
|
else if (sender == this->ui->cb_SetupAudioOutputDevice)
|
||||||
{
|
{
|
||||||
CAudioDeviceList outputDevices = devices.getOutputDevices();
|
CAudioDeviceInfoList outputDevices = devices.getOutputDevices();
|
||||||
if (index >= outputDevices.size()) return;
|
if (index >= outputDevices.size()) return;
|
||||||
selectedDevice = outputDevices[index];
|
selectedDevice = outputDevices[index];
|
||||||
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioSetupComponent::ps_onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceList &devices)
|
void CAudioSetupComponent::ps_onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||||
{
|
{
|
||||||
foreach(CAudioDevice device, devices)
|
for(auto &device : devices)
|
||||||
{
|
{
|
||||||
if (device.getType() == CAudioDevice::InputDevice)
|
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||||
{
|
{
|
||||||
this->ui->cb_SetupAudioInputDevice->setCurrentText(device.toQString(true));
|
this->ui->cb_SetupAudioInputDevice->setCurrentText(device.toQString(true));
|
||||||
}
|
}
|
||||||
else if (device.getType() == CAudioDevice::OutputDevice)
|
else if (device.getType() == CAudioDeviceInfo::OutputDevice)
|
||||||
{
|
{
|
||||||
this->ui->cb_SetupAudioOutputDevice->setCurrentText(device.toQString(true));
|
this->ui->cb_SetupAudioOutputDevice->setCurrentText(device.toQString(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioSetupComponent::ps_onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceList &devices)
|
void CAudioSetupComponent::ps_onAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||||
{
|
{
|
||||||
this->ui->cb_SetupAudioOutputDevice->clear();
|
this->ui->cb_SetupAudioOutputDevice->clear();
|
||||||
this->ui->cb_SetupAudioInputDevice->clear();
|
this->ui->cb_SetupAudioInputDevice->clear();
|
||||||
|
|
||||||
foreach(CAudioDevice device, devices)
|
for(auto &device : devices)
|
||||||
{
|
{
|
||||||
if (device.getType() == CAudioDevice::InputDevice)
|
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||||
{
|
{
|
||||||
this->ui->cb_SetupAudioInputDevice->addItem(device.toQString(true));
|
this->ui->cb_SetupAudioInputDevice->addItem(device.toQString(true));
|
||||||
}
|
}
|
||||||
else if (device.getType() == CAudioDevice::OutputDevice)
|
else if (device.getType() == CAudioDeviceInfo::OutputDevice)
|
||||||
{
|
{
|
||||||
this->ui->cb_SetupAudioOutputDevice->addItem(device.toQString(true));
|
this->ui->cb_SetupAudioOutputDevice->addItem(device.toQString(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#define BLACKGUI_AUDIOSETUPCOMPONENT_H
|
#define BLACKGUI_AUDIOSETUPCOMPONENT_H
|
||||||
|
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "blackmisc/audiodevicelist.h"
|
#include "blackmisc/audiodeviceinfolist.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
@@ -66,10 +66,10 @@ namespace BlackGui
|
|||||||
void ps_audioDeviceSelected(int index);
|
void ps_audioDeviceSelected(int index);
|
||||||
|
|
||||||
//! Current audio devices changed
|
//! Current audio devices changed
|
||||||
void ps_onCurrentAudioDevicesChanged(const Audio::CAudioDeviceList &devices);
|
void ps_onCurrentAudioDevicesChanged(const Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|
||||||
//! Audio devices changed
|
//! Audio devices changed
|
||||||
void ps_onAudioDevicesChanged(const Audio::CAudioDeviceList &devices);
|
void ps_onAudioDevicesChanged(const Audio::CAudioDeviceInfoList &devices);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Audio test modes
|
//! Audio test modes
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
#ifndef BLACKMISC_AUDIOALLCLASSES_H
|
#ifndef BLACKMISC_AUDIOALLCLASSES_H
|
||||||
#define BLACKMISC_AUDIOALLCLASSES_H
|
#define BLACKMISC_AUDIOALLCLASSES_H
|
||||||
|
|
||||||
#include "blackmisc/audiodevice.h"
|
#include "blackmisc/audiodeviceinfo.h"
|
||||||
#include "blackmisc/audiodevicelist.h"
|
#include "blackmisc/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/voiceroom.h"
|
#include "blackmisc/voiceroom.h"
|
||||||
#include "blackmisc/voiceroomlist.h"
|
#include "blackmisc/voiceroomlist.h"
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "audiodevice.h"
|
#include "audiodeviceinfo.h"
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
CAudioDevice::CAudioDevice() :
|
CAudioDeviceInfo::CAudioDeviceInfo() :
|
||||||
m_type(Unknown), m_deviceIndex(invalidDeviceIndex()),
|
m_type(Unknown), m_deviceIndex(invalidDeviceIndex()),
|
||||||
m_deviceName(""), m_hostName(BlackMisc::localHostName())
|
m_deviceName(""), m_hostName(BlackMisc::localHostName())
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
CAudioDevice::CAudioDevice(DeviceType type, const qint16 index, const QString &name) :
|
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const qint16 index, const QString &name) :
|
||||||
m_type(type), m_deviceIndex(index),
|
m_type(type), m_deviceIndex(index),
|
||||||
m_deviceName(name), m_hostName(BlackMisc::localHostName())
|
m_deviceName(name), m_hostName(BlackMisc::localHostName())
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* As String
|
* As String
|
||||||
*/
|
*/
|
||||||
QString CAudioDevice::convertToQString(bool /* i18n */) const
|
QString CAudioDeviceInfo::convertToQString(bool /* i18n */) const
|
||||||
{
|
{
|
||||||
if (this->m_hostName.isEmpty()) return m_deviceName;
|
if (this->m_hostName.isEmpty()) return m_deviceName;
|
||||||
QString s(this->m_deviceName);
|
QString s(this->m_deviceName);
|
||||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
|||||||
* If you want to safe this object, use the name instead of the index, since the index can change after
|
* If you want to safe this object, use the name instead of the index, since the index can change after
|
||||||
* a restart.
|
* a restart.
|
||||||
*/
|
*/
|
||||||
class CAudioDevice : public CValueObjectStdTuple<CAudioDevice>
|
class CAudioDeviceInfo : public CValueObjectStdTuple<CAudioDeviceInfo>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Type
|
//! Type
|
||||||
@@ -41,10 +41,10 @@ namespace BlackMisc
|
|||||||
* If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs
|
* If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs
|
||||||
* to be checked in Vatlib.
|
* to be checked in Vatlib.
|
||||||
*/
|
*/
|
||||||
CAudioDevice();
|
CAudioDeviceInfo();
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CAudioDevice(DeviceType type, const qint16 index, const QString &getName);
|
CAudioDeviceInfo(DeviceType type, const qint16 index, const QString &getName);
|
||||||
|
|
||||||
//! Get the device index
|
//! Get the device index
|
||||||
qint16 getIndex() const { return m_deviceIndex; }
|
qint16 getIndex() const { return m_deviceIndex; }
|
||||||
@@ -68,15 +68,15 @@ namespace BlackMisc
|
|||||||
static qint16 invalidDeviceIndex() {return -2;}
|
static qint16 invalidDeviceIndex() {return -2;}
|
||||||
|
|
||||||
//! Default output device
|
//! Default output device
|
||||||
static CAudioDevice getDefaultOutputDevice()
|
static CAudioDeviceInfo getDefaultOutputDevice()
|
||||||
{
|
{
|
||||||
return CAudioDevice(OutputDevice, defaultDeviceIndex(), "default");
|
return CAudioDeviceInfo(OutputDevice, defaultDeviceIndex(), "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Default input device
|
//! Default input device
|
||||||
static CAudioDevice getDefaultInputDevice()
|
static CAudioDeviceInfo getDefaultInputDevice()
|
||||||
{
|
{
|
||||||
return CAudioDevice(InputDevice, defaultDeviceIndex(), "default");
|
return CAudioDeviceInfo(InputDevice, defaultDeviceIndex(), "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -84,8 +84,8 @@ namespace BlackMisc
|
|||||||
virtual QString convertToQString(bool i18n = false) const override;
|
virtual QString convertToQString(bool i18n = false) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BLACK_ENABLE_TUPLE_CONVERSION(CAudioDevice)
|
BLACK_ENABLE_TUPLE_CONVERSION(CAudioDeviceInfo)
|
||||||
//! Device type, @see CAudioDevice::DeviceType
|
//! Device type, @see CAudioDeviceInfo::DeviceType
|
||||||
DeviceType m_type;
|
DeviceType m_type;
|
||||||
/*!
|
/*!
|
||||||
* deviceIndex is the number is the reference for the VVL. The device is selected by this index.
|
* deviceIndex is the number is the reference for the VVL. The device is selected by this index.
|
||||||
@@ -100,7 +100,7 @@ namespace BlackMisc
|
|||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Audio::CAudioDevice, (o.m_type, o.m_deviceIndex, o.m_deviceName, o.m_hostName))
|
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Audio::CAudioDeviceInfo, (o.m_type, o.m_deviceIndex, o.m_deviceName, o.m_hostName))
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDevice)
|
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceInfo)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "audiodevicelist.h"
|
#include "audiodeviceinfolist.h"
|
||||||
#include "predicates.h"
|
#include "predicates.h"
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
@@ -17,37 +17,37 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList::CAudioDeviceList() { }
|
CAudioDeviceInfoList::CAudioDeviceInfoList() { }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct from base class object
|
* Construct from base class object
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList::CAudioDeviceList(const CSequence &other) :
|
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) :
|
||||||
CSequence(other)
|
CSequence(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output devices
|
* Output devices
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList CAudioDeviceList::getOutputDevices() const
|
CAudioDeviceInfoList CAudioDeviceInfoList::getOutputDevices() const
|
||||||
{
|
{
|
||||||
return this->findBy(&CAudioDevice::getType, CAudioDevice::OutputDevice);
|
return this->findBy(&CAudioDeviceInfo::getType, CAudioDeviceInfo::OutputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output devices
|
* Output devices
|
||||||
*/
|
*/
|
||||||
CAudioDeviceList CAudioDeviceList::getInputDevices() const
|
CAudioDeviceInfoList CAudioDeviceInfoList::getInputDevices() const
|
||||||
{
|
{
|
||||||
return this->findBy(&CAudioDevice::getType, CAudioDevice::InputDevice);
|
return this->findBy(&CAudioDeviceInfo::getType, CAudioDeviceInfo::InputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count as of type
|
* Count as of type
|
||||||
*/
|
*/
|
||||||
int CAudioDeviceList::count(CAudioDevice::DeviceType type) const
|
int CAudioDeviceInfoList::count(CAudioDeviceInfo::DeviceType type) const
|
||||||
{
|
{
|
||||||
return std::count_if(this->begin(), this->end(), [type](const CAudioDevice &device)
|
return std::count_if(this->begin(), this->end(), [type](const CAudioDeviceInfo &device)
|
||||||
{
|
{
|
||||||
return device.getType() == type;
|
return device.getType() == type;
|
||||||
});
|
});
|
||||||
@@ -56,11 +56,11 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Register metadata
|
* Register metadata
|
||||||
*/
|
*/
|
||||||
void CAudioDeviceList::registerMetadata()
|
void CAudioDeviceInfoList::registerMetadata()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<CAudioDeviceList>();
|
qRegisterMetaType<CAudioDeviceInfoList>();
|
||||||
qDBusRegisterMetaType<CAudioDeviceList>();
|
qDBusRegisterMetaType<CAudioDeviceInfoList>();
|
||||||
registerMetaValueType<CAudioDeviceList>();
|
registerMetaValueType<CAudioDeviceInfoList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef BLACKMISC_AUDIODEVICELIST_H
|
#ifndef BLACKMISC_AUDIODEVICELIST_H
|
||||||
#define BLACKMISC_AUDIODEVICELIST_H
|
#define BLACKMISC_AUDIODEVICELIST_H
|
||||||
|
|
||||||
#include "audiodevice.h"
|
#include "audiodeviceinfo.h"
|
||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -26,23 +26,23 @@ namespace BlackMisc
|
|||||||
/*!
|
/*!
|
||||||
* Value object encapsulating a list of audio devices.
|
* Value object encapsulating a list of audio devices.
|
||||||
*/
|
*/
|
||||||
class CAudioDeviceList : public CSequence<CAudioDevice>
|
class CAudioDeviceInfoList : public CSequence<CAudioDeviceInfo>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CAudioDeviceList();
|
CAudioDeviceInfoList();
|
||||||
|
|
||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CAudioDeviceList(const CSequence &other);
|
CAudioDeviceInfoList(const CSequence &other);
|
||||||
|
|
||||||
//! Get output devices in that list
|
//! Get output devices in that list
|
||||||
CAudioDeviceList getOutputDevices() const;
|
CAudioDeviceInfoList getOutputDevices() const;
|
||||||
|
|
||||||
//! Get output devices in that list
|
//! Get output devices in that list
|
||||||
CAudioDeviceList getInputDevices() const;
|
CAudioDeviceInfoList getInputDevices() const;
|
||||||
|
|
||||||
//! Count (as of type)
|
//! Count (as of type)
|
||||||
int count(CAudioDevice::DeviceType type) const;
|
int count(CAudioDeviceInfo::DeviceType type) const;
|
||||||
|
|
||||||
//! \copydoc CValueObject::toQVariant
|
//! \copydoc CValueObject::toQVariant
|
||||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||||
@@ -57,8 +57,8 @@ namespace BlackMisc
|
|||||||
} //namespace
|
} //namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceList)
|
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceInfoList)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Audio::CAudioDevice>)
|
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Audio::CAudioDeviceInfo>)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Audio::CAudioDevice>)
|
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Audio::CAudioDeviceInfo>)
|
||||||
|
|
||||||
#endif //guard
|
#endif //guard
|
||||||
@@ -67,8 +67,8 @@ void BlackMisc::Settings::registerMetadata()
|
|||||||
*/
|
*/
|
||||||
void BlackMisc::Audio::registerMetadata()
|
void BlackMisc::Audio::registerMetadata()
|
||||||
{
|
{
|
||||||
CAudioDevice::registerMetadata();
|
CAudioDeviceInfo::registerMetadata();
|
||||||
CAudioDeviceList::registerMetadata();
|
CAudioDeviceInfoList::registerMetadata();
|
||||||
CVoiceRoom::registerMetadata();
|
CVoiceRoom::registerMetadata();
|
||||||
CVoiceRoomList::registerMetadata();
|
CVoiceRoomList::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,9 +362,9 @@ namespace BlackSound
|
|||||||
/*
|
/*
|
||||||
* BlackMisc to Qt audio device
|
* BlackMisc to Qt audio device
|
||||||
*/
|
*/
|
||||||
QAudioDeviceInfo CSoundGenerator::findClosestOutputDevice(const BlackMisc::Audio::CAudioDevice &audioDevice)
|
QAudioDeviceInfo CSoundGenerator::findClosestOutputDevice(const CAudioDeviceInfo &audioDevice)
|
||||||
{
|
{
|
||||||
Q_ASSERT(audioDevice.getType() == CAudioDevice::OutputDevice);
|
Q_ASSERT(audioDevice.getType() == CAudioDeviceInfo::OutputDevice);
|
||||||
const QString lookFor = audioDevice.getName().toLower();
|
const QString lookFor = audioDevice.getName().toLower();
|
||||||
QAudioDeviceInfo qtDevice = QAudioDeviceInfo::defaultOutputDevice();
|
QAudioDeviceInfo qtDevice = QAudioDeviceInfo::defaultOutputDevice();
|
||||||
if (lookFor.startsWith("default")) return qtDevice;
|
if (lookFor.startsWith("default")) return qtDevice;
|
||||||
@@ -452,7 +452,7 @@ namespace BlackSound
|
|||||||
// CSoundGenerator::playSignalRecorded(volume, tones, device);
|
// CSoundGenerator::playSignalRecorded(volume, tones, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundGenerator::playSelcal(qint32 volume, const CSelcal &selcal, const CAudioDevice &audioDevice)
|
void CSoundGenerator::playSelcal(qint32 volume, const CSelcal &selcal, const CAudioDeviceInfo &audioDevice)
|
||||||
{
|
{
|
||||||
if (CSoundGenerator::s_selcalStarted.msecsTo(QDateTime::currentDateTimeUtc()) < 2500) return; // simple check not to play 2 SELCAL at the same time
|
if (CSoundGenerator::s_selcalStarted.msecsTo(QDateTime::currentDateTimeUtc()) < 2500) return; // simple check not to play 2 SELCAL at the same time
|
||||||
CSoundGenerator::s_selcalStarted = QDateTime::currentDateTimeUtc();
|
CSoundGenerator::s_selcalStarted = QDateTime::currentDateTimeUtc();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#define BLACKSOUND_SOUNDGENERATOR_H
|
#define BLACKSOUND_SOUNDGENERATOR_H
|
||||||
|
|
||||||
#include "blackmisc/avselcal.h"
|
#include "blackmisc/avselcal.h"
|
||||||
#include "blackmisc/audiodevice.h"
|
#include "blackmisc/audiodeviceinfo.h"
|
||||||
#include "blackmisc/pqtime.h"
|
#include "blackmisc/pqtime.h"
|
||||||
#include "blackmisc/notificationsounds.h"
|
#include "blackmisc/notificationsounds.h"
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
@@ -122,7 +122,7 @@ namespace BlackSound
|
|||||||
* \param audioDevice output audio device
|
* \param audioDevice output audio device
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
static QAudioDeviceInfo findClosestOutputDevice(const BlackMisc::Audio::CAudioDevice &audioDevice);
|
static QAudioDeviceInfo findClosestOutputDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Play signal of tones once
|
* \brief Play signal of tones once
|
||||||
@@ -166,7 +166,7 @@ namespace BlackSound
|
|||||||
* \param audioDevice device to be used
|
* \param audioDevice device to be used
|
||||||
* \see BlackMisc::Aviation::CSelcal
|
* \see BlackMisc::Aviation::CSelcal
|
||||||
*/
|
*/
|
||||||
static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Audio::CAudioDevice &audioDevice);
|
static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Audio::CAudioDeviceInfo &audioDevice);
|
||||||
|
|
||||||
|
|
||||||
//! One cycle of tones takes t milliseconds
|
//! One cycle of tones takes t milliseconds
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ namespace BlackMiscTest
|
|||||||
{
|
{
|
||||||
qtout << "-------------" << endl;
|
qtout << "-------------" << endl;
|
||||||
qtout << "vatlib audio devices" << endl;
|
qtout << "vatlib audio devices" << endl;
|
||||||
CAudioDeviceList devices;
|
CAudioDeviceInfoList devices;
|
||||||
QMetaObject::invokeMethod(runtime->getIContextAudio(), "getAudioDevices",
|
QMetaObject::invokeMethod(runtime->getIContextAudio(), "getAudioDevices",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
Q_RETURN_ARG(BlackMisc::Audio::CAudioDeviceList, devices));
|
Q_RETURN_ARG(BlackMisc::Audio::CAudioDeviceInfoList, devices));
|
||||||
qtout << devices << endl;
|
qtout << devices << endl;
|
||||||
}
|
}
|
||||||
else if (line.startsWith("2"))
|
else if (line.startsWith("2"))
|
||||||
|
|||||||
Reference in New Issue
Block a user