mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	AM demod: implement mute/umute toggle
This commit is contained in:
		
							parent
							
								
									d46ab16ead
								
							
						
					
					
						commit
						61d6d90ce3
					
				| @ -58,9 +58,9 @@ AMDemod::~AMDemod() | |||||||
| 	DSPEngine::instance()->removeAudioSink(&m_audioFifo); | 	DSPEngine::instance()->removeAudioSink(&m_audioFifo); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) | void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) | ||||||
| { | { | ||||||
| 	Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, afBandwidth, volume, squelch); | 	Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioMute); | ||||||
| 	messageQueue->push(cmd); | 	messageQueue->push(cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -103,7 +103,7 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector | |||||||
| 
 | 
 | ||||||
| 			qint16 sample; | 			qint16 sample; | ||||||
| 
 | 
 | ||||||
| 			if (m_squelchCount >= m_running.m_audioSampleRate / 20) | 			if ((m_squelchCount >= m_running.m_audioSampleRate / 20) && !m_running.m_audioMute) | ||||||
| 			{ | 			{ | ||||||
| 				Real demod = sqrt(magsq); | 				Real demod = sqrt(magsq); | ||||||
| 
 | 
 | ||||||
| @ -208,6 +208,7 @@ bool AMDemod::handleMessage(const Message& cmd) | |||||||
| 		m_config.m_afBandwidth = cfg.getAFBandwidth(); | 		m_config.m_afBandwidth = cfg.getAFBandwidth(); | ||||||
| 		m_config.m_volume = cfg.getVolume(); | 		m_config.m_volume = cfg.getVolume(); | ||||||
| 		m_config.m_squelch = cfg.getSquelch(); | 		m_config.m_squelch = cfg.getSquelch(); | ||||||
|  | 		m_config.m_audioMute = cfg.getAudioMute(); | ||||||
| 
 | 
 | ||||||
| 		apply(); | 		apply(); | ||||||
| 
 | 
 | ||||||
| @ -215,7 +216,8 @@ bool AMDemod::handleMessage(const Message& cmd) | |||||||
| 				<< " m_rfBandwidth: " << m_config.m_rfBandwidth | 				<< " m_rfBandwidth: " << m_config.m_rfBandwidth | ||||||
| 				<< " m_afBandwidth: " << m_config.m_afBandwidth | 				<< " m_afBandwidth: " << m_config.m_afBandwidth | ||||||
| 				<< " m_volume: " << m_config.m_volume | 				<< " m_volume: " << m_config.m_volume | ||||||
| 				<< " m_squelch: " << m_config.m_squelch; | 				<< " m_squelch: " << m_config.m_squelch | ||||||
|  | 				<< " m_audioMute: " << m_config.m_audioMute; | ||||||
| 
 | 
 | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @ -265,4 +267,5 @@ void AMDemod::apply() | |||||||
| 	m_running.m_squelch = m_config.m_squelch; | 	m_running.m_squelch = m_config.m_squelch; | ||||||
| 	m_running.m_volume = m_config.m_volume; | 	m_running.m_volume = m_config.m_volume; | ||||||
| 	m_running.m_audioSampleRate = m_config.m_audioSampleRate; | 	m_running.m_audioSampleRate = m_config.m_audioSampleRate; | ||||||
|  | 	m_running.m_audioMute = m_config.m_audioMute; | ||||||
| } | } | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ public: | |||||||
| 	AMDemod(); | 	AMDemod(); | ||||||
| 	~AMDemod(); | 	~AMDemod(); | ||||||
| 
 | 
 | ||||||
| 	void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch); | 	void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute); | ||||||
| 
 | 
 | ||||||
| 	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(); | ||||||
| @ -52,10 +52,11 @@ private: | |||||||
| 		Real getAFBandwidth() const { return m_afBandwidth; } | 		Real getAFBandwidth() const { return m_afBandwidth; } | ||||||
| 		Real getVolume() const { return m_volume; } | 		Real getVolume() const { return m_volume; } | ||||||
| 		Real getSquelch() const { return m_squelch; } | 		Real getSquelch() const { return m_squelch; } | ||||||
|  | 		bool getAudioMute() const { return m_audioMute; } | ||||||
| 
 | 
 | ||||||
