mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
FCD: use AudioDeviceManager in place of manupulating AudioInputDevice directly
This commit is contained in:
parent
e51e8c23b2
commit
df917bb489
@ -176,11 +176,13 @@ bool FCDProInput::openFCDAudio(const char* cardname)
|
||||
if (itAudio.deviceName().contains(QString(cardname)))
|
||||
{
|
||||
int fcdDeviceIndex = audioDeviceManager->getInputDeviceIndex(itAudio.deviceName());
|
||||
m_fcdAudioInput.start(fcdDeviceIndex, fcd_traits<Pro>::sampleRate);
|
||||
int fcdSampleRate = m_fcdAudioInput.getRate();
|
||||
qDebug("FCDProPlusInput::openFCDAudio: %s index %d at %d S/s",
|
||||
itAudio.deviceName().toStdString().c_str(), fcdDeviceIndex, fcdSampleRate);
|
||||
m_fcdAudioInput.addFifo(&m_fcdFIFO);
|
||||
AudioDeviceManager::InputDeviceInfo fcdDeviceInfo;
|
||||
audioDeviceManager->getInputDeviceInfo(itAudio.deviceName(), fcdDeviceInfo);
|
||||
fcdDeviceInfo.sampleRate = fcd_traits<Pro>::sampleRate;
|
||||
audioDeviceManager->setInputDeviceInfo(fcdDeviceIndex, fcdDeviceInfo);
|
||||
audioDeviceManager->addAudioSource(&m_fcdFIFO, getInputMessageQueue(), fcdDeviceIndex);
|
||||
qDebug("FCDProPlusInput::openFCDAudio: %s index %d",
|
||||
itAudio.deviceName().toStdString().c_str(), fcdDeviceIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -191,8 +193,8 @@ bool FCDProInput::openFCDAudio(const char* cardname)
|
||||
|
||||
void FCDProInput::closeFCDAudio()
|
||||
{
|
||||
m_fcdAudioInput.removeFifo(&m_fcdFIFO);
|
||||
m_fcdAudioInput.stop();
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
audioDeviceManager->removeAudioSource(&m_fcdFIFO);
|
||||
}
|
||||
|
||||
void FCDProInput::stop()
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "audio/audioinputdevice.h"
|
||||
#include "audio/audiofifo.h"
|
||||
|
||||
#include "fcdprosettings.h"
|
||||
@ -158,7 +157,6 @@ public:
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
hid_device *m_dev;
|
||||
AudioInputDevice m_fcdAudioInput;
|
||||
AudioFifo m_fcdFIFO;
|
||||
QMutex m_mutex;
|
||||
FCDProSettings m_settings;
|
||||
|
@ -178,11 +178,13 @@ bool FCDProPlusInput::openFCDAudio(const char* cardname)
|
||||
if (itAudio.deviceName().contains(QString(cardname)))
|
||||
{
|
||||
int fcdDeviceIndex = audioDeviceManager->getInputDeviceIndex(itAudio.deviceName());
|
||||
m_fcdAudioInput.start(fcdDeviceIndex, fcd_traits<ProPlus>::sampleRate);
|
||||
int fcdSampleRate = m_fcdAudioInput.getRate();
|
||||
qDebug("FCDProPlusInput::openFCDAudio: %s index %d at %d S/s",
|
||||
itAudio.deviceName().toStdString().c_str(), fcdDeviceIndex, fcdSampleRate);
|
||||
m_fcdAudioInput.addFifo(&m_fcdFIFO);
|
||||
AudioDeviceManager::InputDeviceInfo fcdDeviceInfo;
|
||||
audioDeviceManager->getInputDeviceInfo(itAudio.deviceName(), fcdDeviceInfo);
|
||||
fcdDeviceInfo.sampleRate = fcd_traits<ProPlus>::sampleRate;
|
||||
audioDeviceManager->setInputDeviceInfo(fcdDeviceIndex, fcdDeviceInfo);
|
||||
audioDeviceManager->addAudioSource(&m_fcdFIFO, getInputMessageQueue(), fcdDeviceIndex);
|
||||
qDebug("FCDProPlusInput::openFCDAudio: %s index %d",
|
||||
itAudio.deviceName().toStdString().c_str(), fcdDeviceIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -193,8 +195,8 @@ bool FCDProPlusInput::openFCDAudio(const char* cardname)
|
||||
|
||||
void FCDProPlusInput::closeFCDAudio()
|
||||
{
|
||||
m_fcdAudioInput.removeFifo(&m_fcdFIFO);
|
||||
m_fcdAudioInput.stop();
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
audioDeviceManager->removeAudioSource(&m_fcdFIFO);
|
||||
}
|
||||
|
||||
void FCDProPlusInput::stop()
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "audio/audioinputdevice.h"
|
||||
#include "audio/audiofifo.h"
|
||||
|
||||
#include "fcdproplussettings.h"
|
||||
@ -148,7 +147,6 @@ public:
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
hid_device *m_dev;
|
||||
AudioInputDevice m_fcdAudioInput;
|
||||
AudioFifo m_fcdFIFO;
|
||||
QMutex m_mutex;
|
||||
FCDProPlusSettings m_settings;
|
||||
|
@ -149,8 +149,6 @@ private:
|
||||
|
||||
friend class AudioOutputPipe;
|
||||
friend class AudioInput;
|
||||
friend class FCDProInput;
|
||||
friend class FCDProPlusInput;
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
|
Loading…
Reference in New Issue
Block a user