diff --git a/plugins/samplemimo/testmi/testmi.cpp b/plugins/samplemimo/testmi/testmi.cpp index 9c061adc9..1daa56b56 100644 --- a/plugins/samplemimo/testmi/testmi.cpp +++ b/plugins/samplemimo/testmi/testmi.cpp @@ -434,7 +434,7 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_streams[istream].m_centerFrequency); m_fileSinks[istream]->handleMessage(*notif); // forward to file sink DSPDeviceMIMOEngine::SignalNotification *engineNotif = new DSPDeviceMIMOEngine::SignalNotification( - sampleRate, settings.m_streams[istream].m_centerFrequency, true, 0); + sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif); } diff --git a/plugins/samplemimo/testmi/testmigui.cpp b/plugins/samplemimo/testmi/testmigui.cpp index 9d5a2b4de..e762588ff 100644 --- a/plugins/samplemimo/testmi/testmigui.cpp +++ b/plugins/samplemimo/testmi/testmigui.cpp @@ -53,8 +53,14 @@ TestMIGui::TestMIGui(DeviceUISet *deviceUISet, QWidget* parent) : qDebug("TestMIGui::TestMIGui"); m_sampleMIMO = m_deviceUISet->m_deviceAPI->getSampleMIMO(); m_streamIndex = 0; + m_deviceCenterFrequencies.push_back(m_settings.m_streams[0].m_centerFrequency); + m_deviceCenterFrequencies.push_back(m_settings.m_streams[1].m_centerFrequency); + m_deviceSampleRates.push_back(m_settings.m_streams[0].m_sampleRate / (1<setupUi(this); + ui->spectrumSource->addItem("0"); + ui->spectrumSource->addItem("1"); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->centerFrequency->setValueRange(7, 0, 9999999); ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); @@ -146,9 +152,17 @@ void TestMIGui::on_streamIndex_currentIndexChanged(int index) { m_streamIndex = index; updateFileRecordStatus(); + updateSampleRateAndFrequency(); displaySettings(); } +void TestMIGui::on_spectrumSource_currentIndexChanged(int index) +{ + m_spectrumStreamIndex = index; + m_deviceUISet->m_deviceAPI->setSpectrumSinkInput(true, m_spectrumStreamIndex); + updateSampleRateAndFrequency(); +} + void TestMIGui::on_centerFrequency_changed(quint64 value) { m_settings.m_streams[m_streamIndex].m_centerFrequency = value * 1000; @@ -511,10 +525,14 @@ void TestMIGui::handleInputMessages() if (DSPDeviceMIMOEngine::SignalNotification::match(*message)) { DSPDeviceMIMOEngine::SignalNotification* notif = (DSPDeviceMIMOEngine::SignalNotification*) message; - m_deviceSampleRate = notif->getSampleRate(); - m_deviceCenterFrequency = notif->getCenterFrequency(); + int istream = notif->getIndex(); + bool sourceOrSink = notif->getSourceOrSink(); + m_deviceSampleRates[istream] = notif->getSampleRate(); + m_deviceCenterFrequencies[istream] = notif->getCenterFrequency(); // Do not consider multiple sources at this time - qDebug("TestMIGui::handleInputMessages: DSPDeviceMIMOEngine::SignalNotification: SampleRate:%d, CenterFrequency:%llu", + qDebug("TestMIGui::handleInputMessages: DSPDeviceMIMOEngine::SignalNotification: %s stream: %d SampleRate:%d, CenterFrequency:%llu", + sourceOrSink ? "source" : "sink", + istream, notif->getSampleRate(), notif->getCenterFrequency()); updateSampleRateAndFrequency(); @@ -533,9 +551,9 @@ void TestMIGui::handleInputMessages() void TestMIGui::updateSampleRateAndFrequency() { - m_deviceUISet->getSpectrum()->setSampleRate(m_deviceSampleRate); - m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); - ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000)); + m_deviceUISet->getSpectrum()->setSampleRate(m_deviceSampleRates[m_spectrumStreamIndex]); + m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequencies[m_spectrumStreamIndex]); + ui->deviceRateText->setText(tr("%1k").arg((float) m_deviceSampleRates[m_streamIndex] / 1000)); } void TestMIGui::openDeviceSettingsDialog(const QPoint& p) diff --git a/plugins/samplemimo/testmi/testmigui.h b/plugins/samplemimo/testmi/testmigui.h index 5113ac959..0585f2674 100644 --- a/plugins/samplemimo/testmi/testmigui.h +++ b/plugins/samplemimo/testmi/testmigui.h @@ -58,14 +58,15 @@ private: DeviceUISet* m_deviceUISet; TestMISettings m_settings; int m_streamIndex; //!< Current stream index being dealt with + int m_spectrumStreamIndex; //!< Index of the stream displayed on main spectrum QTimer m_updateTimer; QTimer m_statusTimer; bool m_doApplySettings; bool m_forceSettings; DeviceSampleMIMO* m_sampleMIMO; std::size_t m_tickCount; - int m_deviceSampleRate; - quint64 m_deviceCenterFrequency; //!< Center frequency in device + std::vector m_deviceSampleRates; + std::vector m_deviceCenterFrequencies; //!< Center frequency in device int m_lastEngineState; MessageQueue m_inputMessageQueue; @@ -83,6 +84,7 @@ private slots: void handleInputMessages(); void on_startStop_toggled(bool checked); void on_streamIndex_currentIndexChanged(int index); + void on_spectrumSource_currentIndexChanged(int index); void on_centerFrequency_changed(quint64 value); void on_autoCorr_currentIndexChanged(int index); void on_frequencyShift_changed(qint64 value); diff --git a/plugins/samplemimo/testmi/testmigui.ui b/plugins/samplemimo/testmi/testmigui.ui index a6ce09b13..ed074e225 100644 --- a/plugins/samplemimo/testmi/testmigui.ui +++ b/plugins/samplemimo/testmi/testmigui.ui @@ -50,6 +50,80 @@ 2 + + + + + + Stream + + + + + + + + 40 + 16777215 + + + + Stream index + + + + 0 + + + + + 1 + + + + + + + + Spectrum + + + + + + + + 60 + 16777215 + + + + Select stream for main spectrum source + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + @@ -181,114 +255,6 @@ - - - - Qt::Horizontal - - - - - - - - - Stream - - - - - - - - 40 - 16777215 - - - - Stream index - - - - 0 - - - - - 1 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 16 - 0 - - - - SR - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - Liberation Mono - 12 - - - - PointingHandCursor - - - Generator sample rate (S/s) - - - - - - - S/s - - - - - @@ -481,6 +447,60 @@ 2 + + + + + 0 + 0 + + + + + 16 + 0 + + + + SR + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + Liberation Mono + 12 + + + + PointingHandCursor + + + Generator sample rate (S/s) + + + + + + + S/s + + + diff --git a/sdrbase/dsp/dspdevicemimoengine.cpp b/sdrbase/dsp/dspdevicemimoengine.cpp index cd318e10b..65546e477 100644 --- a/sdrbase/dsp/dspdevicemimoengine.cpp +++ b/sdrbase/dsp/dspdevicemimoengine.cpp @@ -948,7 +948,6 @@ void DSPDeviceMIMOEngine::handleInputMessages() << " sampleRate: " << sampleRate << " centerFrequency: " << centerFrequency; - if (sourceElseSink) { if ((istream < m_deviceSampleMIMO->getNbSourceStreams())) @@ -984,6 +983,7 @@ void DSPDeviceMIMOEngine::handleInputMessages() guiMessageQueue->push(rep); } + // forward changes to spectrum sink if currently active if (m_spectrumSink && m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream)) { DSPSignalNotification spectrumNotif(sampleRate, centerFrequency); @@ -1016,6 +1016,7 @@ void DSPDeviceMIMOEngine::handleInputMessages() guiMessageQueue->push(rep); } + // forward changes to spectrum sink if currently active if (m_spectrumSink && !m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream)) { DSPSignalNotification spectrumNotif(sampleRate, centerFrequency);