-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
45 lines (41 loc) · 1.06 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdlib.h>
#include <signal.h> // for random numbers
#include <time.h> // for randomization (using system time)
#include "screen.h"
#include <stdio.h>
#include "sound.h"
#include "comm.h"
int main(int argc, char **argv){
if(argc == 2){
int ch;
printf("How many channels? (1:mono, 2:stereo)");
scanf("%d", &ch);
float duration;
printf("how long is the test tone (1-10 sec) ");
scanf("%f", &duration);
testTone(ch, atoi( argv[1]), duration);
return 0;
}
FILE *f;
short sd[RATE]; // for all samples in 1 sec
while(1){
int ret = system(CMD);
if(ret == SIGINT) break;
f=fopen("test.wav", "r"); // open the file for read only
if(f == NULL){
printf("Cannot open the file\n");
return 1;
}
clearScreen();
setColors(GREEN, bg(BLUE));
struct WAVHDR hdr; // instance of wav header
fread(&hdr, sizeof(hdr), 1, f); // read WAV header
fread(&sd, sizeof(sd), 1, f); // show wav header information
fclose(f); // close the open file
sendDATA(sd);
displayWAVHDR(hdr);
// display WAVHDR();
displayWAVDATA(sd);
}
resetColors();
}