FreeCalypso > hg > fc-pcm-if
comparison sw/mcsi-rxtx/record.c @ 13:315428573a25
fc-mcsi-rxtx: implement record function
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Oct 2024 07:24:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
12:23555b9a1c20 | 13:315428573a25 |
---|---|
1 /* | |
2 * Here we implement the functionality of recording MCSI Rx streams | |
3 * into robe files. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 | |
10 extern u_short rx_pcm_samples[160]; | |
11 | |
12 static FILE *record_file; | |
13 | |
14 void | |
15 record_process() | |
16 { | |
17 unsigned n, samp; | |
18 | |
19 if (!record_file) | |
20 return; | |
21 for (n = 0; n < 160; n++) { | |
22 samp = rx_pcm_samples[n]; | |
23 putc(samp >> 8, record_file); | |
24 putc(samp, record_file); | |
25 } | |
26 } | |
27 | |
28 void | |
29 record_auto_stop() | |
30 { | |
31 if (!record_file) | |
32 return; | |
33 fclose(record_file); | |
34 record_file = 0; | |
35 } | |
36 | |
37 void | |
38 cmd_record(argc, argv) | |
39 char **argv; | |
40 { | |
41 if (record_file) { | |
42 printf("error: recording already in progress\n"); | |
43 return; | |
44 } | |
45 record_file = fopen(argv[1], "w"); | |
46 if (!record_file) | |
47 perror(argv[1]); | |
48 } | |
49 | |
50 void | |
51 cmd_record_stop() | |
52 { | |
53 if (!record_file) { | |
54 printf("error: no recording in progress\n"); | |
55 return; | |
56 } | |
57 fclose(record_file); | |
58 record_file = 0; | |
59 } |