SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
sdrbase
dsp
ctcssdetector.h
Go to the documentation of this file.
1
/*
2
* ctcssdetector.h
3
*
4
* Created on: Jun 16, 2015
5
* Author: f4exb
6
* See: http://www.embedded.com/design/connectivity/4025660/Detecting-CTCSS-tones-with-Goertzel-s-algorithm
7
*/
8
9
#ifndef INCLUDE_GPL_DSP_CTCSSDETECTOR_H_
10
#define INCLUDE_GPL_DSP_CTCSSDETECTOR_H_
11
12
#include "
dsp/dsptypes.h
"
13
#include "
export.h
"
14
19
class
SDRBASE_API
CTCSSDetector
{
20
public
:
21
// Constructors and Destructor
22
CTCSSDetector
();
23
// allows user defined CTCSS tone set
24
CTCSSDetector
(
int
_nTones,
Real
*tones);
25
virtual
~
CTCSSDetector
();
26
27
// setup the basic parameters and coefficients
28
void
setCoefficients(
29
int
zN,
// the algorithm "block" size
30
int
SampleRate);
// input signal sample rate
31
32
// set the detection threshold
33
void
setThreshold(
double
thold);
34
35
// analyze a sample set and optionally filter
36
// the tone frequencies.
37
bool
analyze(
Real
*sample);
// input signal sample
38
39
// get the number of defined tones.
40
int
getNTones
()
const
{
41
return
nTones;
42
}
43
44
// get the tone set
45
const
Real
*
getToneSet
()
const
46
{
47
return
toneSet;
48
}
49
50
// get the currently detected tone, if any
51
bool
getDetectedTone
(
int
&maxTone)
const
52
{
53
maxTone = maxPowerIndex;
54
return
toneDetected;
55
}
56
57
// Get the max power at the detected tone.
58
Real
getMaxPower
()
const
59
{
60
return
maxPower;
61
}
62
63
void
reset();
// reset the analysis algorithm
64
65
protected
:
66
// Override these to change behavior of the detector
67
virtual
void
initializePower();
68
virtual
void
evaluatePower();
69
void
feedback(
Real
sample);
70
void
feedForward();
71
72
private
:
73
int
N
;
74
int
sampleRate
;
75
int
nTones
;
76
int
samplesProcessed
;
77
int
maxPowerIndex
;
78
bool
toneDetected
;
79
Real
maxPower
;
80
Real
*
k
;
81
Real
*
coef
;
82
Real
*
toneSet
;
83
Real
*
u0
;
84
Real
*
u1
;
85
Real
*
power
;
86
};
87
88
89
#endif
/* INCLUDE_GPL_DSP_CTCSSDETECTOR_H_ */
CTCSSDetector::getToneSet
const Real * getToneSet() const
Definition:
ctcssdetector.h:45
CTCSSDetector::maxPower
Real maxPower
Definition:
ctcssdetector.h:79
CTCSSDetector::sampleRate
int sampleRate
Definition:
ctcssdetector.h:74
export.h
CTCSSDetector::nTones
int nTones
Definition:
ctcssdetector.h:75
dsptypes.h
CTCSSDetector::getDetectedTone
bool getDetectedTone(int &maxTone) const
Definition:
ctcssdetector.h:51
CTCSSDetector::u1
Real * u1
Definition:
ctcssdetector.h:84
CTCSSDetector::maxPowerIndex
int maxPowerIndex
Definition:
ctcssdetector.h:77
CTCSSDetector::getNTones
int getNTones() const
Definition:
ctcssdetector.h:40
CTCSSDetector::power
Real * power
Definition:
ctcssdetector.h:85
CTCSSDetector
Definition:
ctcssdetector.h:19
CTCSSDetector::coef
Real * coef
Definition:
ctcssdetector.h:81
CTCSSDetector::toneDetected
bool toneDetected
Definition:
ctcssdetector.h:78
CTCSSDetector::toneSet
Real * toneSet
Definition:
ctcssdetector.h:82
CTCSSDetector::getMaxPower
Real getMaxPower() const
Definition:
ctcssdetector.h:58
SDRBASE_API
#define SDRBASE_API
Definition:
export.h:40
CTCSSDetector::u0
Real * u0
Definition:
ctcssdetector.h:83
Real
float Real
Definition:
dsptypes.h:42
CTCSSDetector::N
int N
Definition:
ctcssdetector.h:73
CTCSSDetector::samplesProcessed
int samplesProcessed
Definition:
ctcssdetector.h:76
CTCSSDetector::k
Real * k
Definition:
ctcssdetector.h:80
Generated on Fri Aug 2 2019 17:56:33 for SDRAngel by
1.8.13