1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Move AudioDeviceInfo singleton

This commit is contained in:
mxi-box 2024-03-30 14:24:05 +08:00
parent ce3e78322b
commit 556cc8ad45
4 changed files with 12 additions and 12 deletions

View File

@ -174,7 +174,7 @@ void FCDProInput::closeDevice()
bool FCDProInput::openFCDAudio(const char* cardname)
{
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
const QList<AudioDeviceInfo>& audioList = audioDeviceManager->getInputDevices();
const QList<AudioDeviceInfo>& audioList = AudioDeviceInfo::availableInputDevices();
for (const auto &itAudio : audioList)
{

View File

@ -176,7 +176,7 @@ void FCDProPlusInput::closeDevice()
bool FCDProPlusInput::openFCDAudio(const char* cardname)
{
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
const QList<AudioDeviceInfo>& audioList = audioDeviceManager->getInputDevices();
const QList<AudioDeviceInfo>& audioList = AudioDeviceInfo::availableInputDevices();
for (const auto &itAudio : audioList)
{

View File

@ -73,28 +73,28 @@ QString AudioDeviceInfo::realm() const
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableInputDevices()
{
if (!m_inputDevicesEnumerated) {
if (!inputDevicesEnumerated) {
QList<QAudioDevice> devInfos = QMediaDevices::audioInputs();
for (auto devInfo : devInfos) {
m_inputDevices.append(AudioDeviceInfo(devInfo));
inputDevices.append(AudioDeviceInfo(devInfo));
}
m_inputDevicesEnumerated = true;
inputDevicesEnumerated = true;
}
return m_inputDevices;
return inputDevices;
}
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableOutputDevices()
{
if (!m_outputDevicesEnumerated) {
if (!outputDevicesEnumerated) {
QList<QAudioDevice> devInfos = QMediaDevices::audioOutputs();
for (auto devInfo : devInfos) {
m_outputDevices.append(AudioDeviceInfo(devInfo));
outputDevices.append(AudioDeviceInfo(devInfo));
}
m_outputDevicesEnumerated = true;
outputDevicesEnumerated = true;
}
return m_outputDevices;
return outputDevices;
}
#else
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableInputDevices()

View File

@ -454,8 +454,8 @@ int WebAPIAdapter::instanceAudioGet(
{
(void) error;
DSPEngine *dspEngine = DSPEngine::instance();
const QList<AudioDeviceInfo>& audioInputDevices = dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<AudioDeviceInfo>& audioOutputDevices = dspEngine->getAudioDeviceManager()->getOutputDevices();
const QList<AudioDeviceInfo>& audioInputDevices = AudioDeviceInfo::availableInputDevices();
const QList<AudioDeviceInfo>& audioOutputDevices = AudioDeviceInfo::availableOutputDevices();
int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size();