Commit 20416af8728505bce6ee3e5edf762d38fae85e41
1 parent
c08d3ce3
Add logs
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
main.cpp
... | ... | @@ -34,6 +34,7 @@ void save(int freq, char * filename) { |
34 | 34 | char * data_do = data.data(); |
35 | 35 | char *data2 = new char[data.datasize()/2]; |
36 | 36 | |
37 | + // accelerate in 2 times | |
37 | 38 | int i; |
38 | 39 | int j = 0; |
39 | 40 | for(i=0;i<data.datasize();i+=2) { |
... | ... | @@ -41,6 +42,7 @@ void save(int freq, char * filename) { |
41 | 42 | j++; |
42 | 43 | } |
43 | 44 | |
45 | + // resize to one size (TOUCH) | |
44 | 46 | int size = data.datasize()/2; |
45 | 47 | if (size > TOUCH) size = TOUCH; |
46 | 48 | |
... | ... | @@ -48,6 +50,7 @@ void save(int freq, char * filename) { |
48 | 50 | data.setDatasize(size); |
49 | 51 | data.setData(data2); |
50 | 52 | |
53 | + // save with its filename | |
51 | 54 | data.save(filename); |
52 | 55 | } |
53 | 56 | |
... | ... | @@ -62,8 +65,10 @@ int play_music(char* filename) { |
62 | 65 | char command[256]; |
63 | 66 | int status; |
64 | 67 | |
68 | + /* make a command*/ | |
65 | 69 | sprintf( command, "aplay -c 1 -q -t wav %s", filename ); |
66 | 70 | |
71 | + /* execute command of play*/ | |
67 | 72 | status = system( command ); |
68 | 73 | |
69 | 74 | return status; | ... | ... |