mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	GLScope redesign: allow multiple I/Q streams sent to ScopeVis
This commit is contained in:
		
							parent
							
								
									aa868b9176
								
							
						
					
					
						commit
						e9d51c99a7
					
				| @ -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); | ||||
|  | ||||
| @ -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
 | ||||
|  | ||||
| @ -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<SampleVector::const_iterator> vbegin; | ||||
|             vbegin.push_back(m_correlator.m_tcorr.begin()); | ||||
|             m_scopeSink->feed(vbegin, m_correlator.m_processed); | ||||
|         } | ||||
| 
 | ||||
|         if (m_spectrumSink) | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -186,7 +186,7 @@ bool AISDemod::handleMessage(const Message& cmd) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void AISDemod::setScopeSink(BasebandSampleSink* scopeSink) | ||||
| void AISDemod::setScopeSink(ScopeVis* scopeSink) | ||||
| { | ||||
|     m_basebandSink->setScopeSink(scopeSink); | ||||
| } | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -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; } | ||||
|  | ||||
| @ -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<SampleVector::const_iterator> vbegin; | ||||
|         vbegin.push_back(m_sampleBuffer.begin()); | ||||
|         m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); | ||||
|         m_sampleBuffer.clear(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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(); } | ||||
|  | ||||
| @ -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
 | ||||
| #endif // INCLUDE_CHANNELANALYZERBASEBAND_H
 | ||||
|  | ||||
| @ -21,6 +21,7 @@ | ||||
| #include <stdio.h> | ||||
| #include <complex.h> | ||||
| 
 | ||||
| #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<SampleVector::const_iterator> vbegin; | ||||
|         vbegin.push_back(m_scopeSampleBuffer.begin()); | ||||
|         m_scopeSink->feed(vbegin, m_scopeSampleBuffer.end() - m_scopeSampleBuffer.begin()); // m_ssb = positive only
 | ||||
|         m_scopeSampleBuffer.clear(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -23,7 +23,6 @@ | ||||
| #include <memory> | ||||
| 
 | ||||
| #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  ***************
 | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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: | ||||
|  | ||||
| @ -20,6 +20,7 @@ | ||||
| #include <QDebug> | ||||
| 
 | ||||
| #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<SampleVector::const_iterator> vbegin; | ||||
|         m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); | ||||
|         m_sampleBuffer.clear(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -140,7 +140,7 @@ bool AISMod::handleMessage(const Message& cmd) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void AISMod::setScopeSink(BasebandSampleSink* scopeSink) | ||||
| void AISMod::setScopeSink(ScopeVis* scopeSink) | ||||
| { | ||||
|     m_basebandSource->setScopeSink(scopeSink); | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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: | ||||
|  | ||||
| @ -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<SampleVector::const_iterator> vbegin; | ||||
|         vbegin.push_back(m_sampleBuffer.begin()); | ||||
|         m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin()); | ||||
|         m_sampleBuffer.clear(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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<Real> 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
 | ||||
|  | ||||
							
								
								
									
										38
									
								
								sdrbase/dsp/glscopemiinterface.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								sdrbase/dsp/glscopemiinterface.h
									
									
									
									
									
										Normal file
									
								
							| @ -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 <http://www.gnu.org/licenses/>.          //
 | ||||
| ///////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #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<ScopeSettings::TraceData>* tracesData) = 0; | ||||
|     virtual void setTraces(std::vector<std::vector<float>>* 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_
 | ||||
| @ -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<TriggerCondition*>::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<SampleVector::const_iterator>& 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) | ||||
|  | ||||
| @ -30,18 +30,18 @@ | ||||
| #include <stdint.h> | ||||
| #include <vector> | ||||
| #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<GLScopeSettings::TraceData>& 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<SampleVector::const_iterator>& 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<TriggerCondition*> 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(); | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -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<SampleVector::const_iterator> 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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user