2017-01-30 08:10:30 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
2023-05-18 16:16:05 -04:00
|
|
|
*
|
2017-01-30 08:10:30 -05:00
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* 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; either version 2, 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TONESETS_H__
|
|
|
|
#define __TONESETS_H__
|
|
|
|
|
2017-03-14 04:20:13 -04:00
|
|
|
#include <memory>
|
2023-06-09 15:50:42 -04:00
|
|
|
#include <array>
|
2017-01-30 08:10:30 -05:00
|
|
|
|
|
|
|
#define TONES_SAMPLERATE 1536000
|
2018-05-15 18:35:30 -04:00
|
|
|
#define TONES_DELTA_COEF(sr) ((1ULL << 32) / sr)
|
|
|
|
#define TONES_F2D(f, sr) (uint32_t)(f * TONES_DELTA_COEF(sr))
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-03-14 04:20:13 -04:00
|
|
|
#define BEEP_TONES_NB 6
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
#define DTMF_C0 TONES_F2D(1209, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_C1 TONES_F2D(1336, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_C2 TONES_F2D(1477, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_C3 TONES_F2D(1633, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_R0 TONES_F2D(697, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_R1 TONES_F2D(770, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_R2 TONES_F2D(852, TONES_SAMPLERATE)
|
|
|
|
#define DTMF_R3 TONES_F2D(941, TONES_SAMPLERATE)
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-09-21 04:18:17 -04:00
|
|
|
const std::array<uint32_t, 16> ccir_deltas = {
|
2023-05-18 16:16:05 -04:00
|
|
|
TONES_F2D(1981, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1124, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1197, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1275, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1358, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1446, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1540, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1640, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1747, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1860, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2400, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(930, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2247, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(991, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2110, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1055, TONES_SAMPLERATE)};
|
2017-01-30 08:10:30 -05:00
|
|
|
|
|
|
|
// 0123456789ABCD#*
|
|
|
|
const uint32_t dtmf_deltas[16][2] = {
|
2023-05-18 16:16:05 -04:00
|
|
|
{DTMF_C1, DTMF_R3},
|
|
|
|
{DTMF_C0, DTMF_R0},
|
|
|
|
{DTMF_C1, DTMF_R0},
|
|
|
|
{DTMF_C2, DTMF_R0},
|
|
|
|
{DTMF_C0, DTMF_R1},
|
|
|
|
{DTMF_C1, DTMF_R1},
|
|
|
|
{DTMF_C2, DTMF_R1},
|
|
|
|
{DTMF_C0, DTMF_R2},
|
|
|
|
{DTMF_C1, DTMF_R2},
|
|
|
|
{DTMF_C2, DTMF_R2},
|
|
|
|
{DTMF_C3, DTMF_R0},
|
|
|
|
{DTMF_C3, DTMF_R1},
|
|
|
|
{DTMF_C3, DTMF_R2},
|
|
|
|
{DTMF_C3, DTMF_R3},
|
|
|
|
{DTMF_C2, DTMF_R3},
|
|
|
|
{DTMF_C0, DTMF_R3}};
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-09-21 04:18:17 -04:00
|
|
|
const std::array<uint32_t, 16> eia_deltas = {
|
2023-05-18 16:16:05 -04:00
|
|
|
TONES_F2D(600, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(741, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(882, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1023, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1164, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1305, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1446, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1587, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1728, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1869, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2151, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2433, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2010, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2292, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(459, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1091, TONES_SAMPLERATE)};
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-09-21 04:18:17 -04:00
|
|
|
const std::array<uint32_t, 16> zvei_deltas = {
|
2023-05-18 16:16:05 -04:00
|
|
|
TONES_F2D(2400, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1060, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1160, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1270, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1400, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1530, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1670, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1830, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2000, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2200, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2800, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(810, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(970, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(885, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(2600, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(680, TONES_SAMPLERATE)};
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-03-14 04:20:13 -04:00
|
|
|
const uint32_t beep_deltas[BEEP_TONES_NB] = {
|
2023-05-18 16:16:05 -04:00
|
|
|
TONES_F2D(1475, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(740, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(587, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(1109, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(831, TONES_SAMPLERATE),
|
|
|
|
TONES_F2D(740, TONES_SAMPLERATE)};
|
2017-03-14 04:20:13 -04:00
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
#endif /*__TONESETS_H__*/
|