| 		static MsgConfigureAMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) | 		static MsgConfigureAMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) | ||||||
| 		{ | 		{ | ||||||
| 			return new MsgConfigureAMDemod(rfBandwidth, afBandwidth, volume, squelch); | 			return new MsgConfigureAMDemod(rfBandwidth, afBandwidth, volume, squelch, audioMute); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	private: | 	private: | ||||||
| @ -63,13 +64,15 @@ private: | |||||||
| 		Real m_afBandwidth; | 		Real m_afBandwidth; | ||||||
| 		Real m_volume; | 		Real m_volume; | ||||||
| 		Real m_squelch; | 		Real m_squelch; | ||||||
|  | 		bool m_audioMute; | ||||||
| 
 | 
 | ||||||
| 		MsgConfigureAMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) : | 		MsgConfigureAMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) : | ||||||
| 			Message(), | 			Message(), | ||||||
| 			m_rfBandwidth(rfBandwidth), | 			m_rfBandwidth(rfBandwidth), | ||||||
| 			m_afBandwidth(afBandwidth), | 			m_afBandwidth(afBandwidth), | ||||||
| 			m_volume(volume), | 			m_volume(volume), | ||||||
| 			m_squelch(squelch) | 			m_squelch(squelch), | ||||||
|  | 			m_audioMute(audioMute) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| @ -92,6 +95,7 @@ private: | |||||||
| 		Real m_squelch; | 		Real m_squelch; | ||||||
| 		Real m_volume; | 		Real m_volume; | ||||||
| 		quint32 m_audioSampleRate; | 		quint32 m_audioSampleRate; | ||||||
|  | 		bool m_audioMute; | ||||||
| 
 | 
 | ||||||
| 		Config() : | 		Config() : | ||||||
| 			m_inputSampleRate(-1), | 			m_inputSampleRate(-1), | ||||||
| @ -100,7 +104,8 @@ private: | |||||||
| 			m_afBandwidth(-1), | 			m_afBandwidth(-1), | ||||||
| 			m_squelch(0), | 			m_squelch(0), | ||||||
| 			m_volume(0), | 			m_volume(0), | ||||||
| 			m_audioSampleRate(0) | 			m_audioSampleRate(0), | ||||||
|  | 			m_audioMute(false) | ||||||
| 		{ } | 		{ } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -179,6 +179,10 @@ void AMDemodGUI::on_squelch_valueChanged(int value) | |||||||
| 	applySettings(); | 	applySettings(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void AMDemodGUI::on_audioMute_toggled(bool checked) | ||||||
|  | { | ||||||
|  | 	applySettings(); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| void AMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) | void AMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) | ||||||
| { | { | ||||||
| @ -263,7 +267,8 @@ void AMDemodGUI::applySettings() | |||||||
| 			m_rfBW[ui->rfBW->value()], | 			m_rfBW[ui->rfBW->value()], | ||||||
| 			ui->afBW->value() * 1000.0, | 			ui->afBW->value() * 1000.0, | ||||||
| 			ui->volume->value() / 10.0, | 			ui->volume->value() / 10.0, | ||||||
| 			ui->squelch->value()); | 			ui->squelch->value(), | ||||||
|  | 			ui->audioMute->isChecked()); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -42,6 +42,7 @@ private slots: | |||||||
| 	void on_afBW_valueChanged(int value); | 	void on_afBW_valueChanged(int value); | ||||||
| 	void on_volume_valueChanged(int value); | 	void on_volume_valueChanged(int value); | ||||||
| 	void on_squelch_valueChanged(int value); | 	void on_squelch_valueChanged(int value); | ||||||
|  | 	void on_audioMute_toggled(bool checked); | ||||||
| 	void onWidgetRolled(QWidget* widget, bool rollDown); | 	void onWidgetRolled(QWidget* widget, bool rollDown); | ||||||
| 	void onMenuDoubleClicked(); | 	void onMenuDoubleClicked(); | ||||||
| 	void tick(); | 	void tick(); | ||||||
|  | |||||||
| @ -139,6 +139,24 @@ | |||||||
|           </property> |           </property> | ||||||
|          </widget> |          </widget> | ||||||
|         </item> |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QToolButton" name="audioMute"> | ||||||
|  |           <property name="toolTip"> | ||||||
|  |            <string>Mute/Unmute audio</string> | ||||||
|  |           </property> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>...</string> | ||||||
|  |           </property> | ||||||
|  |           <property name="icon"> | ||||||
|  |            <iconset resource="../../../sdrbase/resources/res.qrc"> | ||||||
|  |             <normaloff>:/sound_on.png</normaloff> | ||||||
|  |             <normalon>:/sound_off.png</normalon>:/sound_on.png</iconset> | ||||||
|  |           </property> | ||||||
|  |           <property name="checkable"> | ||||||
|  |            <bool>true</bool> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|        </layout> |        </layout> | ||||||
|       </item> |       </item> | ||||||
|      </layout> |      </layout> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user