IMTS dialer: Calculate the parity from all pulses, not just from pulses of one digit

This commit is contained in:
Andreas Eversberg
2024-03-15 23:31:06 +01:00
parent b613123291
commit b5579d1f16

View File

@@ -213,7 +213,7 @@ static void process_signal(int buffer_size)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int i, d, p, pulses, tone = 0; int i, d, p, parity, pulses, tone = 0;
int buffer_size; int buffer_size;
int rc, argi; int rc, argi;
@@ -267,13 +267,14 @@ int main(int argc, char *argv[])
dial_string[d].tone = TONE_CONNECT; dial_string[d++].length = 0.050 * (double)dsp_samplerate; /* seize */ dial_string[d].tone = TONE_CONNECT; dial_string[d++].length = 0.050 * (double)dsp_samplerate; /* seize */
dial_string[d].console = '-'; dial_string[d].console = '-';
dial_string[d].tone = TONE_GUARD; dial_string[d++].length = 1.000 * (double)dsp_samplerate; /* pause */ dial_string[d].tone = TONE_GUARD; dial_string[d++].length = 1.000 * (double)dsp_samplerate; /* pause */
parity = 0;
for (i = 0; station_id[i]; i++) { for (i = 0; station_id[i]; i++) {
pulses = station_id[i] - '0'; pulses = station_id[i] - '0';
if (pulses == 0) if (pulses == 0)
pulses = 10; pulses = 10;
dial_string[d].console = station_id[i]; dial_string[d].console = station_id[i];
for (p = 1; p <= pulses; p++) { for (p = 1; p <= pulses; p++) {
if ((p & 1) == 1) if ((++parity & 1) == 1)
tone = TONE_SILENCE; tone = TONE_SILENCE;
else else
tone = TONE_GUARD; tone = TONE_GUARD;