mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-30 12:42:25 -04:00
NFM: augmented CTCSS tones. Implements #664
This commit is contained in:
parent
e932d17fdb
commit
85e357d465
@ -70,7 +70,7 @@ Use the checkbox to toggle CTCSS activation. When activated it will look for a t
|
|||||||
|
|
||||||
<h3>11: CTCSS tone</h3>
|
<h3>11: CTCSS tone</h3>
|
||||||
|
|
||||||
This is the tone squelch in Hz. It can be selected using the toolbox among the usual CTCSS values and `--` for none. When a value is given and the CTCSS is activated the squelch will open only for signals with this tone squelch.
|
This is the tone squelch in Hz. It can be selected using the toolbox among [these CTCSS values](https://en.wikipedia.org/wiki/Continuous_Tone-Coded_Squelch_System) and `--` for none. When a value is given and the CTCSS is activated the squelch will open only for signals with this tone squelch.
|
||||||
|
|
||||||
<h3>12: CTCSS tone value</h3>
|
<h3>12: CTCSS tone value</h3>
|
||||||
|
|
||||||
|
@ -399,8 +399,7 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
|||||||
ui->tone->setChecked(false);
|
ui->tone->setChecked(false);
|
||||||
ui->mic->setChecked(false);
|
ui->mic->setChecked(false);
|
||||||
|
|
||||||
for (int i=0; i< NFMModSettings::m_nbCTCSSFreqs; i++)
|
for (int i=0; i< NFMModSettings::getNbCTCSSFreq(); i++) {
|
||||||
{
|
|
||||||
ui->ctcss->addItem(QString("%1").arg((double) NFMModSettings::getCTCSSFreq(i), 0, 'f', 1));
|
ui->ctcss->addItem(QString("%1").arg((double) NFMModSettings::getCTCSSFreq(i), 0, 'f', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include "dsp/ctcssfrequencies.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "settings/serializable.h"
|
#include "settings/serializable.h"
|
||||||
#include "nfmmodsettings.h"
|
#include "nfmmodsettings.h"
|
||||||
@ -28,14 +29,6 @@ const int NFMModSettings::m_rfBW[] = {
|
|||||||
};
|
};
|
||||||
const int NFMModSettings::m_nbRfBW = 11;
|
const int NFMModSettings::m_nbRfBW = 11;
|
||||||
|
|
||||||
const float NFMModSettings::m_ctcssFreqs[] = {
|
|
||||||
67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8,
|
|
||||||
97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8,
|
|
||||||
136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2,
|
|
||||||
192.8, 203.5
|
|
||||||
};
|
|
||||||
const int NFMModSettings::m_nbCTCSSFreqs = 32;
|
|
||||||
|
|
||||||
|
|
||||||
NFMModSettings::NFMModSettings() :
|
NFMModSettings::NFMModSettings() :
|
||||||
m_channelMarker(0),
|
m_channelMarker(0),
|
||||||
@ -215,27 +208,29 @@ int NFMModSettings::getRFBWIndex(int rfbw)
|
|||||||
return m_nbRfBW-1;
|
return m_nbRfBW-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NFMModSettings::getNbCTCSSFreq()
|
||||||
|
{
|
||||||
|
return CTCSSFrequencies::m_nbFreqs;
|
||||||
|
}
|
||||||
|
|
||||||
float NFMModSettings::getCTCSSFreq(int index)
|
float NFMModSettings::getCTCSSFreq(int index)
|
||||||
{
|
{
|
||||||
if (index < 0) {
|
if (index < CTCSSFrequencies::m_nbFreqs) {
|
||||||
return m_ctcssFreqs[0];
|
return CTCSSFrequencies::m_Freqs[index];
|
||||||
} else if (index < m_nbCTCSSFreqs) {
|
|
||||||
return m_ctcssFreqs[index];
|
|
||||||
} else {
|
} else {
|
||||||
return m_ctcssFreqs[m_nbCTCSSFreqs-1];
|
return CTCSSFrequencies::m_Freqs[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int NFMModSettings::getCTCSSFreqIndex(float ctcssFreq)
|
int NFMModSettings::getCTCSSFreqIndex(float ctcssFreq)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_nbCTCSSFreqs; i++)
|
for (int i = 0; i < CTCSSFrequencies::m_nbFreqs; i++)
|
||||||
{
|
{
|
||||||
if (ctcssFreq <= m_ctcssFreqs[i])
|
if (ctcssFreq <= CTCSSFrequencies::m_Freqs[i]) {
|
||||||
{
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_nbCTCSSFreqs-1;
|
return CTCSSFrequencies::m_nbFreqs - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@ struct NFMModSettings
|
|||||||
|
|
||||||
static const int m_nbRfBW;
|
static const int m_nbRfBW;
|
||||||
static const int m_rfBW[];
|
static const int m_rfBW[];
|
||||||
static const int m_nbCTCSSFreqs;
|
|
||||||
static const float m_ctcssFreqs[];
|
|
||||||
|
|
||||||
qint64 m_inputFrequencyOffset;
|
qint64 m_inputFrequencyOffset;
|
||||||
Real m_rfBandwidth;
|
Real m_rfBandwidth;
|
||||||
@ -80,6 +78,7 @@ struct NFMModSettings
|
|||||||
|
|
||||||
static int getRFBW(int index);
|
static int getRFBW(int index);
|
||||||
static int getRFBWIndex(int rfbw);
|
static int getRFBWIndex(int rfbw);
|
||||||
|
static int getNbCTCSSFreq();
|
||||||
static float getCTCSSFreq(int index);
|
static float getCTCSSFreq(int index);
|
||||||
static int getCTCSSFreqIndex(float ctcssFreq);
|
static int getCTCSSFreqIndex(float ctcssFreq);
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ Checkbox to switch on the CTCSS sub-audio tone
|
|||||||
|
|
||||||
<h3>12: CTSS tone frequency</h3>
|
<h3>12: CTSS tone frequency</h3>
|
||||||
|
|
||||||
Select the CTCSS sub-audio tone in Hz among these values: 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, 192.8 and 203.5 Hz
|
Select the CTCSS sub-audio tone in Hz among [these values](https://en.wikipedia.org/wiki/Continuous_Tone-Coded_Squelch_System)
|
||||||
|
|
||||||
<h3>14: CW (Morse) text</h3>
|
<h3>14: CW (Morse) text</h3>
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ set(sdrbase_SOURCES
|
|||||||
dsp/upchannelizer.cpp
|
dsp/upchannelizer.cpp
|
||||||
dsp/channelmarker.cpp
|
dsp/channelmarker.cpp
|
||||||
dsp/ctcssdetector.cpp
|
dsp/ctcssdetector.cpp
|
||||||
|
dsp/ctcssfrequencies.cpp
|
||||||
dsp/channelsamplesink.cpp
|
dsp/channelsamplesink.cpp
|
||||||
dsp/channelsamplesource.cpp
|
dsp/channelsamplesource.cpp
|
||||||
dsp/cwkeyer.cpp
|
dsp/cwkeyer.cpp
|
||||||
@ -219,6 +220,8 @@ set(sdrbase_HEADERS
|
|||||||
dsp/channelsamplesink.h
|
dsp/channelsamplesink.h
|
||||||
dsp/channelsamplesource.h
|
dsp/channelsamplesource.h
|
||||||
dsp/complex.h
|
dsp/complex.h
|
||||||
|
dsp/ctcssdetector.h
|
||||||
|
dsp/ctcssfrequencies.h
|
||||||
dsp/cwkeyer.h
|
dsp/cwkeyer.h
|
||||||
dsp/cwkeyersettings.h
|
dsp/cwkeyersettings.h
|
||||||
dsp/decimators.h
|
dsp/decimators.h
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "dsp/ctcssdetector.h"
|
#include "dsp/ctcssdetector.h"
|
||||||
|
#include "ctcssfrequencies.h"
|
||||||
|
|
||||||
#undef M_PI
|
#undef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
@ -18,47 +19,14 @@ CTCSSDetector::CTCSSDetector() :
|
|||||||
toneDetected(false),
|
toneDetected(false),
|
||||||
maxPower(0.0)
|
maxPower(0.0)
|
||||||
{
|
{
|
||||||
nTones = 32;
|
nTones = CTCSSFrequencies::m_nbFreqs;
|
||||||
k = new Real[nTones];
|
k = new Real[nTones];
|
||||||
coef = new Real[nTones];
|
coef = new Real[nTones];
|
||||||
toneSet = new Real[nTones];
|
toneSet = new Real[nTones];
|
||||||
u0 = new Real[nTones];
|
u0 = new Real[nTones];
|
||||||
u1 = new Real[nTones];
|
u1 = new Real[nTones];
|
||||||
power = new Real[nTones];
|
power = new Real[nTones];
|
||||||
|
toneSet = CTCSSFrequencies::m_Freqs;
|
||||||
// The 32 EIA standard tones
|
|
||||||
toneSet[0] = 67.0;
|
|
||||||
toneSet[1] = 71.9;
|
|
||||||
toneSet[2] = 74.4;
|
|
||||||
toneSet[3] = 77.0;
|
|
||||||
toneSet[4] = 79.7;
|
|
||||||
toneSet[5] = 82.5;
|
|
||||||
toneSet[6] = 85.4;
|
|
||||||
toneSet[7] = 88.5;
|
|
||||||
toneSet[8] = 91.5;
|
|
||||||
toneSet[9] = 94.8;
|
|
||||||
toneSet[10] = 97.4;
|
|
||||||
toneSet[11] = 100.0;
|
|
||||||
toneSet[12] = 103.5;
|
|
||||||
toneSet[13] = 107.2;
|
|
||||||
toneSet[14] = 110.9;
|
|
||||||
toneSet[15] = 114.8;
|
|
||||||
toneSet[16] = 118.8;
|
|
||||||
toneSet[17] = 123.0;
|
|
||||||
toneSet[18] = 127.3;
|
|
||||||
toneSet[19] = 131.8;
|
|
||||||
toneSet[20] = 136.5;
|
|
||||||
toneSet[21] = 141.3;
|
|
||||||
toneSet[22] = 146.2;
|
|
||||||
toneSet[23] = 151.4;
|
|
||||||
toneSet[24] = 156.7;
|
|
||||||
toneSet[25] = 162.2;
|
|
||||||
toneSet[26] = 167.9;
|
|
||||||
toneSet[27] = 173.8;
|
|
||||||
toneSet[28] = 179.9;
|
|
||||||
toneSet[29] = 186.2;
|
|
||||||
toneSet[30] = 192.8;
|
|
||||||
toneSet[31] = 203.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CTCSSDetector::CTCSSDetector(int _nTones, Real *tones) :
|
CTCSSDetector::CTCSSDetector(int _nTones, Real *tones) :
|
||||||
@ -69,18 +37,14 @@ CTCSSDetector::CTCSSDetector(int _nTones, Real *tones) :
|
|||||||
toneDetected(false),
|
toneDetected(false),
|
||||||
maxPower(0.0)
|
maxPower(0.0)
|
||||||
{
|
{
|
||||||
nTones = _nTones;
|
nTones = CTCSSFrequencies::m_nbFreqs;
|
||||||
k = new Real[nTones];
|
k = new Real[nTones];
|
||||||
coef = new Real[nTones];
|
coef = new Real[nTones];
|
||||||
toneSet = new Real[nTones];
|
toneSet = new Real[nTones];
|
||||||
u0 = new Real[nTones];
|
u0 = new Real[nTones];
|
||||||
u1 = new Real[nTones];
|
u1 = new Real[nTones];
|
||||||
power = new Real[nTones];
|
power = new Real[nTones];
|
||||||
|
toneSet = CTCSSFrequencies::m_Freqs;
|
||||||
for (int j = 0; j < nTones; ++j)
|
|
||||||
{
|
|
||||||
toneSet[j] = tones[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ private:
|
|||||||
Real maxPower;
|
Real maxPower;
|
||||||
Real *k;
|
Real *k;
|
||||||
Real *coef;
|
Real *coef;
|
||||||
Real *toneSet;
|
const float *toneSet;
|
||||||
Real *u0;
|
Real *u0;
|
||||||
Real *u1;
|
Real *u1;
|
||||||
Real *power;
|
Real *power;
|
||||||
|
75
sdrbase/dsp/ctcssfrequencies.cpp
Normal file
75
sdrbase/dsp/ctcssfrequencies.cpp
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// 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 //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ctcssfrequencies.h"
|
||||||
|
|
||||||
|
// The 51 tones from various standards (https://en.wikipedia.org/wiki/Continuous_Tone-Coded_Squelch_System)
|
||||||
|
const float CTCSSFrequencies::m_Freqs[] = {
|
||||||
|
67.0, // 0
|
||||||
|
69.3,
|
||||||
|
71.9,
|
||||||
|
74.4,
|
||||||
|
77.0,
|
||||||
|
79.7,
|
||||||
|
82.5,
|
||||||
|
85.4,
|
||||||
|
88.5,
|
||||||
|
91.5,
|
||||||
|
94.8, // 10
|
||||||
|
97.4,
|
||||||
|
100.0,
|
||||||
|
103.5,
|
||||||
|
107.2,
|
||||||
|
110.9,
|
||||||
|
114.8,
|
||||||
|
118.8,
|
||||||
|
123.0,
|
||||||
|
127.3,
|
||||||
|
131.8, // 20
|
||||||
|
136.5,
|
||||||
|
141.3,
|
||||||
|
146.2,
|
||||||
|
150.0,
|
||||||
|
151.4,
|
||||||
|
156.7,
|
||||||
|
159.8,
|
||||||
|
162.2,
|
||||||
|
165.5,
|
||||||
|
167.9, // 30
|
||||||
|
171.3,
|
||||||
|
173.8,
|
||||||
|
177.3,
|
||||||
|
179.9,
|
||||||
|
183.5,
|
||||||
|
186.2,
|
||||||
|
189.9,
|
||||||
|
192.8,
|
||||||
|
196.6,
|
||||||
|
199.5, // 40
|
||||||
|
203.5,
|
||||||
|
206.5,
|
||||||
|
210.7,
|
||||||
|
218.1,
|
||||||
|
225.7,
|
||||||
|
229.1,
|
||||||
|
233.6,
|
||||||
|
241.8,
|
||||||
|
250.3,
|
||||||
|
254.1, // 50
|
||||||
|
};
|
||||||
|
|
||||||
|
const int CTCSSFrequencies::m_nbFreqs = 51;
|
23
sdrbase/dsp/ctcssfrequencies.h
Normal file
23
sdrbase/dsp/ctcssfrequencies.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// 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 //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
|
struct SDRBASE_API CTCSSFrequencies {
|
||||||
|
static const int m_nbFreqs;
|
||||||
|
static const float m_Freqs[];
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user