mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-06 21:25:03 -05:00
Replace remaining printf in midi plugin (fix yellow/red)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27563 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
91a45d2ecc
commit
e024198305
4 changed files with 52 additions and 52 deletions
|
|
@ -33,7 +33,7 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
|
||||
if(file < 0)
|
||||
{
|
||||
printf("Could not open file");
|
||||
midi_debug("Could not open file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -46,21 +46,21 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
{
|
||||
if(fileID == ID_RIFF)
|
||||
{
|
||||
printf("Detected RMID file");
|
||||
printf("Looking for MThd header");
|
||||
midi_debug("Detected RMID file");
|
||||
midi_debug("Looking for MThd header");
|
||||
char dummy[17];
|
||||
rb->read(file, &dummy, 16);
|
||||
if(readID(file) != ID_MTHD)
|
||||
{
|
||||
rb->close(file);
|
||||
printf("Invalid MIDI header within RIFF.");
|
||||
midi_debug("Invalid MIDI header within RIFF.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
rb->close(file);
|
||||
printf("Invalid file header chunk.");
|
||||
midi_debug("Invalid file header chunk.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,14 +68,14 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
if(readFourBytes(file)!=6)
|
||||
{
|
||||
rb->close(file);
|
||||
printf("Header chunk size invalid.");
|
||||
midi_debug("Header chunk size invalid.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(readTwoBytes(file)==2)
|
||||
{
|
||||
rb->close(file);
|
||||
printf("MIDI file type 2 not supported");
|
||||
midi_debug("MIDI file type 2 not supported");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
|
||||
int track=0;
|
||||
|
||||
printf("File has %d tracks.", mfload->numTracks);
|
||||
midi_debug("File has %d tracks.", mfload->numTracks);
|
||||
|
||||
while(! eof(file) && track < mfload->numTracks)
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
{
|
||||
if(mfload->numTracks != track)
|
||||
{
|
||||
printf("Warning: file claims to have %d tracks. I only see %d here.", mfload->numTracks, track);
|
||||
midi_debug("Warning: file claims to have %d tracks. I only see %d here.", mfload->numTracks, track);
|
||||
mfload->numTracks = track;
|
||||
}
|
||||
rb->close(file);
|
||||
|
|
@ -108,7 +108,7 @@ struct MIDIfile * loadFile(const char * filename)
|
|||
track++;
|
||||
} else
|
||||
{
|
||||
printf("SKIPPING TRACK");
|
||||
midi_debug("SKIPPING TRACK");
|
||||
int len = readFourBytes(file);
|
||||
while(--len)
|
||||
readChar(file);
|
||||
|
|
@ -159,58 +159,58 @@ int readEvent(int file, void * dest)
|
|||
{
|
||||
case 0x01: /* Generic text */
|
||||
{
|
||||
printf("Text: %s", ev->evData);
|
||||
midi_debug("Text: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: /* A copyright string within the file */
|
||||
{
|
||||
printf("Copyright: %s", ev->evData);
|
||||
midi_debug("Copyright: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x03: /* Sequence of track name */
|
||||
{
|
||||
printf("Name: %s", ev->evData);
|
||||
midi_debug("Name: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x04: /* Instrument (synth) name */
|
||||
{
|
||||
printf("Instrument: %s", ev->evData);
|
||||
midi_debug("Instrument: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x05: /* Lyrics. These appear on the tracks at the right times */
|
||||
{ /* Usually only a small 'piece' of the lyrics. */
|
||||
/* Maybe the sequencer should print these at play time? */
|
||||
printf("Lyric: %s", ev->evData);
|
||||
midi_debug("Lyric: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x06: /* Text marker */
|
||||
{
|
||||
printf("Marker: %s", ev->evData);
|
||||
midi_debug("Marker: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x07: /* Cue point */
|
||||
{
|
||||
printf("Cue point: %s", ev->evData);
|
||||
midi_debug("Cue point: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x08: /* Program name */
|
||||
{
|
||||
printf("Patch: %s", ev->evData);
|
||||
midi_debug("Patch: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x09: /* Device name. Very much irrelevant here, though. */
|
||||
{
|
||||
printf("Port: %s", ev->evData);
|
||||
midi_debug("Port: %s", ev->evData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ struct Track * readTrack(int file)
|
|||
{
|
||||
if(trackSize < dataPtr-trk->dataBlock)
|
||||
{
|
||||
printf("Track parser memory out of bounds");
|
||||
midi_debug("Track parser memory out of bounds");
|
||||
exit(1);
|
||||
}
|
||||
dataPtr+=sizeof(struct Event);
|
||||
|
|
@ -307,7 +307,7 @@ int readID(int file)
|
|||
id[a]=readChar(file);
|
||||
if(eof(file))
|
||||
{
|
||||
printf("End of file reached.");
|
||||
midi_debug("End of file reached.");
|
||||
return ID_EOF;
|
||||
}
|
||||
if(rb->strcmp(id, "MThd")==0)
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ void get_more(unsigned char** start, size_t* size)
|
|||
#ifndef SYNC
|
||||
if(lastswap != swap)
|
||||
{
|
||||
printf("Buffer miss!"); /* Comment out the printf to make missses less noticable. */
|
||||
midi_debug("Buffer miss!"); /* Comment out the midi_debug to make missses less noticable. */
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -307,12 +307,12 @@ static int midimain(const void * filename)
|
|||
int a, notes_used, vol;
|
||||
bool is_playing = true; /* false = paused */
|
||||
|
||||
printf("Loading file");
|
||||
midi_debug("Loading file");
|
||||
mf = loadFile(filename);
|
||||
|
||||
if (mf == NULL)
|
||||
{
|
||||
printf("Error loading file.");
|
||||
midi_debug("Error loading file.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ static int midimain(const void * filename)
|
|||
* This seems to work quite well. On a laptop, anyway.
|
||||
*/
|
||||
|
||||
printf("Okay, starting sequencing");
|
||||
midi_debug("Okay, starting sequencing");
|
||||
|
||||
bpm = mf->div*1000000/tempo;
|
||||
number_of_samples = SAMPLE_RATE/bpm;
|
||||
|
|
@ -405,7 +405,7 @@ static int midimain(const void * filename)
|
|||
/* but run through the tracks without the synth running */
|
||||
rb->pcm_play_stop();
|
||||
seekBackward(5);
|
||||
printf("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
|
||||
midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
|
||||
if (is_playing)
|
||||
rb->pcm_play_data(&get_more, NULL, 0);
|
||||
break;
|
||||
|
|
@ -415,7 +415,7 @@ static int midimain(const void * filename)
|
|||
{
|
||||
rb->pcm_play_stop();
|
||||
seekForward(5);
|
||||
printf("Skip to %d:%02d\n", playing_time/60, playing_time%60);
|
||||
midi_debug("Skip to %d:%02d\n", playing_time/60, playing_time%60);
|
||||
if (is_playing)
|
||||
rb->pcm_play_data(&get_more, NULL, 0);
|
||||
break;
|
||||
|
|
@ -425,12 +425,12 @@ static int midimain(const void * filename)
|
|||
{
|
||||
if (is_playing)
|
||||
{
|
||||
printf("Paused at %d:%02d\n", playing_time/60, playing_time%60);
|
||||
midi_debug("Paused at %d:%02d\n", playing_time/60, playing_time%60);
|
||||
is_playing = false;
|
||||
rb->pcm_play_stop();
|
||||
} else
|
||||
{
|
||||
printf("Playing from %d:%02d\n", playing_time/60, playing_time%60);
|
||||
midi_debug("Playing from %d:%02d\n", playing_time/60, playing_time%60);
|
||||
is_playing = true;
|
||||
rb->pcm_play_data(&get_more, NULL, 0);
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->cpu_boost(true);
|
||||
#endif
|
||||
|
||||
printf("%s", parameter);
|
||||
midi_debug("%s", parameter);
|
||||
/* rb->splash(HZ, true, parameter); */
|
||||
|
||||
#ifdef RB_PROFILE
|
||||
|
|
|
|||
|
|
@ -219,11 +219,11 @@ inline void pressNote(int ch, int note, int vol)
|
|||
}
|
||||
if (a == MAX_VOICES)
|
||||
{
|
||||
// printf("\nVoice kill");
|
||||
// printf("\nToo many voices playing at once. No more left");
|
||||
// printf("\nVOICE DUMP: ");
|
||||
// midi_debug("\nVoice kill");
|
||||
// midi_debug("\nToo many voices playing at once. No more left");
|
||||
// midi_debug("\nVOICE DUMP: ");
|
||||
// for(a=0; a<48; a++)
|
||||
// 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);
|
||||
// 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);
|
||||
lastKill++;
|
||||
if (lastKill == MAX_VOICES)
|
||||
lastKill = 0;
|
||||
|
|
@ -258,13 +258,13 @@ inline void pressNote(int ch, int note, int vol)
|
|||
if (drumSet[note] != NULL)
|
||||
{
|
||||
if (note < 35)
|
||||
printf("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?");
|
||||
midi_debug("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?");
|
||||
|
||||
struct GWaveform * wf = drumSet[note]->waveforms[0];
|
||||
voices[a].wf = wf;
|
||||
voices[a].delta = (((gustable[note]<<FRACTSIZE) / wf->rootFreq) * wf->sampRate / SAMPLE_RATE);
|
||||
if (wf->mode & 28)
|
||||
// printf("\nWoah, a drum patch has a loop. Stripping the loop...");
|
||||
// midi_debug("\nWoah, a drum patch has a loop. Stripping the loop...");
|
||||
wf->mode = wf->mode & (255-28);
|
||||
|
||||
/* Turn it on */
|
||||
|
|
@ -273,7 +273,7 @@ inline void pressNote(int ch, int note, int vol)
|
|||
|
||||
} else
|
||||
{
|
||||
/* printf("\nWarning: drum %d does not have a patch defined... Ignoring it", note); */
|
||||
/* midi_debug("\nWarning: drum %d does not have a patch defined... Ignoring it", note); */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ static void sendEvent(struct Event * ev)
|
|||
if(chLastCtrlMSB[status_low] == REG_PITCHBEND_MSB &&
|
||||
chLastCtrlLSB[status_low] == REG_PITCHBEND_LSB)
|
||||
{
|
||||
// printf("Pitch bend depth set to %d\n", d2);
|
||||
// midi_debug("Pitch bend depth set to %d\n", d2);
|
||||
chPBDepth[status_low] = d2;
|
||||
}
|
||||
return;
|
||||
|
|
@ -403,10 +403,10 @@ int tick(void)
|
|||
struct Track * tr = mf->tracks[a];
|
||||
|
||||
if (tr == NULL)
|
||||
printf("NULL TRACK: %d", a);
|
||||
midi_debug("NULL TRACK: %d", a);
|
||||
|
||||
//BIG DEBUG STATEMENT
|
||||
//printf("\nTrack %2d, Event = %4d of %4d, Delta = %5d, Next = %4d", a, tr->pos, tr->numEvents, tr->delta, getEvent(tr, tr->pos)->delta);
|
||||
//midi_debug("\nTrack %2d, Event = %4d of %4d, Delta = %5d, Next = %4d", a, tr->pos, tr->numEvents, tr->delta, getEvent(tr, tr->pos)->delta);
|
||||
|
||||
if (tr != NULL && (tr->pos < tr->numEvents))
|
||||
{
|
||||
|
|
@ -421,7 +421,7 @@ int tick(void)
|
|||
sendEvent(e);
|
||||
if ((e->status&0xF0) == MIDI_PRGM)
|
||||
{
|
||||
/* printf("\nPatch Event, patch[%d] ==> %d", e->status&0xF, e->d1); */
|
||||
/* midi_debug("\nPatch Event, patch[%d] ==> %d", e->status&0xF, e->d1); */
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -429,7 +429,7 @@ int tick(void)
|
|||
if (e->d1 == 0x51)
|
||||
{
|
||||
tempo = (((short)e->evData[0])<<16)|(((short)e->evData[1])<<8)|(e->evData[2]);
|
||||
/* printf("\nMeta-Event: Tempo Set = %d", tempo); */
|
||||
/* midi_debug("\nMeta-Event: Tempo Set = %d", tempo); */
|
||||
bpm=mf->div*1000000/tempo;
|
||||
number_of_samples=SAMPLE_RATE/bpm;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
|
|||
|
||||
if(mf->tracks[a] == NULL)
|
||||
{
|
||||
printf("NULL TRACK !!!");
|
||||
midi_debug("NULL TRACK !!!");
|
||||
rb->splash(HZ*2, "Null Track in loader.");
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -129,10 +129,10 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
|
|||
int file = rb->open(filename, O_RDONLY);
|
||||
if(file < 0)
|
||||
{
|
||||
printf("");
|
||||
printf("No MIDI patchset found.");
|
||||
printf("Please install the instruments.");
|
||||
printf("See Rockbox page for more info.");
|
||||
midi_debug("");
|
||||
midi_debug("No MIDI patchset found.");
|
||||
midi_debug("Please install the instruments.");
|
||||
midi_debug("See Rockbox page for more info.");
|
||||
|
||||
rb->splash(HZ*2, "No Instruments");
|
||||
return -1;
|
||||
|
|
@ -144,14 +144,14 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
|
|||
/* Scan our config file and load the right patches as needed */
|
||||
int c = 0;
|
||||
name[0] = '\0';
|
||||
printf("Loading instruments");
|
||||
midi_debug("Loading instruments");
|
||||
for(a=0; a<128; a++)
|
||||
{
|
||||
while(readChar(file)!=' ' && !eof(file));
|
||||
readTextBlock(file, name);
|
||||
|
||||
rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name);
|
||||
/* printf("\nLOADING: <%s> ", fn); */
|
||||
/* midi_debug("\nLOADING: <%s> ", fn); */
|
||||
|
||||
if(patchUsed[a]==1)
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
|
|||
/* Scan our config file and load the drum data */
|
||||
int idx=0;
|
||||
char number[30];
|
||||
printf("Loading drums");
|
||||
midi_debug("Loading drums");
|
||||
while(!eof(file))
|
||||
{
|
||||
readTextBlock(file, number);
|
||||
|
|
@ -215,12 +215,12 @@ void setPoint(struct SynthObject * so, int pt)
|
|||
|
||||
if(so->wf==NULL)
|
||||
{
|
||||
printf("Crap... null waveform...");
|
||||
midi_debug("Crap... null waveform...");
|
||||
exit(1);
|
||||
}
|
||||
if(so->wf->envRate==NULL)
|
||||
{
|
||||
printf("Waveform has no envelope set");
|
||||
midi_debug("Waveform has no envelope set");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue