diff options
author | Stepan Moskovchenko <stevenm@rockbox.org> | 2006-10-03 23:27:44 +0000 |
---|---|---|
committer | Stepan Moskovchenko <stevenm@rockbox.org> | 2006-10-03 23:27:44 +0000 |
commit | 94d9d152b63819d665d8c00075381110ce0154f5 (patch) | |
tree | 2493537de221be20efba29fa53ee7020acbd9d5f /apps/plugins/midi | |
parent | c84461fb8f9404b2b32d90a649b63b669e1a6bb8 (diff) |
More ADSR related voodoo. Hopefully will get to patch prescaler soon.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11118 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/midi')
-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) * * Or just move the 1 up one line to optimize a tiny bit. */ - so->curRate = so->curRate << 1; + /* so->curRate = so->curRate << 1; */ so->targetOffset = so->wf->envOffset[pt]<<(20); @@ -251,7 +251,6 @@ inline void stopVoice(struct SynthObject * so) { if(so->state == STATE_RAMPDOWN) return; - // so->isUsed = 0; so->state = STATE_RAMPDOWN; so->decay = 0; } @@ -285,7 +284,7 @@ signed short int synthVoice(struct SynthObject * so) } - cpShifted = so->cp >> FRACTSIZE; //Was 10 + cpShifted = so->cp >> FRACTSIZE; @@ -296,7 +295,7 @@ signed short int synthVoice(struct SynthObject * so) { if(wf->mode & LOOP_REVERSE) { - so->cp = (wf->endLoop)<<FRACTSIZE; //Was 10 + so->cp = (wf->endLoop)<<FRACTSIZE; cpShifted = wf->endLoop; s2=getSample((cpShifted), wf); } @@ -312,7 +311,7 @@ signed short int synthVoice(struct SynthObject * so) so->loopState = STATE_LOOPING; if((wf->mode & (24)) == 0) { - so->cp = (wf->startLoop)<<FRACTSIZE; //Was 10 + so->cp = (wf->startLoop)<<FRACTSIZE; cpShifted = wf->startLoop; s2=getSample((cpShifted), wf); } @@ -331,8 +330,6 @@ signed short int synthVoice(struct SynthObject * so) cpShifted = so->cp >> FRACTSIZE; s2 = getSample((cpShifted)+1, wf); - // if((wf->mode & (28))) - // printf("OV1 (loop 2)"); stopVoice(so); } @@ -340,14 +337,14 @@ signed short int synthVoice(struct SynthObject * so) /* Better, working, linear interpolation */ s1=getSample((cpShifted), wf); - s = s1 + ((signed)((s2 - s1) * (so->cp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); //Was 10 + s = s1 + ((signed)((s2 - s1) * (so->cp & ((1<<FRACTSIZE)-1)))>>FRACTSIZE); -/* ADSR COMMENT WOULD GO FROM HERE.........*/ if(so->curRate == 0) { stopVoice(so); -// printf("OV2"); +// so->isUsed = 0; + } 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) if(so -> curOffset > so->targetOffset && so->curPoint != 2) { if(so->curPoint != 5) + { setPoint(so, so->curPoint+1); + } else { stopVoice(so); -// printf("OV3"); } } } else @@ -372,11 +370,12 @@ signed short int synthVoice(struct SynthObject * so) { if(so->curPoint != 5) + { setPoint(so, so->curPoint+1); + } else { stopVoice(so); -// printf("OV4"); } } @@ -385,9 +384,10 @@ signed short int synthVoice(struct SynthObject * so) if(so->curOffset < 0) { - stopVoice(so); -// printf("OV5"); + so->curOffset = so->targetOffset; + stopVoice(so); } + s = (s * (so->curOffset >> 22) >> 8); @@ -400,8 +400,6 @@ signed short int synthVoice(struct SynthObject * so) } -/* ............. TO HERE */ - /* Scaling by channel volume and note volume is done in sequencer.c */ /* That saves us some multiplication and pointer operations */ return s*so->volscale>>14; |