mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	Spectrum: added log/linear control
This commit is contained in:
		
							parent
							
								
									51e5987158
								
							
						
					
					
						commit
						d5f153ff75
					
				| @ -359,7 +359,14 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban | ||||
| 	ui->glSpectrum->setDisplayWaterfall(false); | ||||
| 	ui->glSpectrum->setDisplayMaxHold(false); | ||||
| 	ui->glSpectrum->setSsbSpectrum(true); | ||||
| 	m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris); | ||||
| 	m_spectrumVis->configure( | ||||
| 	        m_spectrumVis->getInputMessageQueue(), | ||||
|             64, // FFT size
 | ||||
|             10, // overlapping %
 | ||||
|             0,  // number of averaging samples
 | ||||
|             0,  // no averaging
 | ||||
| 	        FFTWindow::BlackmanHarris, | ||||
| 	        false); // logarithmic scale
 | ||||
| 	connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); | ||||
| 
 | ||||
| 	m_channelMarker.blockSignals(true); | ||||
|  | ||||
| @ -187,7 +187,13 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam | ||||
| 	ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt()); | ||||
| 	ui->glSpectrum->setDisplayWaterfall(true); | ||||
| 	ui->glSpectrum->setDisplayMaxHold(true); | ||||
| 	m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris); | ||||
| 	m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), | ||||
| 	        64, // FFT size
 | ||||
| 	        10, // overlapping %
 | ||||
| 	        0,  // number of averaging samples
 | ||||
| 	        0,  // no averaging
 | ||||
| 	        FFTWindow::BlackmanHarris, | ||||
| 	        false); // logarithmic scale
 | ||||
| 
 | ||||
| 	ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer()); | ||||
| 	connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); | ||||
|  | ||||
| @ -142,7 +142,13 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS | ||||
|     ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt()); | ||||
|     ui->glSpectrum->setDisplayWaterfall(true); | ||||
|     ui->glSpectrum->setDisplayMaxHold(true); | ||||
|     m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris); | ||||
|     m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), | ||||
|             64, // FFT size
 | ||||
|             10, // overlapping %
 | ||||
|             0,  // number of averaging samples
 | ||||
|             0,  // no averaging
 | ||||
|             FFTWindow::BlackmanHarris, | ||||
|             false); // logarithmic scale
 | ||||
| 
 | ||||
|     ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer()); | ||||
|     connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); | ||||
|  | ||||
| @ -44,9 +44,10 @@ void SpectrumVis::configure(MessageQueue* msgQueue, | ||||
|         int overlapPercent, | ||||
|         unsigned int averagingNb, | ||||
|         int averagingMode, | ||||
|         FFTWindow::Function window) | ||||
|         FFTWindow::Function window, | ||||
|         bool linear) | ||||
| { | ||||
| 	MsgConfigureSpectrumVis* cmd = new MsgConfigureSpectrumVis(fftSize, overlapPercent, averagingNb, averagingMode, window); | ||||
| 	MsgConfigureSpectrumVis* cmd = new MsgConfigureSpectrumVis(fftSize, overlapPercent, averagingNb, averagingMode, window, linear); | ||||
| 	msgQueue->push(cmd); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -27,12 +27,19 @@ public: | ||||
| 		MESSAGE_CLASS_DECLARATION | ||||
| 
 | ||||
| 	public: | ||||
| 		MsgConfigureSpectrumVis(int fftSize, int overlapPercent, unsigned int averageNb, int averagingMode, FFTWindow::Function window) : | ||||
| 		MsgConfigureSpectrumVis( | ||||
| 		        int fftSize, | ||||
| 		        int overlapPercent, | ||||
| 		        unsigned int averageNb, | ||||
| 		        int averagingMode, | ||||
| 		        FFTWindow::Function window, | ||||
| 		        bool linear) : | ||||
| 			Message(), | ||||
| 			m_fftSize(fftSize), | ||||
| 			m_overlapPercent(overlapPercent), | ||||
| 			m_averageNb(averageNb), | ||||
| 			m_window(window) | ||||
| 			m_window(window), | ||||
| 			m_linear(linear) | ||||
| 		{ | ||||
| 		    m_averagingMode = averagingMode < 0 ? AvgModeNone : averagingMode > 2 ? AvgModeFixed : (SpectrumVis::AveragingMode) averagingMode; | ||||
| 		} | ||||
| @ -42,6 +49,7 @@ public: | ||||
| 		unsigned int getAverageNb() const { return m_averageNb; } | ||||
| 		SpectrumVis::AveragingMode getAveragingMode() const { return m_averagingMode; } | ||||
| 		FFTWindow::Function getWindow() const { return m_window; } | ||||
| 		bool getLinear() const { return m_linear; } | ||||
| 
 | ||||
| 	private: | ||||
| 		int m_fftSize; | ||||
| @ -49,6 +57,7 @@ public: | ||||
| 		unsigned int m_averageNb; | ||||
| 		SpectrumVis::AveragingMode m_averagingMode; | ||||
| 		FFTWindow::Function m_window; | ||||
| 		bool m_linear; | ||||
| 	}; | ||||
| 
 | ||||
| 	SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0); | ||||
| @ -59,7 +68,8 @@ public: | ||||
| 	        int overlapPercent, | ||||
| 	        unsigned int averagingNb, | ||||
| 	        int averagingMode, | ||||
| 	        FFTWindow::Function window); | ||||
| 	        FFTWindow::Function window, | ||||
| 	        bool m_linear); | ||||
| 
 | ||||
