mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 13:11:20 -05:00 
			
		
		
		
	NFM demod: GUI and demod separation phase1 (3)
This commit is contained in:
		
							parent
							
								
									7d484181cc
								
							
						
					
					
						commit
						49db1b2273
					
				@ -33,6 +33,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureNFMDemod, Message)
 | 
					MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureNFMDemod, Message)
 | 
				
			||||||
MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureChannelizer, Message)
 | 
					MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureChannelizer, Message)
 | 
				
			||||||
 | 
					MESSAGE_CLASS_DEFINITION(NFMDemod::MsgReportCTCSSFreq, Message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const double afSqTones[2] = {1000.0, 6000.0}; // {1200.0, 8000.0};
 | 
					static const double afSqTones[2] = {1000.0, 6000.0}; // {1200.0, 8000.0};
 | 
				
			||||||
const int NFMDemod::m_udpBlockSize = 512;
 | 
					const int NFMDemod::m_udpBlockSize = 512;
 | 
				
			||||||
@ -240,7 +241,10 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
				
			|||||||
								{
 | 
													{
 | 
				
			||||||
									if (maxToneIndex+1 != m_ctcssIndex)
 | 
														if (maxToneIndex+1 != m_ctcssIndex)
 | 
				
			||||||
									{
 | 
														{
 | 
				
			||||||
										m_nfmDemodGUI->setCtcssFreq(m_ctcssDetector.getToneSet()[maxToneIndex]);
 | 
														    if (getMessageQueueToGUI()) {
 | 
				
			||||||
 | 
														        MsgReportCTCSSFreq *msg = MsgReportCTCSSFreq::create(m_ctcssDetector.getToneSet()[maxToneIndex]);
 | 
				
			||||||
 | 
														        getMessageQueueToGUI()->push(msg);
 | 
				
			||||||
 | 
														    }
 | 
				
			||||||
										m_ctcssIndex = maxToneIndex+1;
 | 
															m_ctcssIndex = maxToneIndex+1;
 | 
				
			||||||
									}
 | 
														}
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
@ -248,7 +252,10 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
				
			|||||||
								{
 | 
													{
 | 
				
			||||||
									if (m_ctcssIndex != 0)
 | 
														if (m_ctcssIndex != 0)
 | 
				
			||||||
									{
 | 
														{
 | 
				
			||||||
										m_nfmDemodGUI->setCtcssFreq(0);
 | 
					                                        if (getMessageQueueToGUI()) {
 | 
				
			||||||
 | 
					                                            MsgReportCTCSSFreq *msg = MsgReportCTCSSFreq::create(0);
 | 
				
			||||||
 | 
					                                            getMessageQueueToGUI()->push(msg);
 | 
				
			||||||
 | 
					                                        }
 | 
				
			||||||
										m_ctcssIndex = 0;
 | 
															m_ctcssIndex = 0;
 | 
				
			||||||
									}
 | 
														}
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
@ -273,8 +280,12 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
					if (m_ctcssIndex != 0)
 | 
										if (m_ctcssIndex != 0)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						m_nfmDemodGUI->setCtcssFreq(0);
 | 
					                        if (getMessageQueueToGUI()) {
 | 
				
			||||||
						m_ctcssIndex = 0;
 | 
					                            MsgReportCTCSSFreq *msg = MsgReportCTCSSFreq::create(0);
 | 
				
			||||||
 | 
					                            getMessageQueueToGUI()->push(msg);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        m_ctcssIndex = 0;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					sample = 0;
 | 
										sample = 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,6 @@
 | 
				
			|||||||
class DeviceSourceAPI;
 | 
					class DeviceSourceAPI;
 | 
				
			||||||
class ThreadedBasebandSampleSink;
 | 
					class ThreadedBasebandSampleSink;
 | 
				
			||||||
class DownChannelizer;
 | 
					class DownChannelizer;
 | 
				
			||||||
class NFMDemodGUI;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NFMDemod : public BasebandSampleSink {
 | 
					class NFMDemod : public BasebandSampleSink {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -88,7 +87,27 @@ public:
 | 
				
			|||||||
        { }
 | 
					        { }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	NFMDemod(DeviceSourceAPI *deviceAPI);
 | 
					    class MsgReportCTCSSFreq : public Message {
 | 
				
			||||||
 | 
					        MESSAGE_CLASS_DECLARATION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
 | 
					        Real getFrequency() const { return m_freq; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        static MsgReportCTCSSFreq* create(Real freq)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return new MsgReportCTCSSFreq(freq);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private:
 | 
				
			||||||
 | 
					        Real m_freq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MsgReportCTCSSFreq(Real freq) :
 | 
				
			||||||
 | 
					            Message(),
 | 
				
			||||||
 | 
					            m_freq(freq)
 | 
				
			||||||
 | 
					        { }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    NFMDemod(DeviceSourceAPI *deviceAPI);
 | 
				
			||||||
	~NFMDemod();
 | 
						~NFMDemod();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	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);
 | 
				
			||||||
@ -96,10 +115,6 @@ public:
 | 
				
			|||||||
	virtual void stop();
 | 
						virtual void stop();
 | 
				
			||||||
	virtual bool handleMessage(const Message& cmd);
 | 
						virtual bool handleMessage(const Message& cmd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void registerGUI(NFMDemodGUI *nfmDemodGUI) {
 | 
					 | 
				
			||||||
		m_nfmDemodGUI = nfmDemodGUI;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const Real *getCtcssToneSet(int& nbTones) const {
 | 
						const Real *getCtcssToneSet(int& nbTones) const {
 | 
				
			||||||
		nbTones = m_ctcssDetector.getNTones();
 | 
							nbTones = m_ctcssDetector.getNTones();
 | 
				
			||||||
		return m_ctcssDetector.getToneSet();
 | 
							return m_ctcssDetector.getToneSet();
 | 
				
			||||||
@ -174,7 +189,6 @@ private:
 | 
				
			|||||||
	AudioFifo m_audioFifo;
 | 
						AudioFifo m_audioFifo;
 | 
				
			||||||
    UDPSink<qint16> *m_udpBufferAudio;
 | 
					    UDPSink<qint16> *m_udpBufferAudio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	NFMDemodGUI *m_nfmDemodGUI;
 | 
					 | 
				
			||||||
	QMutex m_settingsMutex;
 | 
						QMutex m_settingsMutex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PhaseDiscriminators m_phaseDiscri;
 | 
					    PhaseDiscriminators m_phaseDiscri;
 | 
				
			||||||
 | 
				
			|||||||
@ -160,7 +160,28 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool NFMDemodGUI::handleMessage(const Message& message __attribute__((unused)))
 | 
					bool NFMDemodGUI::handleMessage(const Message& message __attribute__((unused)))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return false;
 | 
					    if (NFMDemod::MsgReportCTCSSFreq::match(message))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        NFMDemod::MsgReportCTCSSFreq& report = (NFMDemod::MsgReportCTCSSFreq&) message;
 | 
				
			||||||
 | 
					        setCtcssFreq(report.getFrequency());
 | 
				
			||||||
 | 
					        //qDebug("NFMDemodGUI::handleMessage: MsgReportCTCSSFreq: %f", report.getFrequency());
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void NFMDemodGUI::handleInputMessages()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Message* message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while ((message = getInputMessageQueue()->pop()) != 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (handleMessage(*message))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            delete message;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void NFMDemodGUI::channelMarkerChanged()
 | 
					void NFMDemodGUI::channelMarkerChanged()
 | 
				
			||||||
@ -303,7 +324,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
 | 
				
			|||||||
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
 | 
					    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_nfmDemod = new NFMDemod(m_deviceAPI);
 | 
						m_nfmDemod = new NFMDemod(m_deviceAPI);
 | 
				
			||||||
	m_nfmDemod->registerGUI(this);
 | 
						m_nfmDemod->setMessageQueueToGUI(getInputMessageQueue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
 | 
						connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -354,6 +375,8 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
 | 
				
			|||||||
	QChar delta = QChar(0x94, 0x03);
 | 
						QChar delta = QChar(0x94, 0x03);
 | 
				
			||||||
	ui->deltaSquelch->setText(delta);
 | 
						ui->deltaSquelch->setText(delta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	applySettings(true);
 | 
						applySettings(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -55,6 +55,7 @@ private slots:
 | 
				
			|||||||
    void on_copyAudioToUDP_toggled(bool checked);
 | 
					    void on_copyAudioToUDP_toggled(bool checked);
 | 
				
			||||||
	void onWidgetRolled(QWidget* widget, bool rollDown);
 | 
						void onWidgetRolled(QWidget* widget, bool rollDown);
 | 
				
			||||||
	void onMenuDialogCalled(const QPoint& p);
 | 
						void onMenuDialogCalled(const QPoint& p);
 | 
				
			||||||
 | 
					    void handleInputMessages();
 | 
				
			||||||
	void tick();
 | 
						void tick();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user