summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/synth.c
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/synth.c
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/synth.c')
-rw-r--r--apps/plugins/midi/synth.c17
1 files changed, 11 insertions, 6 deletions
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)