JS8Call-Improved master
Loading...
Searching...
No Matches
commons.h
1#ifndef COMMONS_H
2#define COMMONS_H
3
4#include <cstdint>
5#include <mutex>
6
7// NSPS, the number of samples per second (at a sample rate of 12000
8// samples per second) is a constant, chosen so as to be a number
9// with no prime factor greater than 7.
10
11#define JS8_NSPS 6192
12#define JS8_NSMAX 6827
13#define JS8_NTMAX 60
14#define JS8_RX_SAMPLE_RATE 12000
15#define JS8_RX_SAMPLE_SIZE (JS8_NTMAX * JS8_RX_SAMPLE_RATE)
16
17#define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames
18#define JS8_DECODE_THREAD 1 // use a separate thread for decode process handling
19#define JS8_ALLOW_EXTENDED 1 // allow extended latin-1 capital charset
20#define JS8_AUTO_SYNC 1 // enable the experimental auto sync feature
21
22#define JS8_NUM_SYMBOLS 79
23#define JS8_ENABLE_JS8A 1
24#define JS8_ENABLE_JS8B 1
25#define JS8_ENABLE_JS8C 1
26#define JS8_ENABLE_JS8E 1
27#define JS8_ENABLE_JS8I 1
28
29#define JS8A_SYMBOL_SAMPLES 1920
30#define JS8A_TX_SECONDS 15
31#define JS8A_START_DELAY_MS 500
32
33#define JS8B_SYMBOL_SAMPLES 1200
34#define JS8B_TX_SECONDS 10
35#define JS8B_START_DELAY_MS 200
36
37#define JS8C_SYMBOL_SAMPLES 600
38#define JS8C_TX_SECONDS 6
39#define JS8C_START_DELAY_MS 100
40
41#define JS8E_SYMBOL_SAMPLES 3840
42#define JS8E_TX_SECONDS 30
43#define JS8E_START_DELAY_MS 500
44
45#define JS8I_SYMBOL_SAMPLES 384
46#define JS8I_TX_SECONDS 4
47#define JS8I_START_DELAY_MS 100
48
49extern struct dec_data
50{
51 std::int16_t d2[JS8_RX_SAMPLE_SIZE]; // sample frame buffer for sample collection
52 struct
53 {
54 int nutc; // UTC as integer. See code_time() below for details.
55 int nfqso; // User-selected QSO freq (kHz)
56 bool newdat; // true ==> new data, must do long FFT
57 int nfa; // Low decode limit (Hz) (filter min)
58 int nfb; // High decode limit (Hz) (filter max)
59 bool syncStats; // only compute sync candidates
60 int kin; // number of frames written to d2
61 int kposA; // starting position of decode for submode A
62 int kposB; // starting position of decode for submode B
63 int kposC; // starting position of decode for submode C
64 int kposE; // starting position of decode for submode E
65 int kposI; // starting position of decode for submode I
66 int kszA; // number of frames for decode for submode A
67 int kszB; // number of frames for decode for submode B
68 int kszC; // number of frames for decode for submode C
69 int kszE; // number of frames for decode for submode E
70 int kszI; // number of frames for decode for submode I
71 int nsubmodes; // which submodes to decode
72 } params;
73} dec_data;
74
75extern struct
77{
78 float savg[JS8_NSMAX];
79 float slin[JS8_NSMAX];
80}
82
83extern std::mutex fftw_mutex;
84
85// The way we squeeze a timestamp into an int.
86// See also decode_time() below.
87inline int code_time(int hour, int minute, int second){
88 return hour * 10000 + minute * 100 + second;
89}
90
92 int hour;
93 int minute;
94 int second;
95};
96
97// Undo code_time().
98inline hour_minute_second decode_time(int nutc){
99 struct hour_minute_second result;
100 result.hour = nutc / 10000;
101 result.minute = nutc % 10000 / 100;
102 result.second = nutc % 100;
103 return result;
104}
105
106#endif // COMMONS_H
Definition commons.h:50
Definition commons.h:91
Definition commons.h:77