aboutsummaryrefslogtreecommitdiffstats
path: root/src/nmt
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-06-10 17:11:47 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2017-06-10 17:11:47 +0200
commit19afb792b55e80e62a3bb7d9ae2cfb770ecec773 (patch)
tree04f09fe27a0cdf6323e2f653eccb8d9d3916f1ac /src/nmt
parent50b2021d2168917d9fc395abb03d05fff5d36486 (diff)
NMT: Fix and adjustements to supervisory signal detection
Diffstat (limited to 'src/nmt')
-rw-r--r--src/nmt/dsp.c7
-rw-r--r--src/nmt/main.c10
2 files changed, 10 insertions, 7 deletions
diff --git a/src/nmt/dsp.c b/src/nmt/dsp.c
index 17b9807..3d4aa82 100644
--- a/src/nmt/dsp.c
+++ b/src/nmt/dsp.c
@@ -65,7 +65,8 @@
#define DIALTONE_HZ 425.0 /* dial tone frequency */
#define TX_PEAK_DIALTONE 0.5 /* dial tone peak FIXME */
#define SUPER_DURATION 0.25 /* duration of supervisory signal measurement */
-#define SUPER_DETECT_COUNT 4 /* number of measures to detect supervisory signal */
+#define SUPER_LOST_COUNT 4 /* number of measures to loose supervisory signal */
+#define SUPER_DETECT_COUNT 6 /* number of measures to detect supervisory signal */
#define MUTE_DURATION 0.280 /* a tiny bit more than two frames */
/* two signaling tones */
@@ -385,7 +386,7 @@ static void super_decode(nmt_t *nmt, sample_t *samples, int length)
if (nmt->state == STATE_ACTIVE)
PDEBUG_CHAN(DDSP, DEBUG_NOTICE, "Supervisory level %.0f%% quality %.0f%%\n", result[0] / 0.63662 / TX_PEAK_SUPER * 100.0, quality * 100.0);
- if (quality > 0.5) {
+ if (quality > 0.7) {
if (nmt->super_detected == 0) {
nmt->super_detect_count++;
if (nmt->super_detect_count == SUPER_DETECT_COUNT) {
@@ -399,7 +400,7 @@ static void super_decode(nmt_t *nmt, sample_t *samples, int length)
} else {
if (nmt->super_detected == 1) {
nmt->super_detect_count++;
- if (nmt->super_detect_count == SUPER_DETECT_COUNT) {
+ if (nmt->super_detect_count == SUPER_LOST_COUNT) {
nmt->super_detected = 0;
nmt->super_detect_count = 0;
PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Supervisory signal lost.\n");
diff --git a/src/nmt/main.c b/src/nmt/main.c
index 1c3a0e4..9bdc2e8 100644
--- a/src/nmt/main.c
+++ b/src/nmt/main.c
@@ -289,10 +289,12 @@ int main(int argc, char *argv[])
chan_type[i] = CHAN_TYPE_CC_TC;
num_chan_type = num_kanal;
}
- /* set supervisory signal */
- for (i = 0; i < num_kanal; i++)
- supervisory[i] = 0;
- num_supervisory = num_kanal;
+ if (num_supervisory == 0) {
+ /* set supervisory signal */
+ for (i = 0; i < num_kanal; i++)
+ supervisory[i] = (i % 4) + 1;
+ num_supervisory = num_kanal;
+ }
}
if (num_kanal == 1 && num_audiodev == 0)
num_audiodev = 1; /* use default */