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

Implemented connection from device sample source/sink to GUI input message queue

This commit is contained in:
f4exb 2017-09-16 23:44:00 +02:00
parent 2b4f8a0f55
commit c83b6e61d5
4 changed files with 21 additions and 7 deletions

View File

@ -42,7 +42,9 @@ public:
virtual bool handleMessage(const Message& message) = 0; virtual bool handleMessage(const Message& message) = 0;
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } // TODO: remove
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; } SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
protected slots: protected slots:
@ -51,7 +53,8 @@ protected slots:
protected: protected:
SampleSourceFifo m_sampleSourceFifo; SampleSourceFifo m_sampleSourceFifo;
MessageQueue m_inputMessageQueue; //!< Input queue to the sink MessageQueue m_inputMessageQueue; //!< Input queue to the sink
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the sink GUI MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the sink GUI // TODO: remove
}; };
#endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */ #endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany // // Copyright (C) 2015-2017 F4EXB //
// written by Christian Daniel // // written by Edouard Griffiths //
// // // //
// This program is free software; you can redistribute it and/or modify // // This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by // // it under the terms of the GNU General Public License as published by //
@ -17,7 +17,8 @@
#include <dsp/devicesamplesource.h> #include <dsp/devicesamplesource.h>
DeviceSampleSource::DeviceSampleSource() DeviceSampleSource::DeviceSampleSource() :
m_guiMessageQueue(0)
{ {
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
} }

View File

@ -42,7 +42,9 @@ public:
virtual bool handleMessage(const Message& message) = 0; virtual bool handleMessage(const Message& message) = 0;
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; } // TODO: remove
SampleSinkFifo* getSampleFifo() { return &m_sampleFifo; } SampleSinkFifo* getSampleFifo() { return &m_sampleFifo; }
protected slots: protected slots:
@ -51,7 +53,8 @@ protected slots:
protected: protected:
SampleSinkFifo m_sampleFifo; SampleSinkFifo m_sampleFifo;
MessageQueue m_inputMessageQueue; //!< Input queue to the source MessageQueue m_inputMessageQueue; //!< Input queue to the source
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI // TODO: remove
}; };
#endif // INCLUDE_SAMPLESOURCE_H #endif // INCLUDE_SAMPLESOURCE_H

View File

@ -45,6 +45,8 @@
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "dsp/spectrumvis.h" #include "dsp/spectrumvis.h"
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "dsp/devicesamplesource.h"
#include "dsp/devicesamplesink.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/glspectrum.h" #include "gui/glspectrum.h"
#include "gui/glspectrumgui.h" #include "gui/glspectrumgui.h"
@ -146,6 +148,7 @@ MainWindow::MainWindow(QWidget* parent) :
QWidget *gui; QWidget *gui;
PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI( PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI); m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI);
setDeviceGUI(0, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName()); setDeviceGUI(0, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName());
@ -229,6 +232,7 @@ void MainWindow::addSourceDevice()
QWidget *gui; QWidget *gui;
PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI( PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI); m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI);
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName()); setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName());
@ -284,6 +288,7 @@ void MainWindow::addSinkDevice()
QWidget *gui; QWidget *gui;
PluginInstanceUI *pluginUI = m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI( PluginInstanceUI *pluginUI = m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkId(), &gui, m_deviceUIs.back()->m_deviceSinkAPI); m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkId(), &gui, m_deviceUIs.back()->m_deviceSinkAPI);
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSink()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI); m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI);
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkDisplayName(), false); setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkDisplayName(), false);
} }
@ -887,6 +892,7 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus
QWidget *gui; QWidget *gui;
PluginInstanceUI *pluginUI = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI( PluginInstanceUI *pluginUI = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
deviceUI->m_deviceSourceAPI->getSampleSourceId(), &gui, deviceUI->m_deviceSourceAPI); deviceUI->m_deviceSourceAPI->getSampleSourceId(), &gui, deviceUI->m_deviceSourceAPI);
deviceUI->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginUI); deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginUI);
setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName()); setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName());
@ -964,6 +970,7 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked __attribute__((unused
QWidget *gui; QWidget *gui;
PluginInstanceUI *pluginUI = deviceUI->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI( PluginInstanceUI *pluginUI = deviceUI->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
deviceUI->m_deviceSinkAPI->getSampleSinkId(), &gui, deviceUI->m_deviceSinkAPI); deviceUI->m_deviceSinkAPI->getSampleSinkId(), &gui, deviceUI->m_deviceSinkAPI);
deviceUI->m_deviceSinkAPI->getSampleSink()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI); deviceUI->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI);
setDeviceGUI(currentSinkTabIndex, gui, deviceUI->m_deviceSinkAPI->getSampleSinkDisplayName(), false); setDeviceGUI(currentSinkTabIndex, gui, deviceUI->m_deviceSinkAPI->getSampleSinkDisplayName(), false);