1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-12 11:26:11 -05:00

Multiple audio support: renamed AudioDeviceInfo to AudioDeviceManager

This commit is contained in:
f4exb 2018-03-23 18:08:38 +01:00
parent f85111251b
commit e2aabde641
12 changed files with 80 additions and 77 deletions

View File

@ -3,7 +3,7 @@ project (sdrbase)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
set(sdrbase_SOURCES set(sdrbase_SOURCES
audio/audiodeviceinfo.cpp audio/audiodevicemanager.cpp
audio/audiofifo.cpp audio/audiofifo.cpp
audio/audiooutput.cpp audio/audiooutput.cpp
audio/audioinput.cpp audio/audioinput.cpp
@ -84,7 +84,7 @@ set(sdrbase_SOURCES
) )
set(sdrbase_HEADERS set(sdrbase_HEADERS
audio/audiodeviceinfo.h audio/audiodevicemanager.h
audio/audiofifo.h audio/audiofifo.h
audio/audiooutput.h audio/audiooutput.h
audio/audioinput.h audio/audioinput.h

View File

@ -15,10 +15,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "audio/audiodeviceinfo.h" #include <audio/audiodevicemanager.h>
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
AudioDeviceInfo::AudioDeviceInfo() : AudioDeviceManager::AudioDeviceManager() :
m_inputDeviceIndex(-1), // default device m_inputDeviceIndex(-1), // default device
m_outputDeviceIndex(-1), // default device m_outputDeviceIndex(-1), // default device
m_audioOutputSampleRate(48000), // Use default output device at 48 kHz m_audioOutputSampleRate(48000), // Use default output device at 48 kHz
@ -29,14 +29,14 @@ AudioDeviceInfo::AudioDeviceInfo() :
m_outputDevicesInfo = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); m_outputDevicesInfo = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
} }
void AudioDeviceInfo::resetToDefaults() void AudioDeviceManager::resetToDefaults()
{ {
m_inputDeviceIndex = -1; m_inputDeviceIndex = -1;
m_outputDeviceIndex = -1; m_outputDeviceIndex = -1;
m_inputVolume = 1.0f; m_inputVolume = 1.0f;
} }
QByteArray AudioDeviceInfo::serialize() const QByteArray AudioDeviceManager::serialize() const
{ {
SimpleSerializer s(1); SimpleSerializer s(1);
s.writeS32(1, m_inputDeviceIndex); s.writeS32(1, m_inputDeviceIndex);
@ -45,7 +45,7 @@ QByteArray AudioDeviceInfo::serialize() const
return s.final(); return s.final();
} }
bool AudioDeviceInfo::deserialize(const QByteArray& data) bool AudioDeviceManager::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);
@ -68,87 +68,87 @@ bool AudioDeviceInfo::deserialize(const QByteArray& data)
} }
} }
void AudioDeviceInfo::setInputDeviceIndex(int inputDeviceIndex) void AudioDeviceManager::setInputDeviceIndex(int inputDeviceIndex)
{ {
int nbDevices = m_inputDevicesInfo.size(); int nbDevices = m_inputDevicesInfo.size();
m_inputDeviceIndex = inputDeviceIndex < -1 ? -1 : inputDeviceIndex >= nbDevices ? nbDevices-1 : inputDeviceIndex; m_inputDeviceIndex = inputDeviceIndex < -1 ? -1 : inputDeviceIndex >= nbDevices ? nbDevices-1 : inputDeviceIndex;
} }
void AudioDeviceInfo::setOutputDeviceIndex(int outputDeviceIndex) void AudioDeviceManager::setOutputDeviceIndex(int outputDeviceIndex)
{ {
int nbDevices = m_outputDevicesInfo.size(); int nbDevices = m_outputDevicesInfo.size();
m_outputDeviceIndex = outputDeviceIndex < -1 ? -1 : outputDeviceIndex >= nbDevices ? nbDevices-1 : outputDeviceIndex; m_outputDeviceIndex = outputDeviceIndex < -1 ? -1 : outputDeviceIndex >= nbDevices ? nbDevices-1 : outputDeviceIndex;
} }
void AudioDeviceInfo::setInputVolume(float inputVolume) void AudioDeviceManager::setInputVolume(float inputVolume)
{ {
m_inputVolume = inputVolume < 0.0 ? 0.0 : inputVolume > 1.0 ? 1.0 : inputVolume; m_inputVolume = inputVolume < 0.0 ? 0.0 : inputVolume > 1.0 ? 1.0 : inputVolume;
} }
void AudioDeviceInfo::addAudioSink(AudioFifo* audioFifo) void AudioDeviceManager::addAudioSink(AudioFifo* audioFifo)
{ {
qDebug("AudioDeviceInfo::addAudioSink"); qDebug("AudioDeviceInfo::addAudioSink");
m_audioOutput.addFifo(audioFifo); m_audioOutput.addFifo(audioFifo);
} }
void AudioDeviceInfo::removeAudioSink(AudioFifo* audioFifo) void AudioDeviceManager::removeAudioSink(AudioFifo* audioFifo)
{ {
qDebug("AudioDeviceInfo::removeAudioSink"); qDebug("AudioDeviceInfo::removeAudioSink");
m_audioOutput.removeFifo(audioFifo); m_audioOutput.removeFifo(audioFifo);
} }
void AudioDeviceInfo::addAudioSource(AudioFifo* audioFifo) void AudioDeviceManager::addAudioSource(AudioFifo* audioFifo)
{ {
qDebug("AudioDeviceInfo::addAudioSource"); qDebug("AudioDeviceInfo::addAudioSource");
m_audioInput.addFifo(audioFifo); m_audioInput.addFifo(audioFifo);
} }
void AudioDeviceInfo::removeAudioSource(AudioFifo* audioFifo) void AudioDeviceManager::removeAudioSource(AudioFifo* audioFifo)
{ {
qDebug("AudioDeviceInfo::removeAudioSource"); qDebug("AudioDeviceInfo::removeAudioSource");
m_audioInput.removeFifo(audioFifo); m_audioInput.removeFifo(audioFifo);
} }
void AudioDeviceInfo::startAudioOutput() void AudioDeviceManager::startAudioOutput()
{ {
m_audioOutput.start(m_outputDeviceIndex, m_audioOutputSampleRate); m_audioOutput.start(m_outputDeviceIndex, m_audioOutputSampleRate);
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
} }
void AudioDeviceInfo::stopAudioOutput() void AudioDeviceManager::stopAudioOutput()
{ {
m_audioOutput.stop(); m_audioOutput.stop();
} }
void AudioDeviceInfo::startAudioOutputImmediate() void AudioDeviceManager::startAudioOutputImmediate()
{ {
m_audioOutput.startImmediate(m_outputDeviceIndex, m_audioOutputSampleRate); m_audioOutput.startImmediate(m_outputDeviceIndex, m_audioOutputSampleRate);
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
} }
void AudioDeviceInfo::stopAudioOutputImmediate() void AudioDeviceManager::stopAudioOutputImmediate()
{ {
m_audioOutput.stopImmediate(); m_audioOutput.stopImmediate();
} }
void AudioDeviceInfo::startAudioInput() void AudioDeviceManager::startAudioInput()
{ {
m_audioInput.start(m_inputDeviceIndex, m_audioInputSampleRate); m_audioInput.start(m_inputDeviceIndex, m_audioInputSampleRate);
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
} }
void AudioDeviceInfo::stopAudioInput() void AudioDeviceManager::stopAudioInput()
{ {
m_audioInput.stop(); m_audioInput.stop();
} }
void AudioDeviceInfo::startAudioInputImmediate() void AudioDeviceManager::startAudioInputImmediate()
{ {
m_audioInput.startImmediate(m_inputDeviceIndex, m_audioInputSampleRate); m_audioInput.startImmediate(m_inputDeviceIndex, m_audioInputSampleRate);
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
} }
void AudioDeviceInfo::stopAudioInputImmediate() void AudioDeviceManager::stopAudioInputImmediate()
{ {
m_audioInput.stopImmediate(); m_audioInput.stopImmediate();
} }

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_AUDIODEVICEINFO_H #ifndef INCLUDE_AUDIODEVICEMANGER_H
#define INCLUDE_AUDIODEVICEINFO_H #define INCLUDE_AUDIODEVICEMANGER_H
#include <QStringList> #include <QStringList>
#include <QList> #include <QList>
@ -28,9 +28,9 @@
class AudioFifo; class AudioFifo;
class SDRBASE_API AudioDeviceInfo { class SDRBASE_API AudioDeviceManager {
public: public:
AudioDeviceInfo(); AudioDeviceManager();
const QList<QAudioDeviceInfo>& getInputDevices() const { return m_inputDevicesInfo; } const QList<QAudioDeviceInfo>& getInputDevices() const { return m_inputDevicesInfo; }
const QList<QAudioDeviceInfo>& getOutputDevices() const { return m_outputDevicesInfo; } const QList<QAudioDeviceInfo>& getOutputDevices() const { return m_outputDevicesInfo; }
@ -81,4 +81,4 @@ private:
friend class MainSettings; friend class MainSettings;
}; };
#endif // INCLUDE_AUDIODEVICEINFO_H #endif // INCLUDE_AUDIODEVICEMANGER_H

