diff --git a/doc/img/LocalSink.png b/doc/img/LocalSink.png index 7fc53133b..dec1912ac 100644 Binary files a/doc/img/LocalSink.png and b/doc/img/LocalSink.png differ diff --git a/doc/img/LocalSink.xcf b/doc/img/LocalSink.xcf index 533e62ecf..a8e17bdfe 100644 Binary files a/doc/img/LocalSink.xcf and b/doc/img/LocalSink.xcf differ diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index 93bfeb64e..b0e7d3684 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -34,6 +34,7 @@ #include "dsp/hbfilterchainconverter.h" #include "dsp/devicesamplemimo.h" #include "device/deviceapi.h" +#include "device/deviceset.h" #include "feature/feature.h" #include "settings/serializable.h" #include "maincore.h" @@ -42,6 +43,7 @@ #include "localsink.h" MESSAGE_CLASS_DEFINITION(LocalSink::MsgConfigureLocalSink, Message) +MESSAGE_CLASS_DEFINITION(LocalSink::MsgReportDevices, Message) const char* const LocalSink::m_channelIdURI = "sdrangel.channel.localsink"; const char* const LocalSink::m_channelId = "LocalSink"; @@ -75,7 +77,19 @@ LocalSink::LocalSink(DeviceAPI *deviceAPI) : this, &LocalSink::handleIndexInDeviceSetChanged ); - start(); + // Update device list when devices are added or removed + QObject::connect( + MainCore::instance(), + &MainCore::deviceSetAdded, + this, + &LocalSink::updateDeviceSetList + ); + QObject::connect( + MainCore::instance(), + &MainCore::deviceSetRemoved, + this, + &LocalSink::updateDeviceSetList + ); } LocalSink::~LocalSink() @@ -89,7 +103,7 @@ LocalSink::~LocalSink() delete m_networkManager; m_deviceAPI->removeChannelSinkAPI(this); m_deviceAPI->removeChannelSink(this); - stop(); + stopProcessing(); } void LocalSink::setDeviceAPI(DeviceAPI *deviceAPI) @@ -119,12 +133,18 @@ void LocalSink::feed(const SampleVector::const_iterator& begin, const SampleVect } void LocalSink::start() +{ } + +void LocalSink::stop() +{ } + +void LocalSink::startProcessing() { if (m_running) { return; } - qDebug("LocalSink::start"); + qDebug("LocalSink::startProcessing"); m_thread = new QThread(this); m_basebandSink = new LocalSinkBaseband(); m_basebandSink->moveToThread(m_thread); @@ -135,19 +155,24 @@ void LocalSink::start() m_basebandSink->reset(); m_thread->start(); - LocalSinkBaseband::MsgConfigureLocalSinkBaseband *msg = LocalSinkBaseband::MsgConfigureLocalSinkBaseband::create(m_settings, true); - m_basebandSink->getInputMessageQueue()->push(msg); + DeviceSampleSource *deviceSource = getLocalDevice(m_settings.m_localDeviceIndex); + LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource *msgDevice = + LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource::create(deviceSource); + m_basebandSink->getInputMessageQueue()->push(msgDevice); + + LocalSinkBaseband::MsgConfigureLocalSinkBaseband *msgConfig = LocalSinkBaseband::MsgConfigureLocalSinkBaseband::create(m_settings, true); + m_basebandSink->getInputMessageQueue()->push(msgConfig); m_running = true; } -void LocalSink::stop() +void LocalSink::stopProcessing() { if (!m_running) { return; } - qDebug("LocalSink::stop"); + qDebug("LocalSink::stopProcessing"); m_running = false; m_thread->exit(); m_thread->wait(); @@ -218,27 +243,15 @@ bool LocalSink::deserialize(const QByteArray& data) } } -void LocalSink::getLocalDevices(std::vector& indexes) +DeviceSampleSource *LocalSink::getLocalDevice(int index) { - indexes.clear(); - DSPEngine *dspEngine = DSPEngine::instance(); - - for (uint32_t i = 0; i < dspEngine->getDeviceSourceEnginesNumber(); i++) - { - DSPDeviceSourceEngine *deviceSourceEngine = dspEngine->getDeviceSourceEngineByIndex(i); - DeviceSampleSource *deviceSource = deviceSourceEngine->getSource(); - - if (deviceSource->getDeviceDescription() == "LocalInput") { - indexes.push_back(i); - } + if (index < 0) { + return nullptr; } -} -DeviceSampleSource *LocalSink::getLocalDevice(uint32_t index) -{ DSPEngine *dspEngine = DSPEngine::instance(); - if (index < dspEngine->getDeviceSourceEnginesNumber()) + if (index < (int) dspEngine->getDeviceSourceEnginesNumber()) { DSPDeviceSourceEngine *deviceSourceEngine = dspEngine->getDeviceSourceEngineByIndex(index); DeviceSampleSource *deviceSource = deviceSourceEngine->getSource(); @@ -266,7 +279,7 @@ DeviceSampleSource *LocalSink::getLocalDevice(uint32_t index) return nullptr; } -void LocalSink::propagateSampleRateAndFrequency(uint32_t index, uint32_t log2Decim) +void LocalSink::propagateSampleRateAndFrequency(int index, uint32_t log2Decim) { qDebug() << "LocalSink::propagateSampleRateAndFrequency:" << " index: " << index @@ -329,10 +342,10 @@ void LocalSink::applySettings(const LocalSinkSettings& settings, bool force) { reverseAPIKeys.append("play"); - if (m_running) - { - LocalSinkBaseband::MsgConfigureLocalSinkWork *msg = LocalSinkBaseband::MsgConfigureLocalSinkWork::create(settings.m_play); - m_basebandSink->getInputMessageQueue()->push(msg); + if (settings.m_play) { + startProcessing(); + } else { + stopProcessing(); } } @@ -682,3 +695,67 @@ void LocalSink::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +void LocalSink::updateDeviceSetList() +{ + MainCore *mainCore = MainCore::instance(); + std::vector& deviceSets = mainCore->getDeviceSets(); + std::vector::const_iterator it = deviceSets.begin(); + + m_localInputDeviceIndexes.clear(); + unsigned int deviceIndex = 0; + + for (; it != deviceSets.end(); ++it, deviceIndex++) + { + DSPDeviceSourceEngine *deviceSourceEngine = (*it)->m_deviceSourceEngine; + + if (deviceSourceEngine) + { + DeviceSampleSource *deviceSource = deviceSourceEngine->getSource(); + + if (deviceSource->getDeviceDescription() == "LocalInput") { + m_localInputDeviceIndexes.append(deviceIndex); + } + } + } + + if (m_guiMessageQueue) + { + MsgReportDevices *msg = MsgReportDevices::create(); + msg->getDeviceSetIndexes() = m_localInputDeviceIndexes; + m_guiMessageQueue->push(msg); + } + + LocalSinkSettings settings = m_settings; + int newIndexInList; + + if (it != deviceSets.begin()) + { + if (m_settings.m_localDeviceIndex < 0) { + newIndexInList = 0; + } else if (m_settings.m_localDeviceIndex >= m_localInputDeviceIndexes.size()) { + newIndexInList = m_localInputDeviceIndexes.size() - 1; + } else { + newIndexInList = m_settings.m_localDeviceIndex; + } + } + else + { + newIndexInList = -1; + } + + if (newIndexInList < 0) { + settings.m_localDeviceIndex = -1; // means no device + } else { + settings.m_localDeviceIndex = m_localInputDeviceIndexes[newIndexInList]; + } + + qDebug("LocalSink::updateDeviceSetLists: new device index: %d device: %d", newIndexInList, settings.m_localDeviceIndex); + applySettings(settings); + + if (m_guiMessageQueue) + { + MsgConfigureLocalSink *msg = MsgConfigureLocalSink::create(m_settings, false); + m_guiMessageQueue->push(msg); + } +} diff --git a/plugins/channelrx/localsink/localsink.h b/plugins/channelrx/localsink/localsink.h index cc21ed061..75bd5c27a 100644 --- a/plugins/channelrx/localsink/localsink.h +++ b/plugins/channelrx/localsink/localsink.h @@ -45,8 +45,7 @@ public: const LocalSinkSettings& getSettings() const { return m_settings; } bool getForce() const { return m_force; } - static MsgConfigureLocalSink* create(const LocalSinkSettings& settings, bool force) - { + static MsgConfigureLocalSink* create(const LocalSinkSettings& settings, bool force) { return new MsgConfigureLocalSink(settings, force); } @@ -61,6 +60,24 @@ public: { } }; + class MsgReportDevices : public Message { + MESSAGE_CLASS_DECLARATION + + public: + QList& getDeviceSetIndexes() { return m_deviceSetIndexes; } + + static MsgReportDevices* create() { + return new MsgReportDevices(); + } + + private: + QList m_deviceSetIndexes; + + MsgReportDevices() : + Message() + { } + }; + LocalSink(DeviceAPI *deviceAPI); virtual ~LocalSink(); virtual void destroy() { delete this; } @@ -116,8 +133,8 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - void getLocalDevices(std::vector& indexes); uint32_t getNumberOfDeviceStreams() const; + const QList& getDeviceSetList() { return m_localInputDeviceIndexes; } static const char* const m_channelIdURI; static const char* const m_channelId; @@ -128,6 +145,7 @@ private: LocalSinkBaseband *m_basebandSink; bool m_running; LocalSinkSettings m_settings; + QList m_localInputDeviceIndexes; uint64_t m_centerFrequency; int64_t m_frequencyOffset; @@ -138,10 +156,13 @@ private: virtual bool handleMessage(const Message& cmd); void applySettings(const LocalSinkSettings& settings, bool force = false); - void propagateSampleRateAndFrequency(uint32_t index, uint32_t log2Decim); + void propagateSampleRateAndFrequency(int index, uint32_t log2Decim); static void validateFilterChainHash(LocalSinkSettings& settings); void calculateFrequencyOffset(uint32_t log2Decim, uint32_t filterChainHash); - DeviceSampleSource *getLocalDevice(uint32_t index); + void updateDeviceSetList(); + DeviceSampleSource *getLocalDevice(int index); + void startProcessing(); + void stopProcessing(); void webapiReverseSendSettings(QList& channelSettingsKeys, const LocalSinkSettings& settings, bool force); void sendChannelSettings( diff --git a/plugins/channelrx/localsink/localsinkbaseband.cpp b/plugins/channelrx/localsink/localsinkbaseband.cpp index e53cb31c8..10ccc2633 100644 --- a/plugins/channelrx/localsink/localsinkbaseband.cpp +++ b/plugins/channelrx/localsink/localsinkbaseband.cpp @@ -24,7 +24,6 @@ #include "localsinkbaseband.h" MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message) -MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkWork, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message) LocalSinkBaseband::LocalSinkBaseband() : @@ -43,10 +42,12 @@ LocalSinkBaseband::LocalSinkBaseband() : ); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); + m_sink.start(m_localSampleSource); } LocalSinkBaseband::~LocalSinkBaseband() { + m_sink.stop(); delete m_channelizer; } @@ -123,20 +124,6 @@ bool LocalSinkBaseband::handleMessage(const Message& cmd) return true; } - else if (MsgConfigureLocalSinkWork::match(cmd)) - { - QMutexLocker mutexLocker(&m_mutex); - MsgConfigureLocalSinkWork& conf = (MsgConfigureLocalSinkWork&) cmd; - qDebug() << "LocalSinkBaseband::handleMessage: MsgConfigureLocalSinkWork: " << conf.isWorking(); - - if (conf.isWorking()) { - m_sink.start(m_localSampleSource); - } else { - m_sink.stop(); - } - - return true; - } else if (MsgConfigureLocalDeviceSampleSource::match(cmd)) { QMutexLocker mutexLocker(&m_mutex); diff --git a/plugins/channelrx/localsink/localsinkbaseband.h b/plugins/channelrx/localsink/localsinkbaseband.h index 00b5e1946..5a520ef81 100644 --- a/plugins/channelrx/localsink/localsinkbaseband.h +++ b/plugins/channelrx/localsink/localsinkbaseband.h @@ -57,26 +57,6 @@ public: { } }; - class MsgConfigureLocalSinkWork : public Message { - MESSAGE_CLASS_DECLARATION - - public: - bool isWorking() const { return m_working; } - - static MsgConfigureLocalSinkWork* create(bool working) - { - return new MsgConfigureLocalSinkWork(working); - } - - private: - bool m_working; - - MsgConfigureLocalSinkWork(bool working) : - Message(), - m_working(working) - { } - }; - class MsgConfigureLocalDeviceSampleSource : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channelrx/localsink/localsinkgui.cpp b/plugins/channelrx/localsink/localsinkgui.cpp index f73bcce3d..162c49220 100644 --- a/plugins/channelrx/localsink/localsinkgui.cpp +++ b/plugins/channelrx/localsink/localsinkgui.cpp @@ -22,7 +22,6 @@ #include "gui/devicestreamselectiondialog.h" #include "dsp/hbfilterchainconverter.h" #include "dsp/dspcommands.h" -#include "mainwindow.h" #include "localsinkgui.h" #include "localsink.h" @@ -53,7 +52,6 @@ QByteArray LocalSinkGUI::serialize() const bool LocalSinkGUI::deserialize(const QByteArray& data) { - updateLocalDevices(); if (m_settings.deserialize(data)) { @@ -90,6 +88,12 @@ bool LocalSinkGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (LocalSink::MsgReportDevices::match(message)) + { + LocalSink::MsgReportDevices& report = (LocalSink::MsgReportDevices&) message; + updateDeviceSetList(report.getDeviceSetIndexes()); + return true; + } else { return false; @@ -131,7 +135,7 @@ LocalSinkGUI::LocalSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); - updateLocalDevices(); + updateDeviceSetList(m_localSink->getDeviceSetList()); displaySettings(); makeUIConnections(); applySettings(true); @@ -199,18 +203,6 @@ void LocalSinkGUI::displayRateAndShift() m_channelMarker.setBandwidth(channelSampleRate); } -void LocalSinkGUI::updateLocalDevices() -{ - std::vector localDevicesIndexes; - m_localSink->getLocalDevices(localDevicesIndexes); - ui->localDevice->clear(); - std::vector::const_iterator it = localDevicesIndexes.begin(); - - for (; it != localDevicesIndexes.end(); ++it) { - ui->localDevice->addItem(tr("%1").arg(*it), QVariant(*it)); - } -} - int LocalSinkGUI::getLocalDeviceIndexInCombo(int localDeviceIndex) { int index = 0; @@ -224,7 +216,6 @@ int LocalSinkGUI::getLocalDeviceIndexInCombo(int localDeviceIndex) return -1; } - void LocalSinkGUI::leaveEvent(QEvent* event) { m_channelMarker.setHighlighted(false); @@ -243,8 +234,7 @@ void LocalSinkGUI::handleSourceMessages() while ((message = getInputMessageQueue()->pop()) != 0) { - if (handleMessage(*message)) - { + if (handleMessage(*message)) { delete message; } } @@ -306,6 +296,21 @@ void LocalSinkGUI::onMenuDialogCalled(const QPoint &p) resetContextMenuType(); } +void LocalSinkGUI::updateDeviceSetList(const QList& deviceSetIndexes) +{ + QList::const_iterator it = deviceSetIndexes.begin(); + + ui->localDevice->blockSignals(true); + + ui->localDevice->clear(); + + for (; it != deviceSetIndexes.end(); ++it) { + ui->localDevice->addItem(QString("R%1").arg(*it), *it); + } + + ui->localDevice->blockSignals(false); +} + void LocalSinkGUI::on_decimationFactor_currentIndexChanged(int index) { m_settings.m_log2Decim = index; @@ -320,18 +325,10 @@ void LocalSinkGUI::on_position_valueChanged(int value) void LocalSinkGUI::on_localDevice_currentIndexChanged(int index) { - m_settings.m_localDeviceIndex = ui->localDevice->itemData(index).toInt(); - applySettings(); -} - -void LocalSinkGUI::on_localDevicesRefresh_clicked(bool checked) -{ - (void) checked; - updateLocalDevices(); - int index = getLocalDeviceIndexInCombo(m_settings.m_localDeviceIndex); - - if (index >= 0) { - ui->localDevice->setCurrentIndex(index); + if (index >= 0) + { + m_settings.m_localDeviceIndex = ui->localDevice->currentData().toInt(); + applySettings(); } } @@ -379,7 +376,6 @@ void LocalSinkGUI::makeUIConnections() QObject::connect(ui->decimationFactor, QOverload::of(&QComboBox::currentIndexChanged), this, &LocalSinkGUI::on_decimationFactor_currentIndexChanged); QObject::connect(ui->position, &QSlider::valueChanged, this, &LocalSinkGUI::on_position_valueChanged); QObject::connect(ui->localDevice, QOverload::of(&QComboBox::currentIndexChanged), this, &LocalSinkGUI::on_localDevice_currentIndexChanged); - QObject::connect(ui->localDevicesRefresh, &QPushButton::clicked, this, &LocalSinkGUI::on_localDevicesRefresh_clicked); QObject::connect(ui->localDevicePlay, &ButtonSwitch::toggled, this, &LocalSinkGUI::on_localDevicePlay_toggled); } diff --git a/plugins/channelrx/localsink/localsinkgui.h b/plugins/channelrx/localsink/localsinkgui.h index 1904c4dca..a5947d416 100644 --- a/plugins/channelrx/localsink/localsinkgui.h +++ b/plugins/channelrx/localsink/localsinkgui.h @@ -84,11 +84,11 @@ private: void applySettings(bool force = false); void displaySettings(); void displayRateAndShift(); - void updateLocalDevices(); - int getLocalDeviceIndexInCombo(int localDeviceIndex); bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); + void updateDeviceSetList(const QList& deviceSetIndexes); + int getLocalDeviceIndexInCombo(int localDeviceIndex); void leaveEvent(QEvent*); void enterEvent(EnterEventType*); @@ -101,7 +101,6 @@ private slots: void on_decimationFactor_currentIndexChanged(int index); void on_position_valueChanged(int value); void on_localDevice_currentIndexChanged(int index); - void on_localDevicesRefresh_clicked(bool checked); void on_localDevicePlay_toggled(bool checked); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); diff --git a/plugins/channelrx/localsink/localsinkgui.ui b/plugins/channelrx/localsink/localsinkgui.ui index 114225121..a1ef5e211 100644 --- a/plugins/channelrx/localsink/localsinkgui.ui +++ b/plugins/channelrx/localsink/localsinkgui.ui @@ -281,30 +281,10 @@ - - - - - 24 - 16777215 - - - - Refresh indexes of available local devices - - - - - - - :/recycle.png:/recycle.png - - - - Start/Stop sink + Start/Stop processing @@ -335,17 +315,17 @@ + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
RollupContents QWidget
gui/rollupcontents.h
1
- - ButtonSwitch - QToolButton -
gui/buttonswitch.h
-
diff --git a/plugins/channelrx/localsink/localsinksettings.cpp b/plugins/channelrx/localsink/localsinksettings.cpp index ecf2f9a48..7f84cf6b7 100644 --- a/plugins/channelrx/localsink/localsinksettings.cpp +++ b/plugins/channelrx/localsink/localsinksettings.cpp @@ -30,7 +30,7 @@ LocalSinkSettings::LocalSinkSettings() void LocalSinkSettings::resetToDefaults() { - m_localDeviceIndex = 0; + m_localDeviceIndex = -1; m_rgbColor = QColor(140, 4, 4).rgb(); m_title = "Local sink"; m_log2Decim = 0; @@ -51,7 +51,7 @@ void LocalSinkSettings::resetToDefaults() QByteArray LocalSinkSettings::serialize() const { SimpleSerializer s(1); - s.writeU32(1, m_localDeviceIndex); + s.writeS32(1, m_localDeviceIndex); if (m_channelMarker) { s.writeBlob(2, m_channelMarker->serialize()); @@ -95,7 +95,7 @@ bool LocalSinkSettings::deserialize(const QByteArray& data) QString strtmp; QByteArray bytetmp; - d.readU32(1, &m_localDeviceIndex, 0); + d.readS32(1, &m_localDeviceIndex, -1); if (m_channelMarker) { diff --git a/plugins/channelrx/localsink/localsinksettings.h b/plugins/channelrx/localsink/localsinksettings.h index 48a52beaa..93cd41785 100644 --- a/plugins/channelrx/localsink/localsinksettings.h +++ b/plugins/channelrx/localsink/localsinksettings.h @@ -25,7 +25,7 @@ class Serializable; struct LocalSinkSettings { - uint32_t m_localDeviceIndex; + int m_localDeviceIndex; quint32 m_rgbColor; QString m_title; uint32_t m_log2Decim; diff --git a/plugins/channelrx/localsink/localsinksink.cpp b/plugins/channelrx/localsink/localsinksink.cpp index d3487b3e1..777d25ae1 100644 --- a/plugins/channelrx/localsink/localsinksink.cpp +++ b/plugins/channelrx/localsink/localsinksink.cpp @@ -26,12 +26,13 @@ #include "localsinksink.h" LocalSinkSink::LocalSinkSink() : - m_sinkWorker(nullptr), - m_running(false), - m_centerFrequency(0), - m_frequencyOffset(0), - m_sampleRate(48000), - m_deviceSampleRate(48000) + m_deviceSource(nullptr), + m_sinkWorker(nullptr), + m_running(false), + m_centerFrequency(0), + m_frequencyOffset(0), + m_sampleRate(48000), + m_deviceSampleRate(48000) { m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(4000000)); applySettings(m_settings, true); @@ -43,34 +44,39 @@ LocalSinkSink::~LocalSinkSink() void LocalSinkSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end) { - m_sampleFifo.write(begin, end); + if (m_running && m_deviceSource) { + m_deviceSource->getSampleFifo()->write(begin, end); + } + // m_sampleFifo.write(begin, end); } void LocalSinkSink::start(DeviceSampleSource *deviceSource) { - qDebug("LocalSinkSink::start"); + qDebug("LocalSinkSink::start: deviceSource: %p", deviceSource); if (m_running) { stop(); } - m_sinkWorker = new LocalSinkWorker(); - m_sinkWorker->moveToThread(&m_sinkWorkerThread); - m_sinkWorker->setSampleFifo(&m_sampleFifo); + m_deviceSource = deviceSource; + // TODO: We'll see later if a worker is really needed + // m_sinkWorker = new LocalSinkWorker(); + // m_sinkWorker->moveToThread(&m_sinkWorkerThread); + // m_sinkWorker->setSampleFifo(&m_sampleFifo); - if (deviceSource) { - m_sinkWorker->setDeviceSampleFifo(deviceSource->getSampleFifo()); - } + // if (deviceSource) { + // m_sinkWorker->setDeviceSampleFifo(deviceSource->getSampleFifo()); + // } - QObject::connect( - &m_sampleFifo, - &SampleSinkFifo::dataReady, - m_sinkWorker, - &LocalSinkWorker::handleData, - Qt::QueuedConnection - ); + // QObject::connect( + // &m_sampleFifo, + // &SampleSinkFifo::dataReady, + // m_sinkWorker, + // &LocalSinkWorker::handleData, + // Qt::QueuedConnection + // ); - startWorker(); + // startWorker(); m_running = true; } @@ -78,21 +84,23 @@ void LocalSinkSink::stop() { qDebug("LocalSinkSink::stop"); - QObject::disconnect( - &m_sampleFifo, - &SampleSinkFifo::dataReady, - m_sinkWorker, - &LocalSinkWorker::handleData - ); + // TODO: We'll see later if a worker is really needed + // QObject::disconnect( + // &m_sampleFifo, + // &SampleSinkFifo::dataReady, + // m_sinkWorker, + // &LocalSinkWorker::handleData + // ); - if (m_sinkWorker != 0) - { - stopWorker(); - m_sinkWorker->deleteLater(); - m_sinkWorker = nullptr; - } + // if (m_sinkWorker != 0) + // { + // stopWorker(); + // m_sinkWorker->deleteLater(); + // m_sinkWorker = nullptr; + // } m_running = false; + m_deviceSource = nullptr; } void LocalSinkSink::startWorker() diff --git a/plugins/channelrx/localsink/localsinksink.h b/plugins/channelrx/localsink/localsinksink.h index 06bea9c5d..2552f4dca 100644 --- a/plugins/channelrx/localsink/localsinksink.h +++ b/plugins/channelrx/localsink/localsinksink.h @@ -43,6 +43,7 @@ public: void setSampleRate(int sampleRate); private: + DeviceSampleSource *m_deviceSource; SampleSinkFifo m_sampleFifo; LocalSinkSettings m_settings; LocalSinkWorker *m_sinkWorker; diff --git a/plugins/channelrx/localsink/readme.md b/plugins/channelrx/localsink/readme.md index 498cd2d75..b01e60972 100644 --- a/plugins/channelrx/localsink/readme.md +++ b/plugins/channelrx/localsink/readme.md @@ -12,7 +12,7 @@ These Local Sinks can then be coupled with two Local Input device source plugins Note that because it uses only the channelizer half band filter chain to achieve decimation and center frequency shift you have a limited choice on the center frequencies that may be used (similarly to the Remote Sink). The available center frequencies depend on the baseband sample rate, the channel decimation and the filter chain that is used so you have to play with these parameters to obtain a suitable center frequency and pass band. -⚠ Important warning When closing the application or before closing the local input device the local sink is connected to you have to stop the device where the local sink operates. This is because there is no reverse link for the local input to notify the local sink that it closes. Therefore closing the local input while the local sink runs will crash the program. +⚠ Important warning When closing the application or before closing the local input device the local sink is connected it is recommended to stop processing on the local sink (7). Depending on the sequence by which the devices have been created closing the local input while the local sink runs may crash the program.

Interface

@@ -52,6 +52,6 @@ The slider moves the channel center frequency roughly from the lower to the high This selects the index of the Local Input source where to send the I/Q samples. The list can be refreshed with the next button (7) -

7: Refresh local input devices list

+

7: Start/stop processing

-Use this button to refresh the list of Local Input sources indexes. +Use this button to start or stop processing.