summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Chicoine <mc2739@gmail.com>2010-07-25 19:47:07 +0000
committerMichael Chicoine <mc2739@gmail.com>2010-07-25 19:47:07 +0000
commite024198305623674d372aff71463e904905485b0 (patch)
tree2db98f533a069f146d038c5072f01c4e84dcc0a9
parent91a45d2ecc89d29e4317d21c7e59efabf64324f6 (diff)
downloadrockbox-e024198305623674d372aff71463e904905485b0.tar.gz
rockbox-e024198305623674d372aff71463e904905485b0.zip
Replace remaining printf in midi plugin (fix yellow/red)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27563 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/midi/midifile.c42
-rw-r--r--apps/plugins/midi/midiplay.c18
-rw-r--r--apps/plugins/midi/sequencer.c24
-rw-r--r--apps/plugins/midi/synth.c20
4 files changed, 52 insertions, 52 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)
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index 2c685f2e4b..d9e215158e 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -286,7 +286,7 @@ void get_more(unsigned char** start, size_t* size)
286#ifndef SYNC 286#ifndef SYNC
287 if(lastswap != swap) 287 if(lastswap != swap)
288 { 288 {
289 printf("Buffer miss!"); /* Comment out the printf to make missses less noticable. */ 289 midi_debug("Buffer miss!"); /* Comment out the midi_debug to make missses less noticable. */
290 } 290 }
291 291
292#else 292#else
@@ -307,12 +307,12 @@ static int midimain(const void * filename)
307 int a, notes_used, vol; 307 int a, notes_used, vol;
308 bool is_playing = true; /* false = paused */ 308 bool is_playing = true; /* false = paused */
309 309
310 printf("Loading file"); 310 midi_debug("Loading file");
311 mf = loadFile(filename); 311 mf = loadFile(filename);
312 312
313 if (mf == NULL) 313 if (mf == NULL)
314 { 314 {
315 printf("Error loading file."); 315 midi_debug("Error loading file.");
316 return -1; 316 return -1;
317 } 317 }
318 318
@@ -338,7 +338,7 @@ static int midimain(const void * filename)
338 * This seems to work quite well. On a laptop, anyway. 338 * This seems to work quite well. On a laptop, anyway.
339 */ 339 */
340 340
341 printf("Okay, starting sequencing"); 341 midi_debug("Okay, starting sequencing");
342 342
343 bpm = mf->div*1000000/tempo; 343 bpm = mf->div*1000000/tempo;
344 number_of_samples = SAMPLE_RATE/bpm; 344 number_of_samples = SAMPLE_RATE/bpm;
@@ -405,7 +405,7 @@ static int midimain(const void * filename)
405 /* but run through the tracks without the synth running */ 405 /* but run through the tracks without the synth running */
406 rb->pcm_play_stop(); 406 rb->pcm_play_stop();
407 seekBackward(5); 407 seekBackward(5);
408 printf("Rewind to %d:%02d\n", playing_time/60, playing_time%60); 408 midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
409 if (is_playing) 409 if (is_playing)
410 rb->pcm_play_data(&get_more, NULL, 0); 410 rb->pcm_play_data(&get_more, NULL, 0);
411 break; 411 break;
@@ -415,7 +415,7 @@ static int midimain(const void * filename)
415 { 415 {
416 rb->pcm_play_stop(); 416 rb->pcm_play_stop();
417 seekForward(5); 417 seekForward(5);
418 printf("Skip to %d:%02d\n", playing_time/60, playing_time%60); 418 midi_debug("Skip to %d:%02d\n", playing_time/60, playing_time%60);
419 if (is_playing) 419 if (is_playing)
420 rb->pcm_play_data(&get_more, NULL, 0); 420 rb->pcm_play_data(&get_more, NULL, 0);
421 break; 421 break;
@@ -425,12 +425,12 @@ static int midimain(const void * filename)
425 { 425 {
426 if (is_playing) 426 if (is_playing)
427 { 427 {
428 printf("Paused at %d:%02d\n", playing_time/60, playing_time%60); 428 midi_debug("Paused at %d:%02d\n", playing_time/60, playing_time%60);
429 is_playing = false; 429 is_playing = false;
430 rb->pcm_play_stop(); 430 rb->pcm_play_stop();
431 } else 431 } else
432 { 432 {
433 printf("Playing from %d:%02d\n", playing_time/60, playing_time%60); 433 midi_debug("Playing from %d:%02d\n", playing_time/60, playing_time%60);
434 is_playing = true; 434 is_playing = true;
435 rb->pcm_play_data(&get_more, NULL, 0); 435 rb->pcm_play_data(&get_more, NULL, 0);
436 } 436 }
@@ -465,7 +465,7 @@ enum plugin_status plugin_start(const void* parameter)
465 rb->cpu_boost(true); 465 rb->cpu_boost(true);
466#endif 466#endif
467 467
468 printf("%s", parameter); 468 midi_debug("%s", parameter);
469 /* rb->splash(HZ, true, parameter); */ 469 /* rb->splash(HZ, true, parameter); */
470 470
471#ifdef RB_PROFILE 471#ifdef RB_PROFILE
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index f97cac0130..307643e4e5 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -219,11 +219,11 @@ inline void pressNote(int ch, int note, int vol)
219 } 219 }
220 if (a == MAX_VOICES) 220 if (a == MAX_VOICES)
221 { 221 {
222// printf("\nVoice kill"); 222// midi_debug("\nVoice kill");
223// printf("\nToo many voices playing at once. No more left"); 223// midi_debug("\nToo many voices playing at once. No more left");
224// printf("\nVOICE DUMP: "); 224// midi_debug("\nVOICE DUMP: ");
225// for(a=0; a<48; a++) 225// for(a=0; a<48; a++)
226// printf("\n#%d Ch=%d Note=%d curRate=%d curOffset=%d curPoint=%d targetOffset=%d", a, voices[a].ch, voices[a].note, voices[a].curRate, voices[a].curOffset, voices[a].curPoint, voices[a].targetOffset); 226// midi_debug("\n#%d Ch=%d Note=%d curRate=%d curOffset=%d curPoint=%d targetOffset=%d", a, voices[a].ch, voices[a].note, voices[a].curRate, voices[a].curOffset, voices[a].curPoint, voices[a].targetOffset);
227 lastKill++; 227 lastKill++;
228 if (lastKill == MAX_VOICES) 228 if (lastKill == MAX_VOICES)
229 lastKill = 0; 229 lastKill = 0;
@@ -258,13 +258,13 @@ inline void pressNote(int ch, int note, int vol)
258 if (drumSet[note] != NULL) 258 if (drumSet[note] != NULL)
259 { 259 {
260 if (note < 35) 260 if (note < 35)
261 printf("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?"); 261 midi_debug("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?");
262 262
263 struct GWaveform * wf = drumSet[note]->waveforms[0]; 263 struct GWaveform * wf = drumSet[note]->waveforms[0];
264 voices[a].wf = wf; 264 voices[a].wf = wf;
265 voices[a].delta = (((gustable[note]<<FRACTSIZE) / wf->rootFreq) * wf->sampRate / SAMPLE_RATE); 265 voices[a].delta = (((gustable[note]<<FRACTSIZE) / wf->rootFreq) * wf->sampRate / SAMPLE_RATE);
266 if (wf->mode & 28) 266 if (wf->mode & 28)
267// printf("\nWoah, a drum patch has a loop. Stripping the loop..."); 267// midi_debug("\nWoah, a drum patch has a loop. Stripping the loop...");
268 wf->mode = wf->mode & (255-28); 268 wf->mode = wf->mode & (255-28);
269 269
270 /* Turn it on */ 270 /* Turn it on */
@@ -273,7 +273,7 @@ inline void pressNote(int ch, int note, int vol)
273 273
274 } else 274 } else
275 { 275 {
276/* printf("\nWarning: drum %d does not have a patch defined... Ignoring it", note); */ 276/* midi_debug("\nWarning: drum %d does not have a patch defined... Ignoring it", note); */
277 } 277 }
278 } 278 }
279} 279}
@@ -322,7 +322,7 @@ static void sendEvent(struct Event * ev)
322 if(chLastCtrlMSB[status_low] == REG_PITCHBEND_MSB && 322 if(chLastCtrlMSB[status_low] == REG_PITCHBEND_MSB &&
323 chLastCtrlLSB[status_low] == REG_PITCHBEND_LSB) 323 chLastCtrlLSB[status_low] == REG_PITCHBEND_LSB)
324 { 324 {
325// printf("Pitch bend depth set to %d\n", d2); 325// midi_debug("Pitch bend depth set to %d\n", d2);
326 chPBDepth[status_low] = d2; 326 chPBDepth[status_low] = d2;
327 } 327 }
328 return; 328 return;
@@ -403,10 +403,10 @@ int tick(void)
403 struct Track * tr = mf->tracks[a]; 403 struct Track * tr = mf->tracks[a];
404 404
405 if (tr == NULL) 405 if (tr == NULL)
406 printf("NULL TRACK: %d", a); 406 midi_debug("NULL TRACK: %d", a);
407 407
408 //BIG DEBUG STATEMENT 408 //BIG DEBUG STATEMENT
409 //printf("\nTrack %2d, Event = %4d of %4d, Delta = %5d, Next = %4d", a, tr->pos, tr->numEvents, tr->delta, getEvent(tr, tr->pos)->delta); 409 //midi_debug("\nTrack %2d, Event = %4d of %4d, Delta = %5d, Next = %4d", a, tr->pos, tr->numEvents, tr->delta, getEvent(tr, tr->pos)->delta);
410 410
411 if (tr != NULL && (tr->pos < tr->numEvents)) 411 if (tr != NULL && (tr->pos < tr->numEvents))
412 { 412 {
@@ -421,7 +421,7 @@ int tick(void)
421 sendEvent(e); 421 sendEvent(e);
422 if ((e->status&0xF0) == MIDI_PRGM) 422 if ((e->status&0xF0) == MIDI_PRGM)
423 { 423 {
424/* printf("\nPatch Event, patch[%d] ==> %d", e->status&0xF, e->d1); */ 424/* midi_debug("\nPatch Event, patch[%d] ==> %d", e->status&0xF, e->d1); */
425 } 425 }
426 } 426 }
427 else 427 else
@@ -429,7 +429,7 @@ int tick(void)
429 if (e->d1 == 0x51) 429 if (e->d1 == 0x51)
430 { 430 {
431 tempo = (((short)e->evData[0])<<16)|(((short)e->evData[1])<<8)|(e->evData[2]); 431 tempo = (((short)e->evData[0])<<16)|(((short)e->evData[1])<<8)|(e->evData[2]);
432/* printf("\nMeta-Event: Tempo Set = %d", tempo); */ 432/* midi_debug("\nMeta-Event: Tempo Set = %d", tempo); */
433 bpm=mf->div*1000000/tempo; 433 bpm=mf->div*1000000/tempo;
434 number_of_samples=SAMPLE_RATE/bpm; 434 number_of_samples=SAMPLE_RATE/bpm;
435 435
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index f2fbe063e7..0ad7bb59f8 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -103,7 +103,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
103 103
104 if(mf->tracks[a] == NULL) 104 if(mf->tracks[a] == NULL)
105 { 105 {
106 printf("NULL TRACK !!!"); 106 midi_debug("NULL TRACK !!!");
107 rb->splash(HZ*2, "Null Track in loader."); 107 rb->splash(HZ*2, "Null Track in loader.");
108 return -1; 108 return -1;
109 } 109 }
@@ -129,10 +129,10 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
129 int file = rb->open(filename, O_RDONLY); 129 int file = rb->open(filename, O_RDONLY);
130 if(file < 0) 130 if(file < 0)
131 { 131 {
132 printf(""); 132 midi_debug("");
133 printf("No MIDI patchset found."); 133 midi_debug("No MIDI patchset found.");
134 printf("Please install the instruments."); 134 midi_debug("Please install the instruments.");
135 printf("See Rockbox page for more info."); 135 midi_debug("See Rockbox page for more info.");
136 136
137 rb->splash(HZ*2, "No Instruments"); 137 rb->splash(HZ*2, "No Instruments");
138 return -1; 138 return -1;
@@ -144,14 +144,14 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
144 /* Scan our config file and load the right patches as needed */ 144 /* Scan our config file and load the right patches as needed */
145 int c = 0; 145 int c = 0;
146 name[0] = '\0'; 146 name[0] = '\0';
147 printf("Loading instruments"); 147 midi_debug("Loading instruments");
148 for(a=0; a<128; a++) 148 for(a=0; a<128; a++)
149 { 149 {
150 while(readChar(file)!=' ' && !eof(file)); 150 while(readChar(file)!=' ' && !eof(file));
151 readTextBlock(file, name); 151 readTextBlock(file, name);
152 152
153 rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); 153 rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name);
154/* printf("\nLOADING: <%s> ", fn); */ 154/* midi_debug("\nLOADING: <%s> ", fn); */
155 155
156 if(patchUsed[a]==1) 156 if(patchUsed[a]==1)
157 { 157 {
@@ -176,7 +176,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
176 /* Scan our config file and load the drum data */ 176 /* Scan our config file and load the drum data */
177 int idx=0; 177 int idx=0;
178 char number[30]; 178 char number[30];
179 printf("Loading drums"); 179 midi_debug("Loading drums");
180 while(!eof(file)) 180 while(!eof(file))
181 { 181 {
182 readTextBlock(file, number); 182 readTextBlock(file, number);
@@ -215,12 +215,12 @@ void setPoint(struct SynthObject * so, int pt)
215 215
216 if(so->wf==NULL) 216 if(so->wf==NULL)
217 { 217 {
218 printf("Crap... null waveform..."); 218 midi_debug("Crap... null waveform...");
219 exit(1); 219 exit(1);
220 } 220 }
221 if(so->wf->envRate==NULL) 221 if(so->wf->envRate==NULL)
222 { 222 {
223 printf("Waveform has no envelope set"); 223 midi_debug("Waveform has no envelope set");
224 exit(1); 224 exit(1);
225 } 225 }
226 226