View File

@ -18,11 +18,11 @@
#ifndef INCLUDE_DSPENGINE_H #ifndef INCLUDE_DSPENGINE_H
#define INCLUDE_DSPENGINE_H #define INCLUDE_DSPENGINE_H
#include <audio/audiodevicemanager.h>
#include <QObject> #include <QObject>
#include <QTimer> #include <QTimer>
#include <vector> #include <vector>
#include "audio/audiodeviceinfo.h"
#include "audio/audiooutput.h" #include "audio/audiooutput.h"
#include "audio/audioinput.h" #include "audio/audioinput.h"
#include "export.h" #include "export.h"
@ -49,7 +49,7 @@ public:
DSPDeviceSinkEngine *addDeviceSinkEngine(); DSPDeviceSinkEngine *addDeviceSinkEngine();
void removeLastDeviceSinkEngine(); void removeLastDeviceSinkEngine();
AudioDeviceInfo *getAudioDeviceInfo() { return &m_audioDeviceInfo; } AudioDeviceManager *getAudioDeviceManager() { return &m_audioDeviceManager; }
void startAudioOutput(); void startAudioOutput();
void stopAudioOutput(); void stopAudioOutput();
void startAudioOutputImmediate(); void startAudioOutputImmediate();
@ -95,7 +95,7 @@ private:
uint m_deviceSourceEnginesUIDSequence; uint m_deviceSourceEnginesUIDSequence;
std::vector<DSPDeviceSinkEngine*> m_deviceSinkEngines; std::vector<DSPDeviceSinkEngine*> m_deviceSinkEngines;
uint m_deviceSinkEnginesUIDSequence; uint m_deviceSinkEnginesUIDSequence;
AudioDeviceInfo m_audioDeviceInfo; AudioDeviceManager m_audioDeviceManager;
AudioOutput m_audioOutput; AudioOutput m_audioOutput;
AudioInput m_audioInput; AudioInput m_audioInput;
uint m_audioOutputSampleRate; uint m_audioOutputSampleRate;

