mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	DSD demod plugin: DMR refactoring: added logic for buttons to toggle slot1 and slot2 voice output
This commit is contained in:
		
							parent
							
								
									045392ae79
								
							
						
					
					
						commit
						ae8b3ba2af
					
				| @ -85,7 +85,9 @@ void DSDDemod::configure(MessageQueue* messageQueue, | |||||||
| 		Real squelch, | 		Real squelch, | ||||||
| 		bool audioMute, | 		bool audioMute, | ||||||
| 		bool enableCosineFiltering, | 		bool enableCosineFiltering, | ||||||
| 		bool syncOrConstellation) | 		bool syncOrConstellation, | ||||||
|  | 		bool slot1On, | ||||||
|  | 		bool slot2On) | ||||||
| { | { | ||||||
| 	Message* cmd = MsgConfigureDSDDemod::create(rfBandwidth, | 	Message* cmd = MsgConfigureDSDDemod::create(rfBandwidth, | ||||||
| 			demodGain, | 			demodGain, | ||||||
| @ -96,7 +98,9 @@ void DSDDemod::configure(MessageQueue* messageQueue, | |||||||
| 			squelch, | 			squelch, | ||||||
| 			audioMute, | 			audioMute, | ||||||
| 			enableCosineFiltering, | 			enableCosineFiltering, | ||||||
| 			syncOrConstellation); | 			syncOrConstellation, | ||||||
|  | 			slot1On, | ||||||
|  | 			slot2On); | ||||||
| 	messageQueue->push(cmd); | 	messageQueue->push(cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -266,6 +270,8 @@ bool DSDDemod::handleMessage(const Message& cmd) | |||||||
| 		m_config.m_audioMute = cfg.getAudioMute(); | 		m_config.m_audioMute = cfg.getAudioMute(); | ||||||
| 		m_config.m_enableCosineFiltering = cfg.getEnableCosineFiltering(); | 		m_config.m_enableCosineFiltering = cfg.getEnableCosineFiltering(); | ||||||
| 		m_config.m_syncOrConstellation = cfg.getSyncOrConstellation(); | 		m_config.m_syncOrConstellation = cfg.getSyncOrConstellation(); | ||||||
|  | 		m_config.m_slot1On = cfg.getSlot1On(); | ||||||
|  | 		m_config.m_slot2On = cfg.getSlot2On(); | ||||||
| 
 | 
 | ||||||
| 		apply(); | 		apply(); | ||||||
| 
 | 
 | ||||||
| @ -278,7 +284,9 @@ bool DSDDemod::handleMessage(const Message& cmd) | |||||||
| 				<< " m_squelch: " << m_config.m_squelch | 				<< " m_squelch: " << m_config.m_squelch | ||||||
| 				<< " m_audioMute: " << m_config.m_audioMute | 				<< " m_audioMute: " << m_config.m_audioMute | ||||||
| 				<< " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering | 				<< " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering | ||||||
| 				<< " m_syncOrConstellation: " << m_config.m_syncOrConstellation; | 				<< " m_syncOrConstellation: " << m_config.m_syncOrConstellation | ||||||
|  | 				<< " m_slot1On: " << m_config.m_slot1On | ||||||
|  | 				<< " m_slot2On: " << m_config.m_slot2On; | ||||||
| 
 | 
 | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @ -353,4 +361,6 @@ void DSDDemod::apply() | |||||||
| 	m_running.m_audioMute = m_config.m_audioMute; | 	m_running.m_audioMute = m_config.m_audioMute; | ||||||
| 	m_running.m_enableCosineFiltering = m_config.m_enableCosineFiltering; | 	m_running.m_enableCosineFiltering = m_config.m_enableCosineFiltering; | ||||||
| 	m_running.m_syncOrConstellation = m_config.m_syncOrConstellation; | 	m_running.m_syncOrConstellation = m_config.m_syncOrConstellation; | ||||||
|  | 	m_running.m_slot1On = m_config.m_slot1On; | ||||||
|  | 	m_running.m_slot2On = m_config.m_slot2On; | ||||||
| } | } | ||||||
|  | |||||||
| @ -50,7 +50,9 @@ public: | |||||||
| 			Real squelch, | 			Real squelch, | ||||||
| 			bool audioMute, | 			bool audioMute, | ||||||
| 			bool enableCosineFiltering, | 			bool enableCosineFiltering, | ||||||
| 			bool syncOrConstellation); | 			bool syncOrConstellation, | ||||||
|  | 			bool slot1On, | ||||||
|  | 			bool slot2On); | ||||||
| 
 | 
 | ||||||
