36
37
#define ABUFSIZE 4000
40
char afile[40]; /* Audio device name */
41
int sndfmt; /* Encoding of audio from */
42
int channels; /* Number of channels to record */
43
int speed; /* Sample rate of audio */
42
char afile[40]; /* Audio device name */
43
int sndfmt; /* Encoding of audio from */
44
int channels; /* Number of channels to record */
45
int speed; /* Sample rate of audio */
49
51
/* Audio device setup */
51
strcpy (afile, sc_device);
53
if ((afd = open(afile, O_RDONLY, 0)) == -1)
59
if (ioctl(afd, SNDCTL_DSP_SETFMT, &sndfmt) == -1)
65
if (ioctl(afd, SNDCTL_DSP_CHANNELS, &channels) == -1)
71
if (ioctl(afd, SNDCTL_DSP_SPEED, &speed) == -1)
53
strcpy(afile, sc_device);
55
if ((afd = open(afile, O_RDONLY, 0)) == -1) {
60
if (ioctl(afd, SNDCTL_DSP_SETFMT, &sndfmt) == -1) {
65
if (ioctl(afd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
70
if (ioctl(afd, SNDCTL_DSP_SPEED, &speed) == -1) {
85
84
/* ------------ rescale bar ----------*/
88
int rescale (int testvalue) {
90
extern int scale_values[];
92
if (testvalue > scale_values[0]) testvalue = 19;
93
else if (testvalue > scale_values[1]) testvalue = 18;
94
else if (testvalue > scale_values[2]) testvalue = 17;
95
else if (testvalue > scale_values[3]) testvalue = 16;
96
else if (testvalue > scale_values[4]) testvalue = 15;
97
else if (testvalue > scale_values[5]) testvalue = 14;
98
else if (testvalue > scale_values[6]) testvalue = 13;
99
else if (testvalue > scale_values[7]) testvalue = 12;
100
else if (testvalue > scale_values[8]) testvalue = 11;
101
else if (testvalue > scale_values[9]) testvalue = 10;
102
else if (testvalue > scale_values[10]) testvalue = 9;
103
else if (testvalue > scale_values[11]) testvalue = 8;
104
else if (testvalue > scale_values[12]) testvalue = 7;
105
else if (testvalue > scale_values[13]) testvalue = 6;
106
else if (testvalue > scale_values[14]) testvalue = 5;
107
else if (testvalue > scale_values[15]) testvalue = 4;
108
else if (testvalue > scale_values[16]) testvalue = 3;
109
else if (testvalue > scale_values[17]) testvalue = 2;
110
else if (testvalue > scale_values[18]) testvalue = 1;
86
int rescale(int testvalue)
89
extern int scale_values[];
91
if (testvalue > scale_values[0])
93
else if (testvalue > scale_values[1])
95
else if (testvalue > scale_values[2])
97
else if (testvalue > scale_values[3])
99
else if (testvalue > scale_values[4])
101
else if (testvalue > scale_values[5])
103
else if (testvalue > scale_values[6])
105
else if (testvalue > scale_values[7])
107
else if (testvalue > scale_values[8])
109
else if (testvalue > scale_values[9])
111
else if (testvalue > scale_values[10])
113
else if (testvalue > scale_values[11])
115
else if (testvalue > scale_values[12])
117
else if (testvalue > scale_values[13])
119
else if (testvalue > scale_values[14])
121
else if (testvalue > scale_values[15])
123
else if (testvalue > scale_values[16])
125
else if (testvalue > scale_values[17])
127
else if (testvalue > scale_values[18])
117
float get_audio_sample(void) {
119
int rc=0; /* Return value from subs */
120
static float avg = 128.0;
121
static float maxval=0;
122
static float minval=0;
123
static float retval = 0.0;
124
unsigned char abuf[ABUFSIZE]; /* Audio data buffer */
127
for (k=0; k < 4; k++) {
128
if ((rc = read(afd, abuf, ABUFSIZE)) == -1)
130
perror("audio read");
134
for (i=0; i < rc; i++) // calculate average
136
if ( (maxval - minval) != 0.0){
138
avg = avg + (abuf[i] + abuf[i-1] + abuf[i-2] + abuf[i-3])/ 5;
140
avg = avg + (abuf[i] + abuf[i+1] + abuf[i+2] + abuf[i+3])/ 5;
142
if (avg >= 188.0) avg = 128.0;
143
if (avg <= 60.0) avg = 128.0;
146
for (i=0; i < rc; i++) // calculate maximum avg value
148
if (abuf[i] >= avg) {
150
maxval = ((510 * maxval) + abuf[i] + abuf[i-1]) / 512;
152
maxval = ((510 * maxval) + abuf[i] + abuf[i+1]) / 512;
154
if (maxval < avg) maxval = avg + 1;
160
minval = ((510 * minval) + abuf[i] + abuf[i-1]) / 512 ;
162
minval = ((510 * minval) + abuf[i] + abuf[i+1]) / 512 ;
164
if (minval >= avg) minval = avg - 1;
168
retval = (maxval - minval);
169
if (retval < 0.0) retval = 0.0;
171
mvprintw(23, 5, " ");
173
mvprintw(23,5, "%4.0f", retval);
176
retval = rescale (retval);
135
float get_audio_sample(void)
138
int rc = 0; /* Return value from subs */
139
static float avg = 128.0;
140
static float maxval = 0;
141
static float minval = 0;
142
static float retval = 0.0;
143
unsigned char abuf[ABUFSIZE]; /* Audio data buffer */
146
for (k = 0; k < 4; k++) {
147
if ((rc = read(afd, abuf, ABUFSIZE)) == -1) {
148
perror("audio read");
152
for (i = 0; i < rc; i++) // calculate average
154
if ((maxval - minval) != 0.0) {
157
avg + (abuf[i] + abuf[i - 1] + abuf[i - 2] +
161
avg + (abuf[i] + abuf[i + 1] + abuf[i + 2] +
170
for (i = 0; i < rc; i++) // calculate maximum avg value
172
if (abuf[i] >= avg) {
175
((510 * maxval) + abuf[i] + abuf[i - 1]) / 512;
178
((510 * maxval) + abuf[i] + abuf[i + 1]) / 512;
186
((510 * minval) + abuf[i] + abuf[i - 1]) / 512;
189
((510 * minval) + abuf[i] + abuf[i + 1]) / 512;
196
retval = (maxval - minval);
200
mvprintw(23, 5, " ");
202
mvprintw(23, 5, "%4.0f", retval);
205
retval = rescale(retval);
181
210
/* ----------make bar for s meter ------------*/
183
int make_bar(int xpos, int ypos, int yheight, unsigned int value, int bar_type){
187
if (bar_type == S_BAR) {
212
int make_bar(int xpos, int ypos, int yheight, unsigned int value,
218
if (bar_type == S_BAR) {
188
219
for (i = 0; i < yheight; i++)
189
mvprintw(ypos - i, xpos, " ");
220
mvprintw(ypos - i, xpos, " ");
192
223
/* Make the bar */
194
if (bar_type == S_BAR || bar_type == PAN_BAR) {
195
for (i = 0; i < value && i < 20 ; i++)
196
mvprintw(ypos - i, xpos, "#");
199
mvprintw(21 - value, xpos , "@");
225
if (bar_type == S_BAR || bar_type == PAN_BAR) {
226
for (i = 0; i < value && i < 20; i++)
227
mvprintw(ypos - i, xpos, "#");
229
mvprintw(21 - value, xpos, "@");
207
236
/* ------------ draw noise bridge screen ----------*/
209
int draw_nb_screen(int xpos, int ypos, int yheight, int bar_type){
215
for (i = 0; i < 21; i++) {
238
int draw_nb_screen(int xpos, int ypos, int yheight, int bar_type)
245
for (i = 0; i < 21; i++) {
219
mvprintw(ypos + i, xpos, "+---------+---------+---------+---------+---------+");
225
mvprintw(ypos + i, xpos, "| | | | | | | | | | |");
249
mvprintw(ypos + i, xpos,
250
"+---------+---------+---------+---------+---------+");
256
mvprintw(ypos + i, xpos,
257
"| | | | | | | | | | |");
231
mvprintw(ypos + i, xpos, "+----+----+----+----+----+----+----+----+----+----+");
263
mvprintw(ypos + i, xpos,
264
"+----+----+----+----+----+----+----+----+----+----+");
238
mvprintw(ypos + 1, 2, "%2d-", 0); // 0
239
mvprintw(ypos + 3, 2, "%2d-", 3); // 3
240
mvprintw(ypos + 5, 2, "%2d-", 6); // 6
241
mvprintw(ypos + 10, 2, "%2d-", 10);
242
mvprintw(ypos + 15, 2, "%2d-", 20); // 20
243
mvprintw(ypos + 20, 2, "%2d-", 40);
271
mvprintw(ypos + 1, 2, "%2d-", 0); // 0
272
mvprintw(ypos + 3, 2, "%2d-", 3); // 3
273
mvprintw(ypos + 5, 2, "%2d-", 6); // 6
274
mvprintw(ypos + 10, 2, "%2d-", 10);
275
mvprintw(ypos + 15, 2, "%2d-", 20); // 20
276
mvprintw(ypos + 20, 2, "%2d-", 40);
250
281
/* ------------ draw scanner screen ----------*/
252
int drawscreen(int xpos, int ypos, int yheight, int bar_type){
258
for (i = 0; i < 21; i++) {
283
int drawscreen(int xpos, int ypos, int yheight, int bar_type)
290
for (i = 0; i < 21; i++) {
262
mvprintw(ypos + i, xpos, "+---------+---------+---------+---------+---------+");
268
mvprintw(ypos + i, xpos, "| | | | | | | | | | |");
294
mvprintw(ypos + i, xpos,
295
"+---------+---------+---------+---------+---------+");
301
mvprintw(ypos + i, xpos,
302
"| | | | | | | | | | |");
274
mvprintw(ypos + i, xpos, "+----+----+----+----+----+----+----+----+----+----+");
308
mvprintw(ypos + i, xpos,
309
"+----+----+----+----+----+----+----+----+----+----+");
281
mvprintw(ypos + 1, 2, "%2d-", 20);
282
mvprintw(ypos + 3, 2, "%2d-", 10);
283
mvprintw(ypos + 5, 2, "%2d-", 9);
284
mvprintw(ypos + 7, 2, "%2d-", 8);
285
mvprintw(ypos + 9, 2, "%2d-", 7);
286
mvprintw(ypos + 11, 2, "%2d-", 6);
287
mvprintw(ypos + 13, 2, "%2d-", 5);
288
mvprintw(ypos + 15, 2, "%2d-", 4);
289
mvprintw(ypos + 17, 2, "%2d-", 3);
290
mvprintw(ypos + 19, 2, "%2d-", 2);
316
mvprintw(ypos + 1, 2, "%2d-", 20);
317
mvprintw(ypos + 3, 2, "%2d-", 10);
318
mvprintw(ypos + 5, 2, "%2d-", 9);
319
mvprintw(ypos + 7, 2, "%2d-", 8);
320
mvprintw(ypos + 9, 2, "%2d-", 7);
321
mvprintw(ypos + 11, 2, "%2d-", 6);
322
mvprintw(ypos + 13, 2, "%2d-", 5);
323
mvprintw(ypos + 15, 2, "%2d-", 4);
324
mvprintw(ypos + 17, 2, "%2d-", 3);
325
mvprintw(ypos + 19, 2, "%2d-", 2);
295
330
/* ------------ draw S meter screen ----------*/
297
int drawSmeter(int xpos, int ypos, int yheight, float testvalue){
303
for (i = 0; i < 21; i++) {
332
int drawSmeter(int xpos, int ypos, int yheight, float testvalue)
339
for (i = 0; i < 21; i++) {
307
mvprintw(ypos + i, xpos, "+---+");
311
mvprintw(ypos + i, xpos, "| |");
314
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_GREEN) | A_BOLD | A_STANDOUT);
315
else attron(COLOR_PAIR(COLOR_GREEN) | A_STANDOUT);
317
mvprintw(ypos + i, xpos, "> <");
319
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
320
else attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
343
mvprintw(ypos + i, xpos, "+---+");
347
mvprintw(ypos + i, xpos, "| |");
351
attron(COLOR_PAIR(COLOR_GREEN) | A_BOLD | A_STANDOUT);
353
attron(COLOR_PAIR(COLOR_GREEN) | A_STANDOUT);
355
mvprintw(ypos + i, xpos, "> <");
358
attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
360
attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
324
mvprintw(ypos + 1, 3, "%2d", 20);
325
mvprintw(ypos + 3, 3, "%2d", 10);
326
mvprintw(ypos + 5, 3, "%2d", 9);
327
mvprintw(ypos + 7, 3, "%2d", 8);
328
mvprintw(ypos + 9, 3, "%2d", 7);
329
mvprintw(ypos + 11, 3, "%2d", 6);
330
mvprintw(ypos + 13, 3, "%2d", 5);
331
mvprintw(ypos + 15, 3, "%2d", 4);
332
mvprintw(ypos + 17, 3, "%2d", 3);
333
mvprintw(ypos + 19, 3, "%2d", 2);
335
make_bar(7, 20, 20, (int) testvalue , S_BAR);
364
mvprintw(ypos + 1, 3, "%2d", 20);
365
mvprintw(ypos + 3, 3, "%2d", 10);
366
mvprintw(ypos + 5, 3, "%2d", 9);
367
mvprintw(ypos + 7, 3, "%2d", 8);
368
mvprintw(ypos + 9, 3, "%2d", 7);
369
mvprintw(ypos + 11, 3, "%2d", 6);
370
mvprintw(ypos + 13, 3, "%2d", 5);
371
mvprintw(ypos + 15, 3, "%2d", 4);
372
mvprintw(ypos + 17, 3, "%2d", 3);
373
mvprintw(ypos + 19, 3, "%2d", 2);
375
make_bar(7, 20, 20, (int) testvalue, S_BAR);
342
382
/* ------------------ Panoramic scan -------------------- */
347
388
#ifdef HAVE_LIBHAMLIB
348
extern freq_t outfreq;
389
extern freq_t outfreq;
355
float FromFrequency = 0.0;
356
float FrequencyStep = 0.0;
357
float frequencies[51];
396
float FromFrequency = 0.0;
397
float FrequencyStep = 0.0;
398
float frequencies[51];
361
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
362
else attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
403
attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
405
attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
364
407
for (j = 0; j <= 24; j++)
367
411
drawscreen(5, 1, 21, 0);
369
mvprintw (1, 60, "- PANORAMIC SCAN -");
370
mvprintw (5, 60, "Frequency: ");
413
mvprintw(1, 60, "- PANORAMIC SCAN -");
414
mvprintw(5, 60, "Frequency: ");
373
scanf("%f", &FromFrequency);
417
rc = scanf("%f", &FromFrequency);
375
mvprintw (5, 72, "%5.1f", FromFrequency);
376
mvprintw (22, 1, "%5.1f", FromFrequency);
378
mvprintw (7, 60, "Step (kHz): ");
380
scanf("%f", &FrequencyStep);
381
mvprintw (7, 72, "%5.1f", FrequencyStep);
419
mvprintw(5, 72, "%5.1f", FromFrequency);
420
mvprintw(22, 1, "%5.1f", FromFrequency);
422
mvprintw(7, 60, "Step (kHz): ");
424
rc = scanf("%f", &FrequencyStep);
425
mvprintw(7, 72, "%5.1f", FrequencyStep);
384
for (j=0; j<51; j++) {
385
frequencies [j] = FromFrequency + j * FrequencyStep;
392
mvprintw(22, j+1, "%5.1f", frequencies[j]);
428
for (j = 0; j < 51; j++) {
429
frequencies[j] = FromFrequency + j * FrequencyStep;
436
mvprintw(22, j + 1, "%5.1f", frequencies[j]);
402
/* ------------- scan ---------------------*/
405
testvalue = get_audio_sample();
407
for (j=0; j < 51; j++) {
411
for (i = 0; i < 100; i++){
412
if (outfreq == 0) break;
445
/* ------------- scan --------------------- */
447
for (j = 0; j < 5; j++)
448
testvalue = get_audio_sample();
450
for (j = 0; j < 51; j++) {
454
for (i = 0; i < 100; i++) {
416
460
#ifdef HAVE_LIBHAMLIB
417
outfreq = (freq_t) (frequencies[j] * 1000) ;
461
outfreq = (freq_t) (frequencies[j] * 1000);
419
outfreq = (int) (frequencies[j] * 1000) ;
463
outfreq = (int) (frequencies[j] * 1000);
423
testvalue = get_audio_sample();
425
make_bar(5 + j, 20, 20, (int) testvalue , PAN_BAR);
427
nodelay(stdscr, TRUE);
429
nodelay(stdscr, FALSE);
430
if (key == 27 || key == '\n') break;
435
/* -----------end scan --------------------*/
436
mvprintw (23,60, "---- Key? ----");
467
testvalue = get_audio_sample();
469
make_bar(5 + j, 20, 20, (int) testvalue, PAN_BAR);
471
nodelay(stdscr, TRUE);
473
nodelay(stdscr, FALSE);
474
if (key == 27 || key == '\n')
479
/* -----------end scan -------------------- */
480
mvprintw(23, 60, "---- Key? ----");
445
490
/* ------------------ Noise bridge scan -------------------- */
450
496
#ifdef HAVE_LIBHAMLIB
451
extern freq_t outfreq;
497
extern freq_t outfreq;
458
float FromFrequency = 0.0;
459
float FrequencyStep = 0.0;
460
float frequencies[51];
504
float FromFrequency = 0.0;
505
float FrequencyStep = 0.0;
506
float frequencies[51];
465
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
466
else attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
468
for (j = 0; j <= 24; j++) // wipe the screen
471
draw_nb_screen(5, 1, 21, 0); // draw the grid
473
mvprintw (1, 60, "- NOISE BRIDGE -"); // get the parameters
474
mvprintw (5, 60, "Frequency: ");
476
scanf("%f", &FromFrequency);
477
mvprintw (5, 72, "%5.1f", FromFrequency);
478
mvprintw (22, 1, "%5.1f", FromFrequency);
480
mvprintw (7, 60, "Step (kHz): ");
482
scanf("%f", &FrequencyStep);
483
mvprintw (7, 72, "%5.1f", FrequencyStep);
486
for (j=0; j<51; j++) { // draw the X scale
487
frequencies [j] = FromFrequency + j * FrequencyStep;
494
mvprintw(22, j+1, "%5.1f", frequencies[j]);
512
attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
514
attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
516
for (j = 0; j <= 24; j++) // wipe the screen
520
draw_nb_screen(5, 1, 21, 0); // draw the grid
522
mvprintw(1, 60, "- NOISE BRIDGE -"); // get the parameters
523
mvprintw(5, 60, "Frequency: ");
525
rc = scanf("%f", &FromFrequency);
526
mvprintw(5, 72, "%5.1f", FromFrequency);
527
mvprintw(22, 1, "%5.1f", FromFrequency);
529
mvprintw(7, 60, "Step (kHz): ");
531
rc = scanf("%f", &FrequencyStep);
532
mvprintw(7, 72, "%5.1f", FrequencyStep);
535
for (j = 0; j < 51; j++) { // draw the X scale
536
frequencies[j] = FromFrequency + j * FrequencyStep;
543
mvprintw(22, j + 1, "%5.1f", frequencies[j]);
504
/* ------------- scan ---------------------*/
507
testvalue = get_audio_sample();
510
for (j=0; j < 51; j++) {
514
for (i = 0; i < 100; i++){
515
if (outfreq == 0) break;
552
/* ------------- scan --------------------- */
554
for (j = 0; j < 5; j++)
555
testvalue = get_audio_sample();
557
for (j = 0; j < 51; j++) {
561
for (i = 0; i < 100; i++) {
518
566
#ifdef HAVE_LIBHAMLIB
519
outfreq = (freq_t) (frequencies[j] * 1000) ;
567
outfreq = (freq_t) (frequencies[j] * 1000);
521
outfreq = (int) (frequencies[j] * 1000) ;
569
outfreq = (int) (frequencies[j] * 1000);
524
testvalue = get_audio_sample();
525
values[j] = testvalue;
527
testvalue = (values[j-1] + values[j]) / 2;
529
make_bar(5 + j, 20, 20, (int) testvalue , SPOT_BAR);
531
nodelay(stdscr, TRUE);
533
nodelay(stdscr, FALSE);
534
if (key == 27 || key == '\n') break;
539
/* -----------end scan --------------------*/
540
mvprintw (23,60, "---- Key? ----");
572
testvalue = get_audio_sample();
573
values[j] = testvalue;
575
testvalue = (values[j - 1] + values[j]) / 2;
577
make_bar(5 + j, 20, 20, (int) testvalue, SPOT_BAR);
579
nodelay(stdscr, TRUE);
581
nodelay(stdscr, FALSE);
582
if (key == 27 || key == '\n')
587
/* -----------end scan -------------------- */
588
mvprintw(23, 60, "---- Key? ----");
556
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
557
else attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
559
for (j = 0; j <= 24; j++)
562
mvprintw (1, 20, "--- TLF SCANNER UTILITY ---");
563
mvprintw (6, 20, "0.: Calibrate S-meter on S9 !");
564
mvprintw (8, 20, "1.: Panorama scan");
565
mvprintw (9, 20, "2.: Noise bridge scan");
606
attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
608
attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
610
for (j = 0; j <= 24; j++)
614
mvprintw(1, 20, "--- TLF SCANNER UTILITY ---");
615
mvprintw(6, 20, "0.: Calibrate S-meter on S9 !");
616
mvprintw(8, 20, "1.: Panorama scan");
617
mvprintw(9, 20, "2.: Noise bridge scan");
566
618
//mvprintw (10, 20, "3.: Channel scan (n.a.)");
567
619
//mvprintw (11, 20, "4.: Beacon scan (n.a.)");
568
mvprintw (11, 20, "ESC: Exit scan function");
620
mvprintw(11, 20, "ESC: Exit scan function");
570
mvprintw(23,20," --- Press a key to continue --- ");
622
mvprintw(23, 20, " --- Press a key to continue --- ");
575
627
/* -------------------main test routine ------- */
587
640
/* ------------initialize sound card --------*/
590
while (runnit == 1) {
643
while (runnit == 1) {
592
645
testvalue = get_audio_sample();
622
void recordmenue (void) {
628
if (use_rxvt == 0) attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
629
else attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
631
for (j = 0; j <= 24; j++)
634
mvprintw (1, 20, "--- TLF SOUND RECORDER UTILITY ---");
635
mvprintw (6, 20, "F1 ... F12, S, C: Record Messages");
637
mvprintw (9, 20, "1.: Enable contest recorder");
638
mvprintw (10, 20, "2.: Disable contest recorder");
639
mvprintw (11,20, "3.: Play back file");
640
mvprintw (13, 20, "ESC: Exit sound recorder function");
645
/*--------------------------------------------------------------------------------------*/
648
extern char ph_message[14][80];
650
int runnit = 1, key, i=0, j = 4;
651
char commands[80] = "";
652
char playbackfile[40];
655
struct dirent *soundfilename;
659
while (runnit == 1) {
661
nodelay(stdscr, TRUE);
663
nodelay(stdscr, FALSE);
668
mvprintw(15,20, "recording %s", ph_message[0]);
671
strcpy(commands,"rec -w -r 8000 -d ");
672
strcat(commands, sc_device);
673
strcat(commands, " "); // (W9WI)
674
strcat(commands, ph_message[0]);
679
mvprintw(15,20, "recording %s", ph_message[1]);
683
strcpy(commands,"rec -w -r 8000 -d ");
684
strcat(commands, sc_device);
685
strcat(commands, " "); // (W9WI)
686
strcat(commands, ph_message[1]);
691
mvprintw(15,20, "recording %s", ph_message[2]);
694
strcpy(commands,"rec -w -r 8000 -d ");
695
strcat(commands, sc_device);
696
strcat(commands, " "); // (W9WI)
697
strcat(commands, ph_message[2]);
702
mvprintw(15,20, "recording %s", ph_message[3]);
705
strcpy(commands,"rec -w -r 8000 -d ");
706
strcat(commands, sc_device);
707
strcat(commands, " "); // (W9WI)
708
strcat(commands, ph_message[3]);
713
mvprintw(15,20, "recording %s", ph_message[4]);
716
strcpy(commands,"rec -w -r 8000 -d ");
717
strcat(commands, sc_device);
718
strcat(commands, " "); // (W9WI)
719
strcat(commands, ph_message[4]);
724
mvprintw(15,20, "recording %s", ph_message[5]);
727
strcpy(commands,"rec -w -r 8000 -d ");
728
strcat(commands, sc_device);
729
strcat(commands, " "); // (W9WI)
730
strcat(commands, ph_message[5]);
735
mvprintw(15,20, "recording %s", ph_message[6]);
738
strcpy(commands,"rec -w -r 8000 -d ");
739
strcat(commands, sc_device);
740
strcat(commands, " "); // (W9WI)
741
strcat(commands, ph_message[6]);
746
mvprintw(15,20, "recording %s", ph_message[7]);
749
strcpy(commands,"rec -w -r 8000 -d ");
750
strcat(commands, sc_device);
751
strcat(commands, " "); // (W9WI)
752
strcat(commands, ph_message[7]);
757
mvprintw(15,20, "recording %s", ph_message[8]);
760
strcpy(commands,"rec -w -r 8000 -d ");
761
strcat(commands, sc_device);
762
strcat(commands, " "); // (W9WI)
763
strcat(commands, ph_message[8]);
768
mvprintw(15,20, "recording %s", ph_message[9]);
771
strcpy(commands,"rec -w -r 8000 -d ");
772
strcat(commands, sc_device);
773
strcat(commands, " "); // (W9WI)
774
strcat(commands, ph_message[9]);
779
mvprintw(15,20, "recording %s", ph_message[10]);
782
strcpy(commands,"rec -w -r 8000 -d ");
783
strcat(commands, sc_device);
784
strcat(commands, " "); // (W9WI)
785
strcat(commands, ph_message[10]);
790
mvprintw(15,20, "recording %s", ph_message[11]);
793
strcpy(commands,"rec -w -r 8000 -d ");
794
strcat(commands, sc_device);
795
strcat(commands, " "); // (W9WI)
796
strcat(commands, ph_message[11]);
802
mvprintw(15,20, "recording %s", ph_message[12]);
805
strcpy(commands,"rec -w -r 8000 -d ");
806
strcat(commands, sc_device);
807
strcat(commands, " "); // (W9WI)
808
strcat(commands, ph_message[12]);
814
mvprintw(15,20, "recording %s", ph_message[13]);
817
strcpy(commands,"rec -w -r 8000 -d ");
818
strcat(commands, sc_device);
819
strcat(commands, " "); // (W9WI)
820
strcat(commands, ph_message[13]);
825
system ("echo "" > ~/.VRlock");
827
system ("cd ~/tlf/soundlogs; ./soundlog > /dev/null 2> /dev/null &");
829
mvprintw(15,20, "Contest recording enabled...");
835
mvprintw(15,20, "Contest recording disabled...");
838
system ("rm ~/.VRlock");
839
system ("pkill -f soundlogs > /dev/null 2> /dev/null ");
843
sounddir = opendir("$HOME/tlf/soundlogs/"); // (W9WI)
845
if (sounddir == NULL) break;
847
for (i = 4; i < 15; i++)
852
for (i = 10; i < 81; i += 10) {
853
soundfilename = readdir (sounddir);
854
if (soundfilename== NULL)
857
if (strstr(soundfilename->d_name, ".au") != NULL) {
862
strncpy (printname, soundfilename->d_name, 6);
863
mvprintw(j,i , "%s", printname);
867
if (i >= 10) i -= 10;
874
mvprintw(15,20, "Play back file (ddhhmmxx): ");
878
getnstr(playbackfile, 8);
880
strcpy(commands, "play -d ");
881
strcat(commands, sc_device);
882
strcat(commands, " ~/tlf/soundlogs/");
883
if (strlen(playbackfile) > 6) {
884
strncat (commands , playbackfile, 6);
885
strcat (commands, ".au trim ");
886
strcat (commands, playbackfile+6);
887
}else if (strlen(playbackfile) < 5) {
888
strcat(commands, playbackfile);
889
strcat(commands, "00.au");
891
strcat(commands, playbackfile);
892
strcat(commands, ".au");
894
mvprintw(16,20, "Use Ctrl-c to stop and return to tlf");
675
void recordmenue(void)
683
attron(COLOR_PAIR(COLOR_CYAN) | A_BOLD | A_STANDOUT);
685
attron(COLOR_PAIR(COLOR_CYAN) | A_STANDOUT);
687
for (j = 0; j <= 24; j++)
691
mvprintw(1, 20, "--- TLF SOUND RECORDER UTILITY ---");
692
mvprintw(6, 20, "F1 ... F12, S, C: Record Messages");
694
mvprintw(9, 20, "1.: Enable contest recorder");
695
mvprintw(10, 20, "2.: Disable contest recorder");
696
mvprintw(11, 20, "3.: Play back file");
697
mvprintw(13, 20, "ESC: Exit sound recorder function");
703
/*--------------------------------------------------------------------------*/
704
void do_record(int message_nr)
706
extern char ph_message[14][80];
709
char commands[80] = "";
711
mvprintw(15, 20, "recording %s", ph_message[message_nr]);
712
mvprintw(16, 20, "ESC to exit");
713
mvprintw(17, 20, "");
715
strcpy(commands, "rec -r 8000 "); //G4KNO
716
strcat(commands, ph_message[message_nr]);
717
strcat(commands, " -q &"); //G4KNO
718
rc = system(commands);
719
//G4KNO: Loop until <esc> keypress
722
//kill process (SIGINT=Ctrl-C).
723
rc = system("pkill -SIGINT -n rec");
729
/*--------------------------------------------------------------------------*/
733
extern char ph_message[14][80];
735
int rc, runnit = 1, key, i = 0, j = 4;
736
char commands[80] = "";
737
char playbackfile[40];
740
struct dirent *soundfilename;
744
while (runnit == 1) {
746
nodelay(stdscr, TRUE);
748
nodelay(stdscr, FALSE);
811
rc = system("echo " " > ~/.VRlock");
814
("cd ~/tlf/soundlogs; ./soundlog > /dev/null 2> /dev/null &");
816
mvprintw(15, 20, "Contest recording enabled...");
822
mvprintw(15, 20, "Contest recording disabled...");
825
rc = system("rm ~/.VRlock");
826
rc = system("pkill -f soundlogs > /dev/null 2> /dev/null ");
830
sounddir = opendir("$HOME/tlf/soundlogs/"); // (W9WI)
832
if (sounddir == NULL)
835
for (i = 4; i < 15; i++)
841
for (i = 10; i < 81; i += 10) {
842
soundfilename = readdir(sounddir);
843
if (soundfilename == NULL)
846
if (strstr(soundfilename->d_name, ".au") != NULL) {
851
strncpy(printname, soundfilename->d_name, 6);
852
mvprintw(j, i, "%s", printname);
863
mvprintw(15, 20, "Play back file (ddhhmmxx): ");
867
getnstr(playbackfile, 8);
869
strcpy(commands, "play -d ");
870
strcat(commands, sc_device);
871
strcat(commands, " ~/tlf/soundlogs/");
872
if (strlen(playbackfile) > 6) {
873
strncat(commands, playbackfile, 6);
874
strcat(commands, ".au trim ");
875
strcat(commands, playbackfile + 6);
876
} else if (strlen(playbackfile) < 5) {
877
strcat(commands, playbackfile);
878
strcat(commands, "00.au");
880
strcat(commands, playbackfile);
881
strcat(commands, ".au");
883
mvprintw(16, 20, "Use Ctrl-c to stop and return to tlf");
884
mvprintw(18, 20, "");
886
rc = system(commands);