View File

@ -4,7 +4,7 @@
#include "settings/mainsettings.h" #include "settings/mainsettings.h"
#include "commands/command.h" #include "commands/command.h"
MainSettings::MainSettings() : m_audioDeviceInfo(0) MainSettings::MainSettings() : m_audioDeviceManager(0)
{ {
resetToDefaults(); resetToDefaults();
} }
@ -29,9 +29,9 @@ void MainSettings::load()
m_preferences.deserialize(qUncompress(QByteArray::fromBase64(s.value("preferences").toByteArray()))); m_preferences.deserialize(qUncompress(QByteArray::fromBase64(s.value("preferences").toByteArray())));
m_workingPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current").toByteArray()))); m_workingPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current").toByteArray())));
if (m_audioDeviceInfo) if (m_audioDeviceManager)
{ {
m_audioDeviceInfo->deserialize(qUncompress(QByteArray::fromBase64(s.value("audio").toByteArray()))); m_audioDeviceManager->deserialize(qUncompress(QByteArray::fromBase64(s.value("audio").toByteArray())));
} }
QStringList groups = s.childGroups(); QStringList groups = s.childGroups();
@ -80,9 +80,9 @@ void MainSettings::save() const
s.setValue("preferences", qCompress(m_preferences.serialize()).toBase64()); s.setValue("preferences", qCompress(m_preferences.serialize()).toBase64());
s.setValue("current", qCompress(m_workingPreset.serialize()).toBase64()); s.setValue("current", qCompress(m_workingPreset.serialize()).toBase64());
if (m_audioDeviceInfo) if (m_audioDeviceManager)
{ {
s.setValue("audio", qCompress(m_audioDeviceInfo->serialize()).toBase64()); s.setValue("audio", qCompress(m_audioDeviceManager->serialize()).toBase64());
} }
QStringList groups = s.childGroups(); QStringList groups = s.childGroups();

