view jmixtmpl_c.h @ 49:033c660c25f5

Restructure module playing, removing 8bit sample mixing (output can still be 8bit, but samples are internally upconverted to 16bit after module loading.) Also prepare for floating point mixing support.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 02:51:41 +0300
parents 1936fc1a6c18
children 36e2f910219c
line wrap: on
line source

/*
 * miniJSS - Mixing routine in C, innerloop template
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP)
 */

#ifdef JMIXER_HEADER
int JMIXER_NAME (JSSMixer *, JSSChannel *, Sint32 *, const int, const Sint32);
#else
int JMIXER_NAME (JSSMixer *mixer, JSSChannel *chn, JMIXER_ADDBUF_TYPE *addBuffer, const int mixLength, const Sint32 endPos)
{
    const DMFixedPoint tmpDelta = chn->chDeltaO;
    DMFixedPoint tmpPos = chn->chPos;
    JMIXER_ADDBUF_TYPE
        *ap = addBuffer,
        tr = chn->chPrevR,
        tl = chn->chPrevL;
    int strideLength = 0;
    JMIXER_SAMPLE_TYPE *sp = (JMIXER_SAMPLE_TYPE *) chn->chData;

    JMIXER_INIT

    while (strideLength < mixLength && JMIXER_ENDCOND)
    {
        JMIXER_FUNC
        JMIXER_DEBUG
        JMIXER_NEXT
        strideLength++;
    }

    chn->chPos.dw = tmpPos.dw;
    chn->chPrevR = tr;
    chn->chPrevL = tl;
    return strideLength;
}
#endif

#undef JMIXER_NAME
#undef JMIXER_NEXT
#undef JMIXER_ENDCOND