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
This commit is contained in:
parent
c84461fb8f
commit
94d9d152b6
1 changed files with 14 additions and 16 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue