diff options
Diffstat (limited to 'apps/plugins/midi/midifile.c')
-rw-r--r-- | apps/plugins/midi/midifile.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c index b5d9c5b6d1..536a7bbea1 100644 --- a/apps/plugins/midi/midifile.c +++ b/apps/plugins/midi/midifile.c | |||
@@ -33,7 +33,7 @@ struct MIDIfile * loadFile(const char * filename) | |||
33 | 33 | ||
34 | if(file < 0) | 34 | if(file < 0) |
35 | { | 35 | { |
36 | printf("Could not open file"); | 36 | midi_debug("Could not open file"); |
37 | return NULL; | 37 | return NULL; |
38 | } | 38 | } |
39 | 39 | ||
@@ -46,21 +46,21 @@ struct MIDIfile * loadFile(const char * filename) | |||
46 | { | 46 | { |
47 | if(fileID == ID_RIFF) | 47 | if(fileID == ID_RIFF) |
48 | { | 48 | { |
49 | printf("Detected RMID file"); | 49 | midi_debug("Detected RMID file"); |
50 | printf("Looking for MThd header"); | 50 | midi_debug("Looking for MThd header"); |
51 | char dummy[17]; | 51 | char dummy[17]; |
52 | rb->read(file, &dummy, 16); | 52 | rb->read(file, &dummy, 16); |
53 | if(readID(file) != ID_MTHD) | 53 | if(readID(file) != ID_MTHD) |
54 | { | 54 | { |
55 | rb->close(file); | 55 | rb->close(file); |
56 | printf("Invalid MIDI header within RIFF."); | 56 | midi_debug("Invalid MIDI header within RIFF."); |
57 | return NULL; | 57 | return NULL; |
58 | } | 58 | } |
59 | 59 | ||
60 | } else | 60 | } else |
61 | { | 61 | { |
62 | rb->close(file); | 62 | rb->close(file); |
63 | printf("Invalid file header chunk."); | 63 | midi_debug("Invalid file header chunk."); |
64 | return NULL; | 64 | return NULL; |
65 | } | 65 | } |
66 | } | 66 | } |
@@ -68,14 +68,14 @@ struct MIDIfile * loadFile(const char * filename) | |||
68 | if(readFourBytes(file)!=6) | 68 | if(readFourBytes(file)!=6) |
69 | { | 69 | { |
70 | rb->close(file); | 70 | rb->close(file); |
71 | printf("Header chunk size invalid."); | 71 | midi_debug("Header chunk size invalid."); |
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | 74 | ||
75 | if(readTwoBytes(file)==2) | 75 | if(readTwoBytes(file)==2) |
76 | { | 76 | { |
77 | rb->close(file); | 77 | rb->close(file); |
78 | printf("MIDI file type 2 not supported"); | 78 | midi_debug("MIDI file type 2 not supported"); |
79 | return NULL; | 79 | return NULL; |
80 | } | 80 | } |
81 | 81 | ||
@@ -84,7 +84,7 @@ struct MIDIfile * loadFile(const char * filename) | |||
84 | 84 | ||
85 | int track=0; | 85 | int track=0; |
86 | 86 | ||
87 | printf("File has %d tracks.", mfload->numTracks); | 87 | midi_debug("File has %d tracks.", mfload->numTracks); |
88 | 88 | ||
89 | while(! eof(file) && track < mfload->numTracks) | 89 | while(! eof(file) && track < mfload->numTracks) |
90 | { | 90 | { |
@@ -95,7 +95,7 @@ struct MIDIfile * loadFile(const char * filename) | |||
95 | { | 95 | { |
96 | if(mfload->numTracks != track) | 96 | if(mfload->numTracks != track) |
97 | { | 97 | { |
98 | printf("Warning: file claims to have %d tracks. I only see %d here.", mfload->numTracks, track); | 98 | midi_debug("Warning: file claims to have %d tracks. I only see %d here.", mfload->numTracks, track); |
99 | mfload->numTracks = track; | 99 | mfload->numTracks = track; |
100 | } | 100 | } |
101 | rb->close(file); | 101 | rb->close(file); |
@@ -108,7 +108,7 @@ struct MIDIfile * loadFile(const char * filename) | |||
108 | track++; | 108 | track++; |
109 | } else | 109 | } else |
110 | { | 110 | { |
111 | printf("SKIPPING TRACK"); | 111 | midi_debug("SKIPPING TRACK"); |
112 | int len = readFourBytes(file); | 112 | int len = readFourBytes(file); |
113 | while(--len) | 113 | while(--len) |
114 | readChar(file); | 114 | readChar(file); |
@@ -159,58 +159,58 @@ int readEvent(int file, void * dest) | |||
159 | { | 159 | { |
160 | case 0x01: /* Generic text */ | 160 | case 0x01: /* Generic text */ |
161 | { | 161 | { |
162 | printf("Text: %s", ev->evData); | 162 | midi_debug("Text: %s", ev->evData); |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | 165 | ||
166 | case 0x02: /* A copyright string within the file */ | 166 | case 0x02: /* A copyright string within the file */ |
167 | { | 167 | { |
168 | printf("Copyright: %s", ev->evData); | 168 | midi_debug("Copyright: %s", ev->evData); |
169 | break; | 169 | break; |
170 | } | 170 | } |
171 | 171 | ||
172 | case 0x03: /* Sequence of track name */ | 172 | case 0x03: /* Sequence of track name */ |
173 | { | 173 | { |
174 | printf("Name: %s", ev->evData); | 174 | midi_debug("Name: %s", ev->evData); |
175 | break; | 175 | break; |
176 | } | 176 | } |
177 | 177 | ||
178 | case 0x04: /* Instrument (synth) name */ | 178 | case 0x04: /* Instrument (synth) name */ |
179 | { | 179 | { |
180 | printf("Instrument: %s", ev->evData); | 180 | midi_debug("Instrument: %s", ev->evData); |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | 183 | ||
184 | case 0x05: /* Lyrics. These appear on the tracks at the right times */ | 184 | case 0x05: /* Lyrics. These appear on the tracks at the right times */ |
185 | { /* Usually only a small 'piece' of the lyrics. */ | 185 | { /* Usually only a small 'piece' of the lyrics. */ |
186 | /* Maybe the sequencer should print these at play time? */ | 186 | /* Maybe the sequencer should print these at play time? */ |
187 | printf("Lyric: %s", ev->evData); | 187 | midi_debug("Lyric: %s", ev->evData); |
188 | break; | 188 | break; |
189 | } | 189 | } |
190 | 190 | ||
191 | case 0x06: /* Text marker */ | 191 | case 0x06: /* Text marker */ |
192 | { | 192 | { |
193 | printf("Marker: %s", ev->evData); | 193 | midi_debug("Marker: %s", ev->evData); |
194 | break; | 194 | break; |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | case 0x07: /* Cue point */ | 198 | case 0x07: /* Cue point */ |
199 | { | 199 | { |
200 | printf("Cue point: %s", ev->evData); | 200 | midi_debug("Cue point: %s", ev->evData); |
201 | break; | 201 | break; |
202 | } | 202 | } |
203 | 203 | ||
204 | case 0x08: /* Program name */ | 204 | case 0x08: /* Program name */ |
205 | { | 205 | { |
206 | printf("Patch: %s", ev->evData); | 206 | midi_debug("Patch: %s", ev->evData); |
207 | break; | 207 | break; |
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||
211 | case 0x09: /* Device name. Very much irrelevant here, though. */ | 211 | case 0x09: /* Device name. Very much irrelevant here, though. */ |
212 | { | 212 | { |
213 | printf("Port: %s", ev->evData); | 213 | midi_debug("Port: %s", ev->evData); |
214 | break; | 214 | break; |
215 | } | 215 | } |
216 | } | 216 | } |
@@ -286,7 +286,7 @@ struct Track * readTrack(int file) | |||
286 | { | 286 | { |
287 | if(trackSize < dataPtr-trk->dataBlock) | 287 | if(trackSize < dataPtr-trk->dataBlock) |
288 | { | 288 | { |
289 | printf("Track parser memory out of bounds"); | 289 | midi_debug("Track parser memory out of bounds"); |
290 | exit(1); | 290 | exit(1); |
291 | } | 291 | } |
292 | dataPtr+=sizeof(struct Event); | 292 | dataPtr+=sizeof(struct Event); |
@@ -307,7 +307,7 @@ int readID(int file) | |||
307 | id[a]=readChar(file); | 307 | id[a]=readChar(file); |
308 | if(eof(file)) | 308 | if(eof(file)) |
309 | { | 309 | { |
310 | printf("End of file reached."); | 310 | midi_debug("End of file reached."); |
311 | return ID_EOF; | 311 | return ID_EOF; |
312 | } | 312 | } |
313 | if(rb->strcmp(id, "MThd")==0) | 313 | if(rb->strcmp(id, "MThd")==0) |