View File

@ -1,10 +1,10 @@
#ifndef INCLUDE_SETTINGS_H #ifndef INCLUDE_SETTINGS_H
#define INCLUDE_SETTINGS_H #define INCLUDE_SETTINGS_H
#include <audio/audiodevicemanager.h>
#include <QString> #include <QString>
#include "preferences.h" #include "preferences.h"
#include "preset.h" #include "preset.h"
#include "audio/audiodeviceinfo.h"
#include "export.h" #include "export.h"
class Command; class Command;
@ -57,12 +57,12 @@ public:
bool getUseLogFile() const { return m_preferences.getUseLogFile(); } bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
const QString& getLogFileName() const { return m_preferences.getLogFileName(); } const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
const AudioDeviceInfo *getAudioDeviceInfo() const { return m_audioDeviceInfo; } const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
void setAudioDeviceInfo(AudioDeviceInfo *audioDeviceInfo) { m_audioDeviceInfo = audioDeviceInfo; } void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
protected: protected:
Preferences m_preferences; Preferences m_preferences;
AudioDeviceInfo *m_audioDeviceInfo; AudioDeviceManager *m_audioDeviceManager;
Preset m_workingPreset; Preset m_workingPreset;
typedef QList<Preset*> Presets; typedef QList<Preset*> Presets;
Presets m_presets; Presets m_presets;

View File

@ -1,9 +1,10 @@
#include <gui/audiodialog.h> #include <gui/audiodialog.h>
#include <audio/audiodevicemanager.h>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include "ui_audiodialog.h" #include "ui_audiodialog.h"
#include "audio/audiodeviceinfo.h"
AudioDialog::AudioDialog(AudioDeviceInfo* audioDeviceInfo, QWidget* parent) : AudioDialog::AudioDialog(AudioDeviceManager* audioDeviceInfo, QWidget* parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::AudioDialog), ui(new Ui::AudioDialog),
m_audioDeviceInfo(audioDeviceInfo) m_audioDeviceInfo(audioDeviceInfo)

View File

