diff options
Diffstat (limited to 'apps/plugins/midi/synth.c')
-rw-r--r-- | apps/plugins/midi/synth.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 86cb43483a..99864e557e 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c | |||
@@ -186,10 +186,7 @@ inline signed short int getSample(struct GWaveform * wf, unsigned int s) | |||
186 | { | 186 | { |
187 | 187 | ||
188 | if(s<<1 >= wf->wavSize) | 188 | if(s<<1 >= wf->wavSize) |
189 | { | ||
190 | // printf("\nSAMPLE OUT OF RANGE: s=%d 2s=%d ws=%d", s, 2*s, wf->wavSize); | ||
191 | return 0; | 189 | return 0; |
192 | } | ||
193 | 190 | ||
194 | 191 | ||
195 | /* | 192 | /* |
@@ -198,14 +195,14 @@ inline signed short int getSample(struct GWaveform * wf, unsigned int s) | |||
198 | */ | 195 | */ |
199 | 196 | ||
200 | 197 | ||
201 | //If they are unsigned, convert them to signed | 198 | //Sign conversion moved into guspat.c |
202 | //or was it the other way around. Whatever, it works | 199 | unsigned char b1=wf->data[s<<1]; //+((wf->mode & 2) << 6); |
203 | unsigned char b1=wf->data[s<<1]+((wf->mode & 2) << 6); | 200 | unsigned char b2=wf->data[(s<<1)|1]; //+((wf->mode & 2) << 6); |
204 | unsigned char b2=wf->data[(s<<1)|1]+((wf->mode & 2) << 6); | 201 | return (b1 | (b2<<8)) ; |
205 | return (b1 | (b2<<8)); | ||
206 | } | 202 | } |
207 | else | 203 | else |
208 | { //8-bit samples | 204 | { //8-bit samples |
205 | //Do we even have anything 8-bit in our set? | ||
209 | unsigned char b1=wf->data[s]+((wf->mode & 2) << 6); | 206 | unsigned char b1=wf->data[s]+((wf->mode & 2) << 6); |
210 | return b1<<8; | 207 | return b1<<8; |
211 | } | 208 | } |
@@ -237,10 +234,6 @@ inline void setPoint(struct SynthObject * so, int pt) | |||
237 | so->curPoint = pt; | 234 | so->curPoint = pt; |
238 | 235 | ||
239 | int r=0; | 236 | int r=0; |
240 | |||
241 | |||
242 | |||
243 | |||
244 | int rate = so->wf->envRate[pt]; | 237 | int rate = so->wf->envRate[pt]; |
245 | 238 | ||
246 | r=3-((rate>>6) & 0x3); // Some blatant Timidity code for rate conversion... | 239 | r=3-((rate>>6) & 0x3); // Some blatant Timidity code for rate conversion... |
@@ -256,7 +249,7 @@ inline void setPoint(struct SynthObject * so, int pt) | |||
256 | default this to 10, and maybe later have an option to set it to 9 | 249 | default this to 10, and maybe later have an option to set it to 9 |
257 | for longer decays. | 250 | for longer decays. |
258 | */ | 251 | */ |
259 | so->curRate = r<<9; | 252 | so->curRate = r<<10; |
260 | 253 | ||
261 | 254 | ||
262 | so->targetOffset = so->wf->envOffset[pt]<<(20); | 255 | so->targetOffset = so->wf->envOffset[pt]<<(20); |
@@ -372,6 +365,7 @@ inline signed short int synthVoice(int v) | |||
372 | if(so->curOffset < 0) | 365 | if(so->curOffset < 0) |
373 | so->isUsed=0; //This is OK | 366 | so->isUsed=0; //This is OK |
374 | 367 | ||
368 | |||
375 | s = s * (so->curOffset >> 22); | 369 | s = s * (so->curOffset >> 22); |
376 | s = s>>6; | 370 | s = s>>6; |
377 | 371 | ||