Mercurial > hg > dmlib
changeset 230:585e0a95be36
Optimize mixing slightly.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 08 Oct 2012 03:01:30 +0300 |
parents | 301de8c0cd01 |
children | e65fed571d7a |
files | jmixtmpl_c.h |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/jmixtmpl_c.h Mon Oct 08 02:13:12 2012 +0300 +++ b/jmixtmpl_c.h Mon Oct 08 03:01:30 2012 +0300 @@ -15,28 +15,37 @@ *ap = addBuffer, *tr = chn->chPrevR, *tl = chn->chPrevL; - int strideLength = 0, tmpVolumeD = chn->chVolumeD; + int strideLength = 0; JMIXER_SAMPLE_TYPE *sp = (JMIXER_SAMPLE_TYPE *) chn->chData; JMIXER_INIT + if (chn->chVolumeD > 0) + { + const int tmpLength = chn->chVolumeD < mixLength ? chn->chVolumeD : mixLength; + chn->chVolumeD -= tmpLength; + + while (strideLength < tmpLength && JMIXER_ENDCOND) + { + JMIXER_FUNC + JMIXER_DEBUG + JMIXER_NEXT + FP_ADD(tmpVolume, tmpDeltaV); + strideLength++; + } + } + while (strideLength < mixLength && JMIXER_ENDCOND) { JMIXER_FUNC JMIXER_DEBUG JMIXER_NEXT - if (tmpVolumeD) - { - tmpVolumeD--; - FP_ADD(tmpVolume, tmpDeltaV); - } strideLength++; } chn->chPos = tmpPos; chn->chVolume = tmpVolume; - chn->chVolumeD = tmpVolumeD; return strideLength; } #endif