diff options
Diffstat (limited to 'apps/plugins/midi/synth.c')
-rw-r--r-- | apps/plugins/midi/synth.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 0819722030..09ea1c68c2 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) | |||
140 | return -1; | 140 | return -1; |
141 | } | 141 | } |
142 | 142 | ||
143 | char name[40]; | 143 | char name[MAX_PATH]; |
144 | char fn[40]; | 144 | char fn[MAX_PATH]; |
145 | 145 | ||
146 | /* Scan our config file and load the right patches as needed */ | 146 | /* Scan our config file and load the right patches as needed */ |
147 | char *p; | ||
147 | int c = 0; | 148 | int c = 0; |
148 | name[0] = '\0'; | 149 | name[0] = '\0'; |
149 | printf("Loading instruments"); | 150 | printf("Loading instruments"); |
@@ -151,8 +152,12 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
151 | { | 152 | { |
152 | while(readChar(file)!=' ' && !eof(file)); | 153 | while(readChar(file)!=' ' && !eof(file)); |
153 | readTextBlock(file, name); | 154 | readTextBlock(file, name); |
154 | 155 | DEBUGF("name: %s\n", name); | |
155 | rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); | 156 | p = rb->strrchr(name, '.'); |
157 | if (!p || rb->strncmp(p, ".pat", 4)) | ||
158 | rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name); | ||
159 | else | ||
160 | rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s", name); | ||
156 | /* printf("\nLOADING: <%s> ", fn); */ | 161 | /* printf("\nLOADING: <%s> ", fn); */ |
157 | 162 | ||
158 | if(patchUsed[a]==1) | 163 | if(patchUsed[a]==1) |
@@ -167,7 +172,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
167 | c = readChar(file); | 172 | c = readChar(file); |
168 | } | 173 | } |
169 | rb->close(file); | 174 | rb->close(file); |
170 | 175 | DEBUGF("drums!!\n"); | |
171 | file = rb->open(drumConfig, O_RDONLY); | 176 | file = rb->open(drumConfig, O_RDONLY); |
172 | if(file < 0) | 177 | if(file < 0) |
173 | { | 178 | { |
@@ -183,7 +188,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
183 | { | 188 | { |
184 | readTextBlock(file, number); | 189 | readTextBlock(file, number); |
185 | readTextBlock(file, name); | 190 | readTextBlock(file, name); |
186 | rb->snprintf(fn, 40, ROCKBOX_DIR "/patchset/%s.pat", name); | 191 | rb->snprintf(fn, MAX_PATH, ROCKBOX_DIR "/patchset/%s.pat", name); |
187 | 192 | ||
188 | idx = rb->atoi(number); | 193 | idx = rb->atoi(number); |
189 | if(idx == 0) | 194 | if(idx == 0) |