mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-29 20:10:22 -04:00 
			
		
		
		
	NFM modulator: use settings in GUI (1)
This commit is contained in:
		
							parent
							
								
									ccb2f7ff96
								
							
						
					
					
						commit
						0ee830f403
					
				| @ -93,7 +93,7 @@ void NFMMod::configure(MessageQueue* messageQueue, | |||||||
| 		bool audioMute, | 		bool audioMute, | ||||||
| 		bool playLoop, | 		bool playLoop, | ||||||
| 		bool ctcssOn, | 		bool ctcssOn, | ||||||
| 		float ctcssFrequency) | 		int  ctcssFrequencyIndex) | ||||||
| { | { | ||||||
| 	Message* cmd = MsgConfigureNFMMod::create(rfBandwidth, | 	Message* cmd = MsgConfigureNFMMod::create(rfBandwidth, | ||||||
| 	        afBandwidth, | 	        afBandwidth, | ||||||
| @ -103,7 +103,7 @@ void NFMMod::configure(MessageQueue* messageQueue, | |||||||
| 	        audioMute, | 	        audioMute, | ||||||
| 	        playLoop, | 	        playLoop, | ||||||
| 	        ctcssOn, | 	        ctcssOn, | ||||||
| 	        ctcssFrequency); | 	        ctcssFrequencyIndex); | ||||||
| 	messageQueue->push(cmd); | 	messageQueue->push(cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -316,7 +316,7 @@ bool NFMMod::handleMessage(const Message& cmd) | |||||||
| 		m_config.m_channelMute = cfg.getChannelMute(); | 		m_config.m_channelMute = cfg.getChannelMute(); | ||||||
| 		m_config.m_playLoop = cfg.getPlayLoop(); | 		m_config.m_playLoop = cfg.getPlayLoop(); | ||||||
| 		m_config.m_ctcssOn = cfg.getCTCSSOn(); | 		m_config.m_ctcssOn = cfg.getCTCSSOn(); | ||||||
| 		m_config.m_ctcssFrequency = cfg.getCTCSSFrequency(); | 		m_config.m_ctcssFrequency = NFMModSettings::getCTCSSFreq(cfg.getCTCSSFrequencyIndex()); | ||||||
| 
 | 
 | ||||||
| 		apply(); | 		apply(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -34,6 +34,8 @@ | |||||||
| #include "audio/audiofifo.h" | #include "audio/audiofifo.h" | ||||||
| #include "util/message.h" | #include "util/message.h" | ||||||
| 
 | 
 | ||||||
|  | #include "nfmmodsettings.h" | ||||||
|  | 
 | ||||||
| class NFMMod : public BasebandSampleSource { | class NFMMod : public BasebandSampleSource { | ||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
| 
 | 
 | ||||||
| @ -187,7 +189,7 @@ public: | |||||||
|             bool channelMute, |             bool channelMute, | ||||||
|             bool playLoop, |             bool playLoop, | ||||||
|             bool ctcssOn, |             bool ctcssOn, | ||||||
|             float ctcssFrequency); |             int  ctcssFrequencyIndex); | ||||||
| 
 | 
 | ||||||
|     virtual void pull(Sample& sample); |     virtual void pull(Sample& sample); | ||||||
|     virtual void pullAudio(int nbSamples); |     virtual void pullAudio(int nbSamples); | ||||||
| @ -223,7 +225,7 @@ private: | |||||||
|         bool getChannelMute() const { return m_channelMute; } |         bool getChannelMute() const { return m_channelMute; } | ||||||
|         bool getPlayLoop() const { return m_playLoop; } |         bool getPlayLoop() const { return m_playLoop; } | ||||||
|         bool getCTCSSOn() const { return m_ctcssOn; } |         bool getCTCSSOn() const { return m_ctcssOn; } | ||||||
|         float getCTCSSFrequency() const { return m_ctcssFrequency; } |         float getCTCSSFrequencyIndex() const { return m_ctcssFrequencyIndex; } | ||||||
| 
 | 
 | ||||||
|         static MsgConfigureNFMMod* create(Real rfBandwidth, |         static MsgConfigureNFMMod* create(Real rfBandwidth, | ||||||
|                 Real afBandwidth, |                 Real afBandwidth, | ||||||
| @ -233,7 +235,7 @@ private: | |||||||
|                 bool channelMute, |                 bool channelMute, | ||||||
|                 bool playLoop, |                 bool playLoop, | ||||||
|                 bool ctcssOn, |                 bool ctcssOn, | ||||||
|                 float ctcssFrequency) |                 int  ctcssFrequencyIndex) | ||||||
|         { |         { | ||||||
|             return new MsgConfigureNFMMod(rfBandwidth, |             return new MsgConfigureNFMMod(rfBandwidth, | ||||||
|                     afBandwidth, |                     afBandwidth, | ||||||
| @ -243,7 +245,7 @@ private: | |||||||
|                     channelMute, |                     channelMute, | ||||||
|                     playLoop, |                     playLoop, | ||||||
|                     ctcssOn, |                     ctcssOn, | ||||||
|                     ctcssFrequency); |                     ctcssFrequencyIndex); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     private: |     private: | ||||||
| @ -255,7 +257,7 @@ private: | |||||||
|         bool m_channelMute; |         bool m_channelMute; | ||||||
|         bool m_playLoop; |         bool m_playLoop; | ||||||
|         bool m_ctcssOn; |         bool m_ctcssOn; | ||||||
|         float m_ctcssFrequency; |         int  m_ctcssFrequencyIndex; | ||||||
| 
 | 
 | ||||||
|         MsgConfigureNFMMod(Real rfBandwidth, |         MsgConfigureNFMMod(Real rfBandwidth, | ||||||
|                 Real afBandwidth, |                 Real afBandwidth, | ||||||
| @ -265,7 +267,7 @@ private: | |||||||
|                 bool channelMute, |                 bool channelMute, | ||||||
|                 bool playLoop, |                 bool playLoop, | ||||||
|                 bool ctcssOn, |                 bool ctcssOn, | ||||||
|                 float ctcssFrequency) : |                 int  ctcssFrequencyIndex) : | ||||||
|             Message(), |             Message(), | ||||||
|             m_rfBandwidth(rfBandwidth), |             m_rfBandwidth(rfBandwidth), | ||||||
|             m_afBandwidth(afBandwidth), |             m_afBandwidth(afBandwidth), | ||||||
| @ -275,7 +277,7 @@ private: | |||||||
|             m_channelMute(channelMute), |             m_channelMute(channelMute), | ||||||
| 			m_playLoop(playLoop), | 			m_playLoop(playLoop), | ||||||
| 			m_ctcssOn(ctcssOn), | 			m_ctcssOn(ctcssOn), | ||||||
| 			m_ctcssFrequency(ctcssFrequency) | 			m_ctcssFrequencyIndex(ctcssFrequencyIndex) | ||||||
|         { } |         { } | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -214,45 +214,54 @@ void NFMModGUI::handleSourceMessages() | |||||||
| void NFMModGUI::on_deltaFrequency_changed(qint64 value) | void NFMModGUI::on_deltaFrequency_changed(qint64 value) | ||||||
| { | { | ||||||
|     m_channelMarker.setCenterFrequency(value); |     m_channelMarker.setCenterFrequency(value); | ||||||
|  |     m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); | ||||||
|  |     applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_rfBW_currentIndexChanged(int index) | void NFMModGUI::on_rfBW_currentIndexChanged(int index) | ||||||
| { | { | ||||||
| 	m_channelMarker.setBandwidth(m_rfBW[index]); | 	m_channelMarker.setBandwidth(NFMModSettings::getRFBW(index)); | ||||||
|  | 	m_settings.m_rfBandwidth = NFMModSettings::getRFBW(index); | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_afBW_valueChanged(int value) | void NFMModGUI::on_afBW_valueChanged(int value) | ||||||
| { | { | ||||||
| 	ui->afBWText->setText(QString("%1k").arg(value)); | 	ui->afBWText->setText(QString("%1k").arg(value)); | ||||||
|  | 	m_settings.m_afBandwidth = value * 1000.0; | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_fmDev_valueChanged(int value) | void NFMModGUI::on_fmDev_valueChanged(int value) | ||||||
| { | { | ||||||
| 	ui->fmDevText->setText(QString("%1k").arg(value / 10.0, 0, 'f', 1)); | 	ui->fmDevText->setText(QString("%1k").arg(value / 10.0, 0, 'f', 1)); | ||||||
|  | 	m_settings.m_fmDeviation = value * 100.0; | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_volume_valueChanged(int value) | void NFMModGUI::on_volume_valueChanged(int value) | ||||||
| { | { | ||||||
| 	ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1)); | 	ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1)); | ||||||
|  | 	m_settings.m_volumeFactor = value / 10.0; | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_toneFrequency_valueChanged(int value) | void NFMModGUI::on_toneFrequency_valueChanged(int value) | ||||||
| { | { | ||||||
|     ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2)); |     ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2)); | ||||||
|  |     m_settings.m_toneFrequency = value * 10.0; | ||||||
|     applySettings(); |     applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_channelMute_toggled(bool checked __attribute__((unused))) | void NFMModGUI::on_channelMute_toggled(bool checked) | ||||||
| { | { | ||||||
|  |     m_settings.m_channelMute = checked; | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_playLoop_toggled(bool checked __attribute__((unused))) | void NFMModGUI::on_playLoop_toggled(bool checked) | ||||||
| { | { | ||||||
|  |     m_settings.m_playLoop = checked; | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -325,13 +334,15 @@ void NFMModGUI::on_showFileDialog_clicked(bool checked __attribute__((unused))) | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_ctcss_currentIndexChanged(int index __attribute__((unused))) | void NFMModGUI::on_ctcss_currentIndexChanged(int index) | ||||||
| { | { | ||||||
|  |     m_settings.m_ctcssIndex = index; | ||||||
|     applySettings(); |     applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void NFMModGUI::on_ctcssOn_toggled(bool checked __attribute__((unused))) | void NFMModGUI::on_ctcssOn_toggled(bool checked) | ||||||
| { | { | ||||||
|  |     m_settings.m_ctcssOn = checked; | ||||||
|     applySettings(); |     applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -459,15 +470,26 @@ void NFMModGUI::applySettings() | |||||||
| 		ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); | 		ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); | ||||||
| 
 | 
 | ||||||
|         m_nfmMod->configure(m_nfmMod->getInputMessageQueue(), |         m_nfmMod->configure(m_nfmMod->getInputMessageQueue(), | ||||||
| 			m_rfBW[ui->rfBW->currentIndex()], |             m_settings.m_rfBandwidth, | ||||||
| 			ui->afBW->value() * 1000.0, |             m_settings.m_afBandwidth, | ||||||
| 			ui->fmDev->value() * 100.0f, // value is in '100 Hz
 |             m_settings.m_fmDeviation, // value is in '100 Hz
 | ||||||
| 			ui->toneFrequency->value() * 10.0f, |             m_settings.m_toneFrequency, | ||||||
| 			ui->volume->value() / 10.0f, |             m_settings.m_volumeFactor, | ||||||
| 			ui->channelMute->isChecked(), |             m_settings.m_channelMute, | ||||||
| 			ui->playLoop->isChecked(), |             m_settings.m_playLoop, | ||||||
| 			ui->ctcssOn->isChecked(), |             m_settings.m_ctcssOn, | ||||||
| 			m_ctcssTones[ui->ctcss->currentIndex()]); |             m_settings.m_ctcssIndex); | ||||||
|  | 
 | ||||||
|  | //		m_nfmMod->configure(m_nfmMod->getInputMessageQueue(),
 | ||||||
|  | //			m_rfBW[ui->rfBW->currentIndex()],
 | ||||||
|  | //			ui->afBW->value() * 1000.0,
 | ||||||
|  | //			ui->fmDev->value() * 100.0f, // value is in '100 Hz
 | ||||||
|  | //			ui->toneFrequency->value() * 10.0f,
 | ||||||
|  | //			ui->volume->value() / 10.0f,
 | ||||||
|  | //			ui->channelMute->isChecked(),
 | ||||||
|  | //			ui->playLoop->isChecked(),
 | ||||||
|  | //			ui->ctcssOn->isChecked(),
 | ||||||
|  | //			m_ctcssTones[ui->ctcss->currentIndex()]);
 | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ | |||||||
| #include "util/messagequeue.h" | #include "util/messagequeue.h" | ||||||
| 
 | 
 | ||||||
| #include "nfmmod.h" | #include "nfmmod.h" | ||||||
|  | #include "nfmmodsettings.h" | ||||||
| 
 | 
 | ||||||
| class PluginAPI; | class PluginAPI; | ||||||
| class DeviceSinkAPI; | class DeviceSinkAPI; | ||||||
| @ -90,6 +91,7 @@ private: | |||||||
|     PluginAPI* m_pluginAPI; |     PluginAPI* m_pluginAPI; | ||||||
|     DeviceSinkAPI* m_deviceAPI; |     DeviceSinkAPI* m_deviceAPI; | ||||||
|     ChannelMarker m_channelMarker; |     ChannelMarker m_channelMarker; | ||||||
|  |     NFMModSettings m_settings; | ||||||
|     bool m_basicSettingsShown; |     bool m_basicSettingsShown; | ||||||
|     bool m_doApplySettings; |     bool m_doApplySettings; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user