2015-06-21 10:46:47 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2015-10-04 03:28:11 +00:00
|
|
|
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
2015-06-21 10:46:47 +00:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_CHANALYZER_H
|
|
|
|
#define INCLUDE_CHANALYZER_H
|
|
|
|
|
2016-10-02 20:29:04 +00:00
|
|
|
#include <dsp/basebandsamplesink.h>
|
2015-08-24 21:23:45 +00:00
|
|
|
#include <QMutex>
|
2015-06-21 10:46:47 +00:00
|
|
|
#include <vector>
|
2016-12-19 07:26:48 +00:00
|
|
|
#include "dsp/ncof.h"
|
2015-06-21 10:46:47 +00:00
|
|
|
#include "dsp/fftfilt.h"
|
|
|
|
#include "audio/audiofifo.h"
|
|
|
|
#include "util/message.h"
|
|
|
|
|
|
|
|
#define ssbFftLen 1024
|
|
|
|
|
2016-10-02 20:29:04 +00:00
|
|
|
class ChannelAnalyzer : public BasebandSampleSink {
|
2015-06-21 10:46:47 +00:00
|
|
|
public:
|
2016-10-02 20:29:04 +00:00
|
|
|
ChannelAnalyzer(BasebandSampleSink* m_sampleSink);
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual ~ChannelAnalyzer();
|
2015-06-21 10:46:47 +00:00
|
|
|
|
|
|
|
void configure(MessageQueue* messageQueue,
|
|
|
|
Real Bandwidth,
|
|
|
|
Real LowCutoff,
|
|
|
|
int spanLog2,
|
|
|
|
bool ssb);
|
|
|
|
|
2015-10-04 03:28:11 +00:00
|
|
|
int getSampleRate() const { return m_sampleRate; }
|
|
|
|
Real getMagSq() const { return m_magsq; }
|
2015-06-21 18:58:35 +00:00
|
|
|
|
2015-08-25 06:24:23 +00:00
|
|
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
2015-08-17 06:29:34 +00:00
|
|
|
virtual void start();
|
|
|
|
virtual void stop();
|
|
|
|
virtual bool handleMessage(const Message& cmd);
|
2015-06-21 10:46:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
class MsgConfigureChannelAnalyzer : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
Real getBandwidth() const { return m_Bandwidth; }
|
|
|
|
Real getLoCutoff() const { return m_LowCutoff; }
|
|
|
|
int getSpanLog2() const { return m_spanLog2; }
|
|
|
|
bool getSSB() const { return m_ssb; }
|
|
|
|
|
|
|
|
static MsgConfigureChannelAnalyzer* create(Real Bandwidth,
|
|
|
|
Real LowCutoff,
|
|
|
|
int spanLog2,
|
|
|
|
bool ssb)
|
|
|
|
{
|
|
|
|
return new MsgConfigureChannelAnalyzer(Bandwidth, LowCutoff, spanLog2, ssb);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Real m_Bandwidth;
|
|
|
|
Real m_LowCutoff;
|
|
|
|
int m_spanLog2;
|
|
|
|
bool m_ssb;
|
|
|
|
|
|
|
|
MsgConfigureChannelAnalyzer(Real Bandwidth,
|
|
|
|
Real LowCutoff,
|
|
|
|
int spanLog2,
|
|
|
|
bool ssb) :
|
|
|
|
Message(),
|
|
|
|
m_Bandwidth(Bandwidth),
|
|
|
|
m_LowCutoff(LowCutoff),
|
|
|
|
m_spanLog2(spanLog2),
|
|
|
|
m_ssb(ssb)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
Real m_Bandwidth;
|
|
|
|
Real m_LowCutoff;
|
|
|
|
int m_spanLog2;
|
|
|
|
int m_undersampleCount;
|
2015-09-28 00:39:48 +00:00
|
|
|
fftfilt::cmplx m_sum;
|
2015-06-21 10:46:47 +00:00
|
|
|
int m_sampleRate;
|
|
|
|
int m_frequency;
|
|
|
|
bool m_usb;
|
|
|
|
bool m_ssb;
|
2015-10-04 03:28:11 +00:00
|
|
|
Real m_magsq;
|
2015-06-21 10:46:47 +00:00
|
|
|
|
2016-12-19 07:26:48 +00:00
|
|
|
NCOF m_nco;
|
2015-06-21 10:46:47 +00:00
|
|
|
fftfilt* SSBFilter;
|
|
|
|
fftfilt* DSBFilter;
|
|
|
|
|
2016-10-02 20:29:04 +00:00
|
|
|
BasebandSampleSink* m_sampleSink;
|
2015-06-21 10:46:47 +00:00
|
|
|
SampleVector m_sampleBuffer;
|
2015-08-24 21:23:45 +00:00
|
|
|
QMutex m_settingsMutex;
|
2015-06-21 10:46:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_CHANALYZER_H
|