view minijss/jmixtmpl_c.h @ 2208:90ec1ec89c56

Revamp the palette handling in lib64gfx somewhat, add helper functions to lib64util for handling external palette file options and add support for specifying one of the "internal" palettes or external (.act) palette file to gfxconv and 64vw.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 05:01:12 +0300
parents b52905e2788e
children
line wrap: on
line source

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

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

    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_RAMP
            strideLength++;
        }
    }

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

    chn->chPos = tmpPos;
    chn->chVolume = tmpVolume;
    return strideLength;
}
#endif

#undef JMIXER_NAME
#undef JMIXER_NEXT
#undef JMIXER_NEXT_RAMP
#undef JMIXER_ENDCOND