| 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); | 	virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); | ||||||
| 	virtual void start(); | 	virtual void start(); | ||||||
| @ -81,6 +83,8 @@ private: | |||||||
| 		bool getAudioMute() const { return m_audioMute; } | 		bool getAudioMute() const { return m_audioMute; } | ||||||
| 		bool getEnableCosineFiltering() const { return m_enableCosineFiltering; } | 		bool getEnableCosineFiltering() const { return m_enableCosineFiltering; } | ||||||
| 		bool getSyncOrConstellation() const { return m_syncOrConstellation; } | 		bool getSyncOrConstellation() const { return m_syncOrConstellation; } | ||||||
|  | 		bool getSlot1On() const { return m_slot1On; } | ||||||
|  | 		bool getSlot2On() const { return m_slot2On; } | ||||||
| 
 | 
 | ||||||
| 		static MsgConfigureDSDDemod* create(int rfBandwidth, | 		static MsgConfigureDSDDemod* create(int rfBandwidth, | ||||||
| 				int  demodGain, | 				int  demodGain, | ||||||
| @ -91,7 +95,9 @@ private: | |||||||
| 				Real squelch, | 				Real squelch, | ||||||
| 				bool audioMute, | 				bool audioMute, | ||||||
| 				bool enableCosineFiltering, | 				bool enableCosineFiltering, | ||||||
| 				bool syncOrConstellation) | 				bool syncOrConstellation, | ||||||
|  | 				bool slot1On, | ||||||
|  | 				bool slot2On) | ||||||
| 		{ | 		{ | ||||||
| 			return new MsgConfigureDSDDemod(rfBandwidth, | 			return new MsgConfigureDSDDemod(rfBandwidth, | ||||||
| 			        demodGain, | 			        demodGain, | ||||||
| @ -102,7 +108,9 @@ private: | |||||||
| 			        squelch, | 			        squelch, | ||||||
| 			        audioMute, | 			        audioMute, | ||||||
| 			        enableCosineFiltering, | 			        enableCosineFiltering, | ||||||
| 			        syncOrConstellation); | 			        syncOrConstellation, | ||||||
|  | 			        slot1On, | ||||||
|  | 			        slot2On); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	private: | 	private: | ||||||
| @ -116,6 +124,8 @@ private: | |||||||
| 		bool m_audioMute; | 		bool m_audioMute; | ||||||
| 		bool m_enableCosineFiltering; | 		bool m_enableCosineFiltering; | ||||||
| 		bool m_syncOrConstellation; | 		bool m_syncOrConstellation; | ||||||
|  |         bool m_slot1On; | ||||||
|  |         bool m_slot2On; | ||||||
| 
 | 
 | ||||||
| 		MsgConfigureDSDDemod(int rfBandwidth, | 		MsgConfigureDSDDemod(int rfBandwidth, | ||||||
| 				int  demodGain, | 				int  demodGain, | ||||||
| @ -126,7 +136,9 @@ private: | |||||||
| 				Real squelch, | 				Real squelch, | ||||||
| 				bool audioMute, | 				bool audioMute, | ||||||
| 				bool enableCosineFiltering, | 				bool enableCosineFiltering, | ||||||
| 				bool syncOrConstellation) : | 				bool syncOrConstellation, | ||||||
|  | 				bool slot1On, | ||||||
|  | 				bool slot2On) : | ||||||
| 			Message(), | 			Message(), | ||||||
| 			m_rfBandwidth(rfBandwidth), | 			m_rfBandwidth(rfBandwidth), | ||||||
| 			m_demodGain(demodGain), | 			m_demodGain(demodGain), | ||||||
| @ -137,7 +149,9 @@ private: | |||||||
| 			m_squelch(squelch), | 			m_squelch(squelch), | ||||||
| 			m_audioMute(audioMute), | 			m_audioMute(audioMute), | ||||||
| 			m_enableCosineFiltering(enableCosineFiltering), | 			m_enableCosineFiltering(enableCosineFiltering), | ||||||
| 			m_syncOrConstellation(syncOrConstellation) | 			m_syncOrConstellation(syncOrConstellation), | ||||||
|  | 			m_slot1On(slot1On), | ||||||
|  | 			m_slot2On(slot2On) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| @ -166,6 +180,8 @@ private: | |||||||
| 		quint32 m_audioSampleRate; | 		quint32 m_audioSampleRate; | ||||||
| 		bool m_enableCosineFiltering; | 		bool m_enableCosineFiltering; | ||||||
| 		bool m_syncOrConstellation; | 		bool m_syncOrConstellation; | ||||||
|  | 		bool m_slot1On; | ||||||
|  | 		bool m_slot2On; | ||||||
| 
 | 
 | ||||||
| 		Config() : | 		Config() : | ||||||
| 			m_inputSampleRate(-1), | 			m_inputSampleRate(-1), | ||||||
| @ -180,7 +196,9 @@ private: | |||||||
| 			m_audioMute(false), | 			m_audioMute(false), | ||||||
| 			m_audioSampleRate(0), | 			m_audioSampleRate(0), | ||||||
| 			m_enableCosineFiltering(false), | 			m_enableCosineFiltering(false), | ||||||
| 			m_syncOrConstellation(false) | 			m_syncOrConstellation(false), | ||||||
|  | 			m_slot1On(false), | ||||||
|  | 			m_slot2On(false) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -116,6 +116,8 @@ QByteArray DSDDemodGUI::serialize() const | |||||||
|     s.writeS32(11, ui->baudRate->currentIndex()); |     s.writeS32(11, ui->baudRate->currentIndex()); | ||||||
|     s.writeBool(12, m_enableCosineFiltering); |     s.writeBool(12, m_enableCosineFiltering); | ||||||
|     s.writeBool(13, m_syncOrConstellation); |     s.writeBool(13, m_syncOrConstellation); | ||||||
|  |     s.writeBool(14, m_slot1On); | ||||||
|  |     s.writeBool(15, m_slot2On); | ||||||
| 	return s.final(); | 	return s.final(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -165,6 +167,8 @@ bool DSDDemodGUI::deserialize(const QByteArray& data) | |||||||
|         ui->baudRate->setCurrentIndex(tmp); |         ui->baudRate->setCurrentIndex(tmp); | ||||||
|         d.readBool(12, &m_enableCosineFiltering, false); |         d.readBool(12, &m_enableCosineFiltering, false); | ||||||
|         d.readBool(13, &m_syncOrConstellation, false); |         d.readBool(13, &m_syncOrConstellation, false); | ||||||
|  |         d.readBool(14, &m_slot1On, false); | ||||||
|  |         d.readBool(15, &m_slot2On, false); | ||||||
| 
 | 
 | ||||||
| 		blockApplySettings(false); | 		blockApplySettings(false); | ||||||
| 		m_channelMarker.blockSignals(false); | 		m_channelMarker.blockSignals(false); | ||||||
| @ -251,6 +255,18 @@ void DSDDemodGUI::on_syncOrConstellation_toggled(bool checked) | |||||||
|     applySettings(); |     applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void DSDDemodGUI::on_slot1On_toggled(bool checked) | ||||||
|  | { | ||||||
|  |     m_slot1On = checked; | ||||||
|  |     applySettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void DSDDemodGUI::on_slot2On_toggled(bool checked) | ||||||
|  | { | ||||||
|  |     m_slot2On = checked; | ||||||
|  |     applySettings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void DSDDemodGUI::on_squelchGate_valueChanged(int value) | void DSDDemodGUI::on_squelchGate_valueChanged(int value) | ||||||
| { | { | ||||||
| 	applySettings(); | 	applySettings(); | ||||||
| @ -297,6 +313,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa | |||||||
| 	m_signalFormat(signalFormatNone), | 	m_signalFormat(signalFormatNone), | ||||||
| 	m_enableCosineFiltering(false), | 	m_enableCosineFiltering(false), | ||||||
| 	m_syncOrConstellation(false), | 	m_syncOrConstellation(false), | ||||||
|  | 	m_slot1On(false), | ||||||
|  | 	m_slot2On(false), | ||||||
| 	m_squelchOpen(false), | 	m_squelchOpen(false), | ||||||
| 	m_channelPowerDbAvg(20,0), | 	m_channelPowerDbAvg(20,0), | ||||||
| 	m_tickCount(0) | 	m_tickCount(0) | ||||||
| @ -373,6 +391,8 @@ void DSDDemodGUI::applySettings() | |||||||
| 	    ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1)); | 	    ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1)); | ||||||
| 	    ui->enableCosineFiltering->setChecked(m_enableCosineFiltering); | 	    ui->enableCosineFiltering->setChecked(m_enableCosineFiltering); | ||||||
| 	    ui->syncOrConstellation->setChecked(m_syncOrConstellation); | 	    ui->syncOrConstellation->setChecked(m_syncOrConstellation); | ||||||
|  | 	    ui->slot1On->setChecked(m_slot1On); | ||||||
|  |         ui->slot2On->setChecked(m_slot2On); | ||||||
| 
 | 
 | ||||||
| 		m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(), | 		m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(), | ||||||
| 			ui->rfBW->value(), | 			ui->rfBW->value(), | ||||||
| @ -384,7 +404,9 @@ void DSDDemodGUI::applySettings() | |||||||
| 			ui->squelch->value(), | 			ui->squelch->value(), | ||||||
| 			ui->audioMute->isChecked(), | 			ui->audioMute->isChecked(), | ||||||
| 			m_enableCosineFiltering, | 			m_enableCosineFiltering, | ||||||
| 			m_syncOrConstellation); | 			m_syncOrConstellation, | ||||||
|  | 			m_slot1On, | ||||||
|  | 			m_slot2On); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -67,6 +67,8 @@ private slots: | |||||||
|     void on_baudRate_currentIndexChanged(int index); |     void on_baudRate_currentIndexChanged(int index); | ||||||
|     void on_enableCosineFiltering_toggled(bool enable); |     void on_enableCosineFiltering_toggled(bool enable); | ||||||
|     void on_syncOrConstellation_toggled(bool checked); |     void on_syncOrConstellation_toggled(bool checked); | ||||||
|  |     void on_slot1On_toggled(bool checked); | ||||||
|  |     void on_slot2On_toggled(bool checked); | ||||||
| 	void on_fmDeviation_valueChanged(int value); | 	void on_fmDeviation_valueChanged(int value); | ||||||
| 	void on_squelchGate_valueChanged(int value); | 	void on_squelchGate_valueChanged(int value); | ||||||
| 	void on_squelch_valueChanged(int value); | 	void on_squelch_valueChanged(int value); | ||||||
| @ -100,6 +102,8 @@ private: | |||||||
| 	DSDDemod* m_dsdDemod; | 	DSDDemod* m_dsdDemod; | ||||||
| 	bool m_enableCosineFiltering; | 	bool m_enableCosineFiltering; | ||||||
| 	bool m_syncOrConstellation; | 	bool m_syncOrConstellation; | ||||||
|  | 	bool m_slot1On; | ||||||
|  |     bool m_slot2On; | ||||||
|     bool m_audioMute; |     bool m_audioMute; | ||||||
| 	bool m_squelchOpen; | 	bool m_squelchOpen; | ||||||
| 	MovingAverage<Real> m_channelPowerDbAvg; | 	MovingAverage<Real> m_channelPowerDbAvg; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user