@ -5,7 +5,7 @@
#include "export.h" #include "export.h"
class AudioDeviceInfo; class AudioDeviceManager;
namespace Ui { namespace Ui {
class AudioDialog; class AudioDialog;
@ -15,13 +15,13 @@ class SDRGUI_API AudioDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit AudioDialog(AudioDeviceInfo* audioDeviceInfo, QWidget* parent = NULL); explicit AudioDialog(AudioDeviceManager* audioDeviceInfo, QWidget* parent = NULL);
~AudioDialog(); ~AudioDialog();
private: private:
Ui::AudioDialog* ui; Ui::AudioDialog* ui;
AudioDeviceInfo* m_audioDeviceInfo; AudioDeviceManager* m_audioDeviceInfo;
float m_inputVolume; float m_inputVolume;
private slots: private slots:

View File

@ -34,7 +34,6 @@
#include "device/devicesinkapi.h" #include "device/devicesinkapi.h"
#include "device/deviceuiset.h" #include "device/deviceuiset.h"
#include "device/deviceenumerator.h" #include "device/deviceenumerator.h"
#include "audio/audiodeviceinfo.h"
#include "gui/indicator.h" #include "gui/indicator.h"
#include "gui/presetitem.h" #include "gui/presetitem.h"
#include "gui/commanditem.h" #include "gui/commanditem.h"
@ -64,6 +63,9 @@
#include "commands/command.h" #include "commands/command.h"
#include "mainwindow.h" #include "mainwindow.h"
#include <audio/audiodevicemanager.h>
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <string> #include <string>
@ -97,7 +99,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
qDebug() << "MainWindow::MainWindow: start"; qDebug() << "MainWindow::MainWindow: start";
m_instance = this; m_instance = this;
m_settings.setAudioDeviceInfo(m_dspEngine->getAudioDeviceInfo()); m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
ui->setupUi(this); ui->setupUi(this);
createStatusBar(); createStatusBar();
@ -1412,11 +1414,11 @@ void MainWindow::on_action_Loaded_Plugins_triggered()
void MainWindow::on_action_Audio_triggered() void MainWindow::on_action_Audio_triggered()
{ {
AudioDialog audioDialog(m_dspEngine->getAudioDeviceInfo(), this); AudioDialog audioDialog(m_dspEngine->getAudioDeviceManager(), this);
audioDialog.exec(); audioDialog.exec();
m_dspEngine->setAudioInputVolume(m_dspEngine->getAudioDeviceInfo()->getInputVolume()); m_dspEngine->setAudioInputVolume(m_dspEngine->getAudioDeviceManager()->getInputVolume());
m_dspEngine->setAudioInputDeviceIndex(m_dspEngine->getAudioDeviceInfo()->getInputDeviceIndex()); m_dspEngine->setAudioInputDeviceIndex(m_dspEngine->getAudioDeviceManager()->getInputDeviceIndex());
m_dspEngine->setAudioOutputDeviceIndex(m_dspEngine->getAudioDeviceInfo()->getOutputDeviceIndex()); m_dspEngine->setAudioOutputDeviceIndex(m_dspEngine->getAudioDeviceManager()->getOutputDeviceIndex());
} }
void MainWindow::on_action_Logging_triggered() void MainWindow::on_action_Logging_triggered()

View File

@ -227,17 +227,17 @@ int WebAPIAdapterGUI::instanceAudioGet(
SWGSDRangel::SWGAudioDevices& response, SWGSDRangel::SWGAudioDevices& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputDevices(); const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getOutputDevices(); const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDevices();
int nbInputDevices = audioInputDevices.size(); int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size(); int nbOutputDevices = audioOutputDevices.size();
response.init(); response.init();
response.setNbInputDevices(nbInputDevices); response.setNbInputDevices(nbInputDevices);
response.setInputDeviceSelectedIndex(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputDeviceIndex()); response.setInputDeviceSelectedIndex(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceIndex());
response.setNbOutputDevices(nbOutputDevices); response.setNbOutputDevices(nbOutputDevices);
response.setOutputDeviceSelectedIndex(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getOutputDeviceIndex()); response.setOutputDeviceSelectedIndex(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceIndex());
response.setInputVolume(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputVolume()); response.setInputVolume(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputVolume());
QList<SWGSDRangel::SWGAudioDevice*> *inputDevices = response.getInputDevices(); QList<SWGSDRangel::SWGAudioDevice*> *inputDevices = response.getInputDevices();
QList<SWGSDRangel::SWGAudioDevice*> *outputDevices = response.getOutputDevices(); QList<SWGSDRangel::SWGAudioDevice*> *outputDevices = response.getOutputDevices();
@ -267,8 +267,8 @@ int WebAPIAdapterGUI::instanceAudioPatch(
int inputIndex = response.getInputIndex(); int inputIndex = response.getInputIndex();
int outputIndex = response.getOutputIndex(); int outputIndex = response.getOutputIndex();
const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputDevices(); const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getOutputDevices(); const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDevices();
int nbInputDevices = audioInputDevices.size(); int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size(); int nbOutputDevices = audioOutputDevices.size();
@ -276,17 +276,17 @@ int WebAPIAdapterGUI::instanceAudioPatch(
inputIndex = inputIndex < -1 ? -1 : inputIndex > nbInputDevices ? nbInputDevices-1 : inputIndex; inputIndex = inputIndex < -1 ? -1 : inputIndex > nbInputDevices ? nbInputDevices-1 : inputIndex;
outputIndex = outputIndex < -1 ? -1 : outputIndex > nbOutputDevices ? nbOutputDevices-1 : outputIndex; outputIndex = outputIndex < -1 ? -1 : outputIndex > nbOutputDevices ? nbOutputDevices-1 : outputIndex;
m_mainWindow.m_dspEngine->getAudioDeviceInfo()->setInputVolume(inputVolume); m_mainWindow.m_dspEngine->getAudioDeviceManager()->setInputVolume(inputVolume);
m_mainWindow.m_dspEngine->getAudioDeviceInfo()->setInputDeviceIndex(inputIndex); m_mainWindow.m_dspEngine->getAudioDeviceManager()->setInputDeviceIndex(inputIndex);
m_mainWindow.m_dspEngine->getAudioDeviceInfo()->setOutputDeviceIndex(outputIndex); m_mainWindow.m_dspEngine->getAudioDeviceManager()->setOutputDeviceIndex(outputIndex);
m_mainWindow.m_dspEngine->setAudioInputVolume(inputVolume); m_mainWindow.m_dspEngine->setAudioInputVolume(inputVolume);
m_mainWindow.m_dspEngine->setAudioInputDeviceIndex(inputIndex); m_mainWindow.m_dspEngine->setAudioInputDeviceIndex(inputIndex);
m_mainWindow.m_dspEngine->setAudioOutputDeviceIndex(outputIndex); m_mainWindow.m_dspEngine->setAudioOutputDeviceIndex(outputIndex);
response.setInputVolume(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputVolume()); response.setInputVolume(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputVolume());
response.setInputIndex(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getInputDeviceIndex()); response.setInputIndex(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceIndex());
response.setOutputIndex(m_mainWindow.m_dspEngine->getAudioDeviceInfo()->getOutputDeviceIndex()); response.setOutputIndex(m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceIndex());
return 200; return 200;
} }

View File

@ -59,7 +59,7 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
qDebug() << "MainCore::MainCore: start"; qDebug() << "MainCore::MainCore: start";
m_instance = this; m_instance = this;
m_settings.setAudioDeviceInfo(m_dspEngine->getAudioDeviceInfo()); m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
m_pluginManager = new PluginManager(this); m_pluginManager = new PluginManager(this);
m_pluginManager->loadPlugins(QString("pluginssrv")); m_pluginManager->loadPlugins(QString("pluginssrv"));

View File

@ -228,17 +228,17 @@ int WebAPIAdapterSrv::instanceAudioGet(
SWGSDRangel::SWGAudioDevices& response, SWGSDRangel::SWGAudioDevices& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
const QList<QAudioDeviceInfo>& audioInputDevices = m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputDevices(); const QList<QAudioDeviceInfo>& audioInputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainCore.m_dspEngine->getAudioDeviceInfo()->getOutputDevices(); const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDevices();
int nbInputDevices = audioInputDevices.size(); int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size(); int nbOutputDevices = audioOutputDevices.size();
response.init(); response.init();
response.setNbInputDevices(nbInputDevices); response.setNbInputDevices(nbInputDevices);
response.setInputDeviceSelectedIndex(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputDeviceIndex()); response.setInputDeviceSelectedIndex(m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceIndex());
response.setNbOutputDevices(nbOutputDevices); response.setNbOutputDevices(nbOutputDevices);
response.setOutputDeviceSelectedIndex(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getOutputDeviceIndex()); response.setOutputDeviceSelectedIndex(m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceIndex());
response.setInputVolume(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputVolume()); response.setInputVolume(m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputVolume());
QList<SWGSDRangel::SWGAudioDevice*> *inputDevices = response.getInputDevices(); QList<SWGSDRangel::SWGAudioDevice*> *inputDevices = response.getInputDevices();
QList<SWGSDRangel::SWGAudioDevice*> *outputDevices = response.getOutputDevices(); QList<SWGSDRangel::SWGAudioDevice*> *outputDevices = response.getOutputDevices();
@ -268,8 +268,8 @@ int WebAPIAdapterSrv::instanceAudioPatch(
int inputIndex = response.getInputIndex(); int inputIndex = response.getInputIndex();
int outputIndex = response.getOutputIndex(); int outputIndex = response.getOutputIndex();
const QList<QAudioDeviceInfo>& audioInputDevices = m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputDevices(); const QList<QAudioDeviceInfo>& audioInputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainCore.m_dspEngine->getAudioDeviceInfo()->getOutputDevices(); const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDevices();
int nbInputDevices = audioInputDevices.size(); int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size(); int nbOutputDevices = audioOutputDevices.size();
@ -277,17 +277,17 @@ int WebAPIAdapterSrv::instanceAudioPatch(
inputIndex = inputIndex < -1 ? -1 : inputIndex > nbInputDevices ? nbInputDevices-1 : inputIndex; inputIndex = inputIndex < -1 ? -1 : inputIndex > nbInputDevices ? nbInputDevices-1 : inputIndex;
outputIndex = outputIndex < -1 ? -1 : outputIndex > nbOutputDevices ? nbOutputDevices-1 : outputIndex; outputIndex = outputIndex < -1 ? -1 : outputIndex > nbOutputDevices ? nbOutputDevices-1 : outputIndex;
m_mainCore.m_dspEngine->getAudioDeviceInfo()->setInputVolume(inputVolume); m_mainCore.m_dspEngine->getAudioDeviceManager()->setInputVolume(inputVolume);
m_mainCore.m_dspEngine->getAudioDeviceInfo()->setInputDeviceIndex(inputIndex); m_mainCore.m_dspEngine->getAudioDeviceManager()->setInputDeviceIndex(inputIndex);
m_mainCore.m_dspEngine->getAudioDeviceInfo()->setOutputDeviceIndex(outputIndex); m_mainCore.m_dspEngine->getAudioDeviceManager()->setOutputDeviceIndex(outputIndex);
m_mainCore.m_dspEngine->setAudioInputVolume(inputVolume); m_mainCore.m_dspEngine->setAudioInputVolume(inputVolume);
m_mainCore.m_dspEngine->setAudioInputDeviceIndex(inputIndex); m_mainCore.m_dspEngine->setAudioInputDeviceIndex(inputIndex);
m_mainCore.m_dspEngine->setAudioOutputDeviceIndex(outputIndex); m_mainCore.m_dspEngine->setAudioOutputDeviceIndex(outputIndex);
response.setInputVolume(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputVolume()); response.setInputVolume(m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputVolume());
response.setInputIndex(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getInputDeviceIndex()); response.setInputIndex(m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceIndex());
response.setOutputIndex(m_mainCore.m_dspEngine->getAudioDeviceInfo()->getOutputDeviceIndex()); response.setOutputIndex(m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceIndex());
return 200; return 200;
} }