summaryrefslogtreecommitdiff
path: root/apps/plugins/midi
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-07-27 20:36:45 +0000
committerNils Wallménius <nils@rockbox.org>2008-07-27 20:36:45 +0000
commit2d337dab7f6d32f8a0ddd035dd904b3f51909afb (patch)
tree333fa2ce3137b6967c3005cd745b326d2a071d7c /apps/plugins/midi
parentb2c4a9a0a95a62fa4ef9c5800f9e5ab014932a4d (diff)
downloadrockbox-2d337dab7f6d32f8a0ddd035dd904b3f51909afb.zip
rockbox-2d337dab7f6d32f8a0ddd035dd904b3f51909afb.tar.gz
rockbox-2d337dab7f6d32f8a0ddd035dd904b3f51909afb.tar.bz2
rockbox-2d337dab7f6d32f8a0ddd035dd904b3f51909afb.tar.xz
FS#9221 by Christopher Williams fixing a couple of bugs in keybox
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18138 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/midi')
-rw-r--r--apps/plugins/midi/guspat.c12
-rw-r--r--apps/plugins/midi/synth.c17
2 files changed, 18 insertions, 11 deletions
diff --git a/apps/plugins/midi/guspat.c b/apps/plugins/midi/guspat.c
index 419cfa3..1b310d2 100644
--- a/apps/plugins/midi/guspat.c
+++ b/apps/plugins/midi/guspat.c
@@ -162,10 +162,12 @@ struct GPatch * gusload(char * filename)
int file = rb->open(filename, O_RDONLY);
+ DEBUGF("filename: %s\n", filename);
+
if(file == -1)
{
- char message[50];
- rb->snprintf(message, 50, "Error opening %s", filename);
+ char message[MAX_PATH];
+ rb->snprintf(message, MAX_PATH, "Error opening %s", filename);
rb->splash(HZ*2, message);
return NULL;
}
@@ -197,12 +199,12 @@ struct GPatch * gusload(char * filename)
/* printf("\nFILE: %s", filename); */
/* printf("\nlayerSamples=%d", gp->numWaves); */
-
+DEBUGF("hej\n");
int a=0;
for(a=0; a<gp->numWaves; a++)
gp->waveforms[a] = loadWaveform(file);
-
+DEBUGF("hej2\n");
/* printf("\nPrecomputing note table"); */
for(a=0; a<128; a++)
@@ -210,7 +212,7 @@ struct GPatch * gusload(char * filename)
gp->noteTable[a] = selectWaveform(gp, a);
}
rb->close(file);
-
+DEBUGF("hej3\n");
return gp;
}
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 0819722..09ea1c6 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -140,10 +140,11 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
return -1;
}
- char name[40];
- char fn[40];
+ char name[MAX_PATH];
+ char fn[MAX_PATH];
/* Scan our config file and load the right patches as needed */
+ char *p;
int c = 0;
name[0] = '\0';
printf("Loading instruments");
@@ -151,8 +152,12 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
{
while(readChar(file)!=' ' && !eof(file));
readTextBlock(file, name);
-
- rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name);
+ DEBUGF("name: %s\n", name);
+ p = rb->strrchr(name, '.');
+ if (!p || rb->strncmp(p, ".pat", 4))
+ rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name);
+ else
+ rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s", name);
/* printf("\nLOADING: <%s> ", fn); */
if(patchUsed[a]==1)
@@ -167,7 +172,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
c = readChar(file);
}
rb->close(file);
-
+DEBUGF("drums!!\n");
file = rb->open(drumConfig, O_RDONLY);
if(file < 0)
{
@@ -183,7 +188,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
{
readTextBlock(file, number);
readTextBlock(file, name);
- rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name);
+ rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name);
idx = rb->atoi(number);
if(idx == 0)