diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/midi/synth.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 95bb88f8c6..f65a062c43 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c | |||
@@ -238,7 +238,7 @@ void setPoint(struct SynthObject * so, int pt) | |||
238 | * | 238 | * |
239 | * Or just move the 1 up one line to optimize a tiny bit. | 239 | * Or just move the 1 up one line to optimize a tiny bit. |
240 | */ | 240 | */ |
241 | so->curRate = so->curRate << 1; | 241 | /* so->curRate = so->curRate << 1; */ |
242 | 242 | ||
243 | 243 | ||
244 | so->targetOffset = so->wf->envOffset[pt]<<(20); | 244 | so->targetOffset = so->wf->envOffset[pt]<<(20); |
@@ -251,7 +251,6 @@ inline void stopVoice(struct SynthObject * so) | |||
251 | { | 251 | { |
252 | if(so->state == STATE_RAMPDOWN) | 252 | if(so->state == STATE_RAMPDOWN) |
253 | return; | 253 | return; |
254 | // so->isUsed = 0; | ||
255 | so->state = STATE_RAMPDOWN; | 254 | so->state = STATE_RAMPDOWN; |
256 | so->decay = 0; | 255 | so->decay = 0; |
257 | } | 256 | } |
@@ -285,7 +284,7 @@ signed short int synthVoice(struct SynthObject * so) | |||
285 | } | 284 | } |
286 | 285 | ||
287 | 286 | ||
288 | cpShifted = so->cp >> FRACTSIZE; //Was 10 | 287 | cpShifted = so->cp >> FRACTSIZE; |
289 | 288 | ||
290 | 289 | ||
291 | 290 | ||
@@ -296,7 +295,7 @@ signed short int synthVoice(struct SynthObject * so) | |||
296 | { | 295 | { |
297 | if(wf->mode & LOOP_REVERSE) | 296 | if(wf->mode & LOOP_REVERSE) |
298 | { | 297 | { |
299 | so->cp = (wf->endLoop)<<FRACTSIZE; //Was 10 | 298 | so->cp = (wf->endLoop)<<FRACTSIZE; |
300 | cpShifted = wf->endLoop; | 299 | cpShifted = wf->endLoop; |
301 | s2=getSample((cpShifted), wf); | 300 | s2=getSample((cpShifted), wf); |
302 | } | 301 | } |
@@ -312,7 +311,7 @@ signed short int synthVoice(struct SynthObject * so) | |||
312 | so->loopState = STATE_LOOPING; | 311 | so->loopState = STATE_LOOPING; |
313 | if((wf->mode & (24)) == 0) | 312 | if((wf->mode & (24)) == 0) |
314 | { | 313 | { |
315 | so->cp = (wf->startLoop)<<FRACTSIZE; //Was 10 | 314 | so->cp = (wf->startLoop)<<FRACTSIZE; |
316 | cpShifted = wf->startLoop; | 315 | cpShifted = wf->startLoop; |
317 | s2=getSample((cpShifted), wf); | 316 | s2=getSample((cpShifted), wf); |
318 | } | 317 | } |
@@ -331,8 +330,6 @@ signed short int synthVoice(struct SynthObject * so) | |||
331 | 330 | ||
332 | cpShifted = so->cp >> FRACTSIZE; | 331 | cpShifted = so->cp >> FRACTSIZE; |
333 | s2 = getSample((cpShifted)+1, wf); | 332 | s2 = getSample((cpShifted)+1, wf); |
334 | // if((wf->mode & (28))) | ||
335 | // printf("OV1 (loop 2)"); | ||
336 | stopVoice(so); | 333 | stopVoice(so); |
337 | } | 334 | } |
338 | 335 | ||
@@ -340,14 +337,14 @@ signed short int synthVoice(struct SynthObject * so) | |||
340 | /* Better, working, linear interpolation */ | 337 | /* Better, working, linear interpolation */ |
341 | s1=getSample((cpShifted), wf); | 338 | s1=getSample((cpShifted), wf); |
342 | 339 | ||
343 | s = s1 + ((signed)((s2 - s1) * (so->cp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); //Was 10 | 340 | s = s1 + ((signed)((s2 - s1) * (so->cp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); |
344 | 341 | ||
345 | /* ADSR COMMENT WOULD GO FROM HERE.........*/ | ||
346 | 342 | ||
347 | if(so->curRate == 0) | 343 | if(so->curRate == 0) |
348 | { | 344 | { |
349 | stopVoice(so); | 345 | stopVoice(so); |
350 | // printf("OV2"); | 346 | // so->isUsed = 0; |
347 | |||
351 | } | 348 | } |
352 | 349 | ||
353 | if(so->ch != 9 && so->state != STATE_RAMPDOWN) /* Stupid ADSR code... and don't do ADSR for drums */ | 350 | if(so->ch != 9 && so->state != STATE_RAMPDOWN) /* Stupid ADSR code... and don't do ADSR for drums */ |
@@ -358,11 +355,12 @@ signed short int synthVoice(struct SynthObject * so) | |||
358 | if(so -> curOffset > so->targetOffset && so->curPoint != 2) | 355 | if(so -> curOffset > so->targetOffset && so->curPoint != 2) |
359 | { | 356 | { |
360 | if(so->curPoint != 5) | 357 | if(so->curPoint != 5) |
358 | { | ||
361 | setPoint(so, so->curPoint+1); | 359 | setPoint(so, so->curPoint+1); |
360 | } | ||
362 | else | 361 | else |
363 | { | 362 | { |
364 | stopVoice(so); | 363 | stopVoice(so); |
365 | // printf("OV3"); | ||
366 | } | 364 | } |
367 | } | 365 | } |
368 | } else | 366 | } else |
@@ -372,11 +370,12 @@ signed short int synthVoice(struct SynthObject * so) | |||
372 | { | 370 | { |
373 | 371 | ||
374 | if(so->curPoint != 5) | 372 | if(so->curPoint != 5) |
373 | { | ||
375 | setPoint(so, so->curPoint+1); | 374 | setPoint(so, so->curPoint+1); |
375 | } | ||
376 | else | 376 | else |
377 | { | 377 | { |
378 | stopVoice(so); | 378 | stopVoice(so); |
379 | // printf("OV4"); | ||
380 | } | 379 | } |
381 | 380 | ||
382 | } | 381 | } |
@@ -385,9 +384,10 @@ signed short int synthVoice(struct SynthObject * so) | |||
385 | 384 | ||
386 | if(so->curOffset < 0) | 385 | if(so->curOffset < 0) |
387 | { | 386 | { |
388 | stopVoice(so); | 387 | so->curOffset = so->targetOffset; |
389 | // printf("OV5"); | 388 | stopVoice(so); |
390 | } | 389 | } |
390 | |||
391 | s = (s * (so->curOffset >> 22) >> 8); | 391 | s = (s * (so->curOffset >> 22) >> 8); |
392 | 392 | ||
393 | 393 | ||
@@ -400,8 +400,6 @@ signed short int synthVoice(struct SynthObject * so) | |||
400 | } | 400 | } |
401 | 401 | ||
402 | 402 | ||
403 | /* ............. TO HERE */ | ||
404 | |||
405 | /* Scaling by channel volume and note volume is done in sequencer.c */ | 403 | /* Scaling by channel volume and note volume is done in sequencer.c */ |
406 | /* That saves us some multiplication and pointer operations */ | 404 | /* That saves us some multiplication and pointer operations */ |
407 | return s*so->volscale>>14; | 405 | return s*so->volscale>>14; |