diff --git a/plugins/channelmimo/interferometer/interferometer.cpp b/plugins/channelmimo/interferometer/interferometer.cpp index 6add08d3b..d75bcf59f 100644 --- a/plugins/channelmimo/interferometer/interferometer.cpp +++ b/plugins/channelmimo/interferometer/interferometer.cpp @@ -73,7 +73,7 @@ Interferometer::~Interferometer() delete m_thread; } -void Interferometer::setScopeSink(BasebandSampleSink *scopeSink) +void Interferometer::setScopeSink(ScopeVis *scopeSink) { m_scopeSink = scopeSink; m_basebandSink->setScopeSink(scopeSink); diff --git a/plugins/channelmimo/interferometer/interferometer.h b/plugins/channelmimo/interferometer/interferometer.h index 62f41e105..7b09bf24f 100644 --- a/plugins/channelmimo/interferometer/interferometer.h +++ b/plugins/channelmimo/interferometer/interferometer.h @@ -34,7 +34,7 @@ class DeviceAPI; class InterferometerBaseband; class QNetworkReply; class QNetworkAccessManager; -class BasebandSampleSink; +class ScopeVis; class Interferometer: public MIMOChannel, public ChannelAPI { @@ -121,7 +121,7 @@ public: MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } - void setScopeSink(BasebandSampleSink *scopeSink); + void setScopeSink(ScopeVis *scopeSink); void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash); virtual int webapiSettingsGet( @@ -152,7 +152,7 @@ private: QThread *m_thread; SpectrumVis m_spectrumVis; InterferometerBaseband* m_basebandSink; - BasebandSampleSink* m_scopeSink; + ScopeVis* m_scopeSink; InterferometerSettings m_settings; MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI diff --git a/plugins/channelmimo/interferometer/interferometerbaseband.cpp b/plugins/channelmimo/interferometer/interferometerbaseband.cpp index f0de22043..b30b32cf7 100644 --- a/plugins/channelmimo/interferometer/interferometerbaseband.cpp +++ b/plugins/channelmimo/interferometer/interferometerbaseband.cpp @@ -20,6 +20,7 @@ #include "dsp/downchannelizer.h" #include "dsp/basebandsamplesink.h" +#include "dsp/scopevis.h" #include "dsp/dspcommands.h" #include "interferometerbaseband.h" @@ -141,8 +142,11 @@ void InterferometerBaseband::run() { if (m_correlator.performCorr(m_sinks[0].getData(), m_sinks[0].getSize(), m_sinks[1].getData(), m_sinks[1].getSize())) { - if (m_scopeSink) { - m_scopeSink->feed(m_correlator.m_tcorr.begin(), m_correlator.m_tcorr.begin() + m_correlator.m_processed, false); + if (m_scopeSink) + { + std::vector vbegin; + vbegin.push_back(m_correlator.m_tcorr.begin()); + m_scopeSink->feed(vbegin, m_correlator.m_processed); } if (m_spectrumSink) diff --git a/plugins/channelmimo/interferometer/interferometerbaseband.h b/plugins/channelmimo/interferometer/interferometerbaseband.h index e2dc3700c..f7e89e5af 100644 --- a/plugins/channelmimo/interferometer/interferometerbaseband.h +++ b/plugins/channelmimo/interferometer/interferometerbaseband.h @@ -28,6 +28,7 @@ class DownChannelizer; class BasebandSampleSink; +class ScopeVis; class InterferometerBaseband : public QObject { @@ -105,7 +106,7 @@ public: MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication void setSpectrumSink(BasebandSampleSink *spectrumSink) { m_spectrumSink = spectrumSink; } - void setScopeSink(BasebandSampleSink *scopeSink) { m_scopeSink = scopeSink; } + void setScopeSink(ScopeVis *scopeSink) { m_scopeSink = scopeSink; } void setPhase(int phase) { m_correlator.setPhase(phase); } void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int streamIndex); @@ -123,7 +124,7 @@ private: InterferometerStreamSink m_sinks[2]; DownChannelizer *m_channelizers[2]; BasebandSampleSink *m_spectrumSink; - BasebandSampleSink *m_scopeSink; + ScopeVis *m_scopeSink; MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication QMutex m_mutex; unsigned int m_lastStream; diff --git a/plugins/channelrx/demodais/aisdemod.cpp b/plugins/channelrx/demodais/aisdemod.cpp index 57cdecf05..e8c733398 100644 --- a/plugins/channelrx/demodais/aisdemod.cpp +++ b/plugins/channelrx/demodais/aisdemod.cpp @@ -186,7 +186,7 @@ bool AISDemod::handleMessage(const Message& cmd) } } -void AISDemod::setScopeSink(BasebandSampleSink* scopeSink) +void AISDemod::setScopeSink(ScopeVis* scopeSink) { m_basebandSink->setScopeSink(scopeSink); } diff --git a/plugins/channelrx/demodais/aisdemod.h b/plugins/channelrx/demodais/aisdemod.h index 5216d332a..937807ac7 100644 --- a/plugins/channelrx/demodais/aisdemod.h +++ b/plugins/channelrx/demodais/aisdemod.h @@ -37,6 +37,7 @@ class QNetworkAccessManager; class QNetworkReply; class QThread; class DeviceAPI; +class ScopeVis; class AISDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT @@ -135,7 +136,7 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - void setScopeSink(BasebandSampleSink* scopeSink); + void setScopeSink(ScopeVis* scopeSink); double getMagSq() const { return m_basebandSink->getMagSq(); } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { diff --git a/plugins/channelrx/demodais/aisdemodbaseband.h b/plugins/channelrx/demodais/aisdemodbaseband.h index 96729ffe3..c2ceb9eb7 100644 --- a/plugins/channelrx/demodais/aisdemodbaseband.h +++ b/plugins/channelrx/demodais/aisdemodbaseband.h @@ -31,6 +31,7 @@ class DownChannelizer; class ChannelAPI; class AISDemod; +class ScopeVis; class AISDemodBaseband : public QObject { @@ -71,7 +72,7 @@ public: } void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); } void setBasebandSampleRate(int sampleRate); - void setScopeSink(BasebandSampleSink* scopeSink) { m_sink.setScopeSink(scopeSink); } + void setScopeSink(ScopeVis* scopeSink) { m_sink.setScopeSink(scopeSink); } void setChannel(ChannelAPI *channel); double getMagSq() const { return m_sink.getMagSq(); } bool isRunning() const { return m_running; } diff --git a/plugins/channelrx/demodais/aisdemodsink.cpp b/plugins/channelrx/demodais/aisdemodsink.cpp index 007501d4a..d2985c7aa 100644 --- a/plugins/channelrx/demodais/aisdemodsink.cpp +++ b/plugins/channelrx/demodais/aisdemodsink.cpp @@ -22,6 +22,7 @@ #include "dsp/dspengine.h" #include "dsp/datafifo.h" +#include "dsp/scopevis.h" #include "util/db.h" #include "util/stepfunctions.h" #include "pipes/pipeendpoint.h" @@ -67,7 +68,9 @@ void AISDemodSink::sampleToScope(Complex sample) Real i = std::imag(sample) * SDR_RX_SCALEF; SampleVector m_sampleBuffer; m_sampleBuffer.push_back(Sample(r, i)); - m_scopeSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true); + std::vector vbegin; + vbegin.push_back(m_sampleBuffer.begin()); + m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); m_sampleBuffer.clear(); } } diff --git a/plugins/channelrx/demodais/aisdemodsink.h b/plugins/channelrx/demodais/aisdemodsink.h index 963881e1e..8526551cf 100644 --- a/plugins/channelrx/demodais/aisdemodsink.h +++ b/plugins/channelrx/demodais/aisdemodsink.h @@ -48,6 +48,7 @@ class ChannelAPI; class AISDemod; +class ScopeVis; class AISDemodSink : public ChannelSampleSink { public: @@ -56,7 +57,7 @@ public: virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); - void setScopeSink(BasebandSampleSink* scopeSink) { m_scopeSink = scopeSink; } + void setScopeSink(ScopeVis* scopeSink) { m_scopeSink = scopeSink; } void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); void applySettings(const AISDemodSettings& settings, bool force = false); void setMessageQueueToChannel(MessageQueue *messageQueue) { m_messageQueueToChannel = messageQueue; } @@ -94,7 +95,7 @@ private: double m_magsqPeak; }; - BasebandSampleSink* m_scopeSink; // Scope GUI to display baseband waveform + ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform AISDemod *m_aisDemod; AISDemodSettings m_settings; ChannelAPI *m_channel; diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index 2867cde22..afec5fecd 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -32,6 +32,7 @@ #include "atvdemodbaseband.h" class DeviceAPI; +class ScopeVis; class ATVDemod : public BasebandSampleSink, public ChannelAPI { @@ -87,7 +88,7 @@ public: return m_settings.m_inputFrequencyOffset; } - void setScopeSink(BasebandSampleSink* scopeSink) { m_basebandSink->setScopeSink(scopeSink); } + void setScopeSink(ScopeVis* scopeSink) { m_basebandSink->setScopeSink(scopeSink); } void setTVScreen(TVScreenAnalog *tvScreen) { m_basebandSink->setTVScreen(tvScreen); }; //!< set by the GUI double getMagSq() const { return m_basebandSink->getMagSq(); } //!< Beware this is scaled to 2^30 bool getBFOLocked() { return m_basebandSink->getBFOLocked(); } diff --git a/plugins/channelrx/demodatv/atvdemodbaseband.h b/plugins/channelrx/demodatv/atvdemodbaseband.h index e9598f1b7..81144e23a 100644 --- a/plugins/channelrx/demodatv/atvdemodbaseband.h +++ b/plugins/channelrx/demodatv/atvdemodbaseband.h @@ -65,7 +65,7 @@ public: MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication int getChannelSampleRate() const; double getMagSq() const { return m_sink.getMagSq(); } - void setScopeSink(BasebandSampleSink* scopeSink) { m_sink.setScopeSink(scopeSink); } + void setScopeSink(ScopeVis* scopeSink) { m_sink.setScopeSink(scopeSink); } void setTVScreen(TVScreenAnalog *tvScreen) { m_sink.setTVScreen(tvScreen); } bool getBFOLocked() { return m_sink.getBFOLocked(); } void setVideoTabIndex(int videoTabIndex) { m_sink.setVideoTabIndex(videoTabIndex); } @@ -89,4 +89,4 @@ private slots: void handleData(); //!< Handle data when samples have to be processed }; -#endif // INCLUDE_CHANNELANALYZERBASEBAND_H \ No newline at end of file +#endif // INCLUDE_CHANNELANALYZERBASEBAND_H diff --git a/plugins/channelrx/demodatv/atvdemodsink.cpp b/plugins/channelrx/demodatv/atvdemodsink.cpp index 9feeed043..0cdadce76 100644 --- a/plugins/channelrx/demodatv/atvdemodsink.cpp +++ b/plugins/channelrx/demodatv/atvdemodsink.cpp @@ -21,6 +21,7 @@ #include #include +#include "dsp/scopevis.h" #include "atvdemodsink.h" const int ATVDemodSink::m_ssbFftLen = 1024; @@ -97,7 +98,9 @@ void ATVDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV if ((m_videoTabIndex == 1) && (m_scopeSink)) // do only if scope tab is selected and scope is available { - m_scopeSink->feed(m_scopeSampleBuffer.begin(), m_scopeSampleBuffer.end(), false); // m_ssb = positive only + std::vector vbegin; + vbegin.push_back(m_scopeSampleBuffer.begin()); + m_scopeSink->feed(vbegin, m_scopeSampleBuffer.end() - m_scopeSampleBuffer.begin()); // m_ssb = positive only m_scopeSampleBuffer.clear(); } } diff --git a/plugins/channelrx/demodatv/atvdemodsink.h b/plugins/channelrx/demodatv/atvdemodsink.h index 35df12d84..9d5bc9ff7 100644 --- a/plugins/channelrx/demodatv/atvdemodsink.h +++ b/plugins/channelrx/demodatv/atvdemodsink.h @@ -23,7 +23,6 @@ #include #include "dsp/channelsamplesink.h" -#include "dsp/basebandsamplesink.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "dsp/fftfilt.h" @@ -37,6 +36,8 @@ #include "atvdemodsettings.h" +class ScopeVis; + class ATVDemodSink : public ChannelSampleSink { public: ATVDemodSink(); @@ -44,7 +45,7 @@ public: virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); - void setScopeSink(BasebandSampleSink* scopeSink) { m_scopeSink = scopeSink; } + void setScopeSink(ScopeVis* scopeSink) { m_scopeSink = scopeSink; } void setTVScreen(TVScreenAnalog *tvScreen) //!< set by the GUI { m_registeredTVScreen = tvScreen; @@ -108,7 +109,7 @@ private: //*************** SCOPE *************** - BasebandSampleSink* m_scopeSink; + ScopeVis* m_scopeSink; SampleVector m_scopeSampleBuffer; //*************** ATV PARAMETERS *************** diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp index 7e054b43e..41269015e 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp @@ -607,7 +607,7 @@ uint32_t IEEE_802_15_4_Mod::getNumberOfDeviceStreams() const return m_deviceAPI->getNbSinkStreams(); } -void IEEE_802_15_4_Mod::setScopeSink(BasebandSampleSink* scopeSink) +void IEEE_802_15_4_Mod::setScopeSink(ScopeVis* scopeSink) { m_basebandSource->setScopeSink(scopeSink); } diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h index 380fbaa78..cdf3c9013 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h @@ -39,6 +39,7 @@ class QThread; class QUdpSocket; class DeviceAPI; class IEEE_802_15_4_ModBaseband; +class ScopeVis; class IEEE_802_15_4_Mod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT @@ -143,7 +144,7 @@ public: SWGSDRangel::SWGChannelSettings& response); SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } - void setScopeSink(BasebandSampleSink* scopeSink); + void setScopeSink(ScopeVis* scopeSink); double getMagSq() const; void setLevelMeter(QObject *levelMeter); uint32_t getNumberOfDeviceStreams() const; diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modbaseband.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modbaseband.h index 6ae89ceb6..c29876a32 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modbaseband.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modbaseband.h @@ -29,6 +29,7 @@ #include "ieee_802_15_4_modsource.h" class UpChannelizer; +class ScopeVis; class IEEE_802_15_4_ModBaseband : public QObject { @@ -65,7 +66,7 @@ public: double getMagSq() const { return m_source.getMagSq(); } int getChannelSampleRate() const; void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); } - void setScopeSink(BasebandSampleSink* scopeSink) { m_source.setScopeSink(scopeSink); } + void setScopeSink(ScopeVis* scopeSink) { m_source.setScopeSink(scopeSink); } signals: diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.cpp b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.cpp index 7509d2396..f5713bcf2 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.cpp +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.cpp @@ -20,6 +20,7 @@ #include #include "dsp/basebandsamplesink.h" +#include "dsp/scopevis.h" #include "ieee_802_15_4_modsource.h" #include "util/crc.h" @@ -120,7 +121,8 @@ void IEEE_802_15_4_ModSource::sampleToScope(Complex sample) Real r = std::real(sample) * SDR_RX_SCALEF; Real i = std::imag(sample) * SDR_RX_SCALEF; m_sampleBuffer.push_back(Sample(r, i)); - m_scopeSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true); + std::vector vbegin; + m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); m_sampleBuffer.clear(); } } diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.h index 94ba492d2..8367c7f4b 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modsource.h @@ -38,6 +38,7 @@ #include "ieee_802_15_4_modsettings.h" class BasebandSampleSink; +class ScopeVis; class IEEE_802_15_4_ModSource : public ChannelSampleSource { @@ -57,7 +58,7 @@ public: numSamples = m_levelNbSamples; } void setSpectrumSink(BasebandSampleSink *sampleSink) { m_spectrumSink = sampleSink; } - void setScopeSink(BasebandSampleSink* scopeSink) { m_scopeSink = scopeSink; } + void setScopeSink(ScopeVis* scopeSink) { m_scopeSink = scopeSink; } void applySettings(const IEEE_802_15_4_ModSettings& settings, bool force = false); void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); @@ -84,7 +85,7 @@ private: LFSR m_scrambler; // Scrambler BasebandSampleSink* m_spectrumSink; // Spectrum GUI to display baseband waveform - BasebandSampleSink* m_scopeSink; // Scope GUI to display baseband waveform + ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform SampleVector m_sampleBuffer; Interpolator m_interpolator; // Interpolator to downsample to 4k in spectrum Real m_interpolatorDistance; diff --git a/plugins/channeltx/modais/aismod.cpp b/plugins/channeltx/modais/aismod.cpp index 90b802cb2..2b469cd51 100644 --- a/plugins/channeltx/modais/aismod.cpp +++ b/plugins/channeltx/modais/aismod.cpp @@ -140,7 +140,7 @@ bool AISMod::handleMessage(const Message& cmd) } } -void AISMod::setScopeSink(BasebandSampleSink* scopeSink) +void AISMod::setScopeSink(ScopeVis* scopeSink) { m_basebandSource->setScopeSink(scopeSink); } diff --git a/plugins/channeltx/modais/aismod.h b/plugins/channeltx/modais/aismod.h index 6cc707987..d9dd314b7 100644 --- a/plugins/channeltx/modais/aismod.h +++ b/plugins/channeltx/modais/aismod.h @@ -37,6 +37,7 @@ class QThread; class QUdpSocket; class DeviceAPI; class AISModBaseband; +class ScopeVis; class AISMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT @@ -160,7 +161,7 @@ public: SWGSDRangel::SWGChannelSettings& response); SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } - void setScopeSink(BasebandSampleSink* scopeSink); + void setScopeSink(ScopeVis* scopeSink); double getMagSq() const; void setLevelMeter(QObject *levelMeter); uint32_t getNumberOfDeviceStreams() const; diff --git a/plugins/channeltx/modais/aismodbaseband.h b/plugins/channeltx/modais/aismodbaseband.h index f7cb20179..9c60bfadc 100644 --- a/plugins/channeltx/modais/aismodbaseband.h +++ b/plugins/channeltx/modais/aismodbaseband.h @@ -30,6 +30,7 @@ class UpChannelizer; class ChannelAPI; +class ScopeVis; class AISModBaseband : public QObject { @@ -66,7 +67,7 @@ public: double getMagSq() const { return m_source.getMagSq(); } int getChannelSampleRate() const; void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); } - void setScopeSink(BasebandSampleSink* scopeSink) { m_source.setScopeSink(scopeSink); } + void setScopeSink(ScopeVis* scopeSink) { m_source.setScopeSink(scopeSink); } void setChannel(ChannelAPI *channel); signals: diff --git a/plugins/channeltx/modais/aismodsource.cpp b/plugins/channeltx/modais/aismodsource.cpp index 30a08896b..9083a8ad1 100644 --- a/plugins/channeltx/modais/aismodsource.cpp +++ b/plugins/channeltx/modais/aismodsource.cpp @@ -20,6 +20,7 @@ #include "dsp/basebandsamplesink.h" #include "dsp/datafifo.h" +#include "dsp/scopevis.h" #include "aismodsource.h" #include "util/crc.h" #include "util/messagequeue.h" @@ -125,7 +126,9 @@ void AISModSource::sampleToScope(Complex sample) Real r = std::real(sample) * SDR_RX_SCALEF; Real i = std::imag(sample) * SDR_RX_SCALEF; m_sampleBuffer.push_back(Sample(r, i)); - m_scopeSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true); + std::vector vbegin; + vbegin.push_back(m_sampleBuffer.begin()); + m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); m_sampleBuffer.clear(); } } diff --git a/plugins/channeltx/modais/aismodsource.h b/plugins/channeltx/modais/aismodsource.h index fd1954fa2..b8a2a1579 100644 --- a/plugins/channeltx/modais/aismodsource.h +++ b/plugins/channeltx/modais/aismodsource.h @@ -47,6 +47,7 @@ // Is there any benefit to having this higher? #define AISMOD_SAMPLE_RATE (9600*6) +class ScopeVis; class BasebandSampleSink; class ChannelAPI; @@ -68,7 +69,7 @@ public: numSamples = m_levelNbSamples; } void setSpectrumSink(BasebandSampleSink *sampleSink) { m_spectrumSink = sampleSink; } - void setScopeSink(BasebandSampleSink* scopeSink) { m_scopeSink = scopeSink; } + void setScopeSink(ScopeVis* scopeSink) { m_scopeSink = scopeSink; } void applySettings(const AISModSettings& settings, bool force = false); void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); void addTXPacket(const QString& data); @@ -92,7 +93,7 @@ private: Gaussian m_pulseShape; // Pulse shaping filter BasebandSampleSink* m_spectrumSink; // Spectrum GUI to display baseband waveform - BasebandSampleSink* m_scopeSink; // Scope GUI to display baseband waveform + ScopeVis* m_scopeSink; // Scope GUI to display baseband waveform SampleVector m_sampleBuffer; Interpolator m_interpolator; // Interpolator to channel sample rate diff --git a/sdrbase/dsp/glscopemiinterface.h b/sdrbase/dsp/glscopemiinterface.h new file mode 100644 index 000000000..ee623aec3 --- /dev/null +++ b/sdrbase/dsp/glscopemiinterface.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2021 Edouard Griffiths, F4EXB. // +// // +// 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 // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRBASE_DSP_GLSCOPEINTERFACE_H_ +#define SDRBASE_DSP_GLSCOPEINTERFACE_H_ + +#include "dsptypes.h" +#include "scopesettings.h" +#include "physicalunit.h" + +class GLScopeInterface +{ +public: + GLScopeInterface() {} + virtual ~GLScopeInterface() {} + virtual void setTracesData(std::vector* tracesData) = 0; + virtual void setTraces(std::vector>* traces) = 0; + virtual void newTraces(int traceIndex, int traceSize) = 0; + virtual void setTimeScale(float min, float max) = 0; //!< Linear horizontal scales + virtual void setXScale(Unit::Physical unit, float min, float max) = 0; //!< Set X Scale => X for polar, Y1 for linear + virtual void setYScale(Unit::Physical unit, float min, float max) = 0; //!< Set Y Scale => Y for polar, Y2 for linear +}; + +#endif // SDRBASE_DSP_GLSPECTRUMINTERFACE_H_ diff --git a/sdrbase/dsp/scopevis.cpp b/sdrbase/dsp/scopevis.cpp index a7cf74df4..2305800bd 100644 --- a/sdrbase/dsp/scopevis.cpp +++ b/sdrbase/dsp/scopevis.cpp @@ -43,6 +43,7 @@ const uint ScopeVis::m_traceChunkDefaultSize = 4800; ScopeVis::ScopeVis(GLScopeInterface* glScope) : m_glScope(glScope), + m_messageQueueToGUI(nullptr), m_preTriggerDelay(0), m_livePreTriggerDelay(0), m_currentTriggerIndex(0), @@ -72,10 +73,12 @@ ScopeVis::ScopeVis(GLScopeInterface* glScope) : for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) { m_projectorCache[i] = 0.0; } + connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); } ScopeVis::~ScopeVis() { + disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); for (std::vector::iterator it = m_triggerConditions.begin(); it != m_triggerConditions.end(); ++ it) { delete *it; } @@ -213,9 +216,12 @@ void ScopeVis::setMemoryIndex(uint32_t memoryIndex) getInputMessageQueue()->push(cmd); } -void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly) +void ScopeVis::feed(const std::vector& vbegin, int nbSamples) +//void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly) { - (void) positiveOnly; + if (vbegin.size() == 0) { + return; + } if (m_currentTraceMemoryIndex > 0) { // in memory mode live trace is suspended return; @@ -232,6 +238,9 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect return; } + const SampleVector::const_iterator& cbegin = vbegin[0]; + const SampleVector::const_iterator end = cbegin + nbSamples; + if (m_freeRun) { m_triggerLocation = end - cbegin; } @@ -650,12 +659,16 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa } } -void ScopeVis::start() +void ScopeVis::handleInputMessages() { -} + Message* message; -void ScopeVis::stop() -{ + while ((message = m_inputMessageQueue.pop()) != nullptr) + { + if (handleMessage(*message)) { + delete message; + } + } } bool ScopeVis::handleMessage(const Message& message) diff --git a/sdrbase/dsp/scopevis.h b/sdrbase/dsp/scopevis.h index d83d03274..0b6d4f4a2 100644 --- a/sdrbase/dsp/scopevis.h +++ b/sdrbase/dsp/scopevis.h @@ -30,18 +30,18 @@ #include #include #include "dsp/dsptypes.h" -#include "dsp/basebandsamplesink.h" #include "dsp/projector.h" #include "dsp/glscopesettings.h" #include "export.h" #include "util/message.h" +#include "util/messagequeue.h" #include "util/doublebuffer.h" class GLScopeInterface; -class SDRGUI_API ScopeVis : public BasebandSampleSink { - +class SDRGUI_API ScopeVis : public QObject { + Q_OBJECT public: struct TriggerData { @@ -103,6 +103,9 @@ public: ScopeVis(GLScopeInterface* glScope = nullptr); virtual ~ScopeVis(); + void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; } + MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication + void setLiveRate(int sampleRate); void configure(uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun); void addTrace(const GLScopeSettings::TraceData& traceData); @@ -187,11 +190,11 @@ public: const std::vector& getTracesData() const { return m_traces.m_tracesData; } uint32_t getNbTriggers() const { return m_triggerConditions.size(); } - using BasebandSampleSink::feed; - virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly); - virtual void start(); - virtual void stop(); - virtual bool handleMessage(const Message& message); + void feed(const std::vector& vbegin, int nbSamples); + //virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly); + //virtual void start(); + //virtual void stop(); + bool handleMessage(const Message& message); int getTriggerLocation() const { return m_triggerLocation; } bool getFreeRun() const { return m_freeRun; } @@ -1079,6 +1082,8 @@ private: }; GLScopeInterface* m_glScope; + MessageQueue m_inputMessageQueue; + MessageQueue *m_messageQueueToGUI; uint32_t m_preTriggerDelay; //!< Pre-trigger delay in number of samples uint32_t m_livePreTriggerDelay; //!< Pre-trigger delay in number of samples in live mode std::vector m_triggerConditions; //!< Chain of triggers @@ -1171,6 +1176,9 @@ private: * Set the pre trigger delay */ void setPreTriggerDelay(uint32_t preTriggerDelay, bool emitSignal = false); + +private slots: + void handleInputMessages(); }; diff --git a/sdrgui/dsp/spectrumscopecombovis.cpp b/sdrgui/dsp/spectrumscopecombovis.cpp index 18178df96..984b0134a 100644 --- a/sdrgui/dsp/spectrumscopecombovis.cpp +++ b/sdrgui/dsp/spectrumscopecombovis.cpp @@ -17,7 +17,9 @@ SpectrumScopeComboVis::~SpectrumScopeComboVis() void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly) { (void) positiveOnly; - m_scopeVis->feed(begin, end, false); + std::vector vbegin; + vbegin.push_back(begin); + m_scopeVis->feed(vbegin, end - begin); //SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint(); //m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly); int triggerPointLocation = m_scopeVis->getTriggerLocation(); @@ -34,13 +36,11 @@ void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, cons void SpectrumScopeComboVis::start() { m_spectrumVis->start(); - m_scopeVis->start(); } void SpectrumScopeComboVis::stop() { m_spectrumVis->stop(); - m_scopeVis->stop(); } bool SpectrumScopeComboVis::handleMessage(const Message& message)