| 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly); | ||||
| 	void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly); | ||||
|  | ||||
| @ -200,7 +200,8 @@ void GLSpectrumGUI::applySettings() | ||||
| 	            m_fftOverlap, | ||||
| 	            m_averagingNb, | ||||
| 	            m_averagingMode, | ||||
| 	            (FFTWindow::Function)m_fftWindow); | ||||
| 	            (FFTWindow::Function)m_fftWindow, | ||||
| 	            m_linear); | ||||
| 	} | ||||
| 
 | ||||
| 	setAveragingToolitp(); | ||||
| @ -215,7 +216,8 @@ void GLSpectrumGUI::on_fftWindow_currentIndexChanged(int index) | ||||
|                 m_fftOverlap, | ||||
|                 m_averagingNb, | ||||
|                 m_averagingMode, | ||||
|                 (FFTWindow::Function)m_fftWindow); | ||||
|                 (FFTWindow::Function)m_fftWindow, | ||||
|                 m_linear); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -228,7 +230,8 @@ void GLSpectrumGUI::on_fftSize_currentIndexChanged(int index) | ||||
| 	            m_fftOverlap, | ||||
| 	            m_averagingNb, | ||||
|                 m_averagingMode, | ||||
| 	            (FFTWindow::Function)m_fftWindow); | ||||
| 	            (FFTWindow::Function)m_fftWindow, | ||||
| 	            m_linear); | ||||
| 	} | ||||
| 	setAveragingToolitp(); | ||||
| } | ||||
| @ -243,7 +246,8 @@ void GLSpectrumGUI::on_averagingMode_currentIndexChanged(int index) | ||||
|                 m_fftOverlap, | ||||
|                 m_averagingNb, | ||||
|                 m_averagingMode, | ||||
|                 (FFTWindow::Function)m_fftWindow); | ||||
|                 (FFTWindow::Function)m_fftWindow, | ||||
|                 m_linear); | ||||
|     } | ||||
| 
 | ||||
|     if (m_glSpectrum != 0) | ||||
| @ -267,7 +271,8 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index) | ||||
|                 m_fftOverlap, | ||||
|                 m_averagingNb, | ||||
|                 m_averagingMode, | ||||
|                 (FFTWindow::Function)m_fftWindow); | ||||
|                 (FFTWindow::Function)m_fftWindow, | ||||
|                 m_linear); | ||||
|     } | ||||
| 
 | ||||
|     if (m_glSpectrum != 0) | ||||
| @ -280,6 +285,21 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index) | ||||
|     setAveragingToolitp(); | ||||
| } | ||||
| 
 | ||||
| void GLSpectrumGUI::on_linscale_toggled(bool checked) | ||||
| { | ||||
|     m_linear = checked; | ||||
| 
 | ||||
|     if(m_spectrumVis != 0) { | ||||
|         m_spectrumVis->configure(m_messageQueueToVis, | ||||
|                 m_fftSize, | ||||
|                 m_fftOverlap, | ||||
|                 m_averagingNb, | ||||
|                 m_averagingMode, | ||||
|                 (FFTWindow::Function)m_fftWindow, | ||||
|                 m_linear); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLSpectrumGUI::on_refLevel_currentIndexChanged(int index) | ||||
| { | ||||
| 	m_refLevel = 0 - index * 5; | ||||
|  | ||||
| @ -63,6 +63,7 @@ private: | ||||
| 	int m_averagingIndex; | ||||
| 	int m_averagingMaxScale; //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
 | ||||
| 	unsigned int m_averagingNb; | ||||
| 	bool m_linear; //!< linear else logarithmic scale
 | ||||
| 
 | ||||
| 	void applySettings(); | ||||
| 	int getAveragingIndex(int averaging) const; | ||||
| @ -85,6 +86,7 @@ private slots: | ||||
| 	void on_traceIntensity_valueChanged(int index); | ||||
| 	void on_averagingMode_currentIndexChanged(int index); | ||||
|     void on_averaging_currentIndexChanged(int index); | ||||
|     void on_linscale_toggled(bool checked); | ||||
| 
 | ||||
| 	void on_waterfall_toggled(bool checked); | ||||
| 	void on_histogram_toggled(bool checked); | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>331</width> | ||||
|     <width>342</width> | ||||
|     <height>59</height> | ||||
|    </rect> | ||||
|   </property> | ||||
| @ -633,6 +633,24 @@ | ||||
|        </item> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QToolButton" name="linscale"> | ||||
|        <property name="toolTip"> | ||||
|         <string>Logarithmic / Linear scale selection</string> | ||||
|        </property> | ||||
|        <property name="text"> | ||||
|         <string/> | ||||
|        </property> | ||||
|        <property name="icon"> | ||||
|         <iconset resource="../resources/res.qrc"> | ||||
|          <normaloff>:/logarithmic.png</normaloff> | ||||
|          <normalon>:/linear.png</normalon>:/logarithmic.png</iconset> | ||||
|        </property> | ||||
|        <property name="checkable"> | ||||
|         <bool>true</bool> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <spacer name="horizontalSpacer"> | ||||
|        <property name="orientation"> | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/linear.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/linear.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 458 B | 
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/linear.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/linear.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/logarithmic.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/logarithmic.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 542 B | 
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/logarithmic.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/logarithmic.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,5 +1,7 @@ | ||||
| <RCC> | ||||
|   <qresource prefix="/"> | ||||
|     <file>linear.png</file> | ||||
|     <file>logarithmic.png</file> | ||||
|     <file>pin_last.png</file> | ||||
|     <file>sweep.png</file> | ||||
|     <file>minusrx.png</file> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user