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