ref: a6835eeb1a67ffad59c30a01a515ddd9dc2e83af
parent: fc5ed17074d77e0c09d821c816521889dae41fbc
author: Olav Sørensen <[email protected]>
date: Tue Jan 16 08:57:49 EST 2024
Remove mono mixers (was wasteful)
--- a/src/ft2_audio.c
+++ b/src/ft2_audio.c
@@ -15,7 +15,6 @@
#include "ft2_tables.h"
#include "ft2_structs.h"
#include "mixer/ft2_mix.h"
-#include "mixer/ft2_center_mix.h"
#include "mixer/ft2_silence_mix.h"
// hide POSIX warnings
@@ -462,32 +461,15 @@
{
if (v->active)
{
- bool centerMixFlag;
-
const bool volRampFlag = (v->volumeRampLength > 0);
- if (volRampFlag)
- {
- centerMixFlag = (v->fTargetVolumeL == v->fTargetVolumeR) && (v->fVolumeLDelta == v->fVolumeRDelta);
- }
- else // no volume ramping active
- {
- if (v->fCurrVolumeL == 0.0f && v->fCurrVolumeR == 0.0f)
- {
- silenceMixRoutine(v, samplesToMix);
- continue;
- }
-
- centerMixFlag = (v->fCurrVolumeL == v->fCurrVolumeR);
- }
-
- mixFuncTab[((int32_t)centerMixFlag * (3*5*2*2)) + ((int32_t)volRampFlag * (3*5*2)) + v->mixFuncOffset](v, bufferPosition, samplesToMix);
+ if (!volRampFlag && v->fCurrVolumeL == 0.0f && v->fCurrVolumeR == 0.0f)
+ silenceMixRoutine(v, samplesToMix);
+ else
+ mixFuncTab[((int32_t)volRampFlag * (3*5*2)) + v->mixFuncOffset](v, bufferPosition, samplesToMix);
}
if (r->active) // volume ramp fadeout-voice
- {
- const bool centerMixFlag = (r->fTargetVolumeL == r->fTargetVolumeR) && (r->fVolumeLDelta == r->fVolumeRDelta);
- mixFuncTab[((int32_t)centerMixFlag * (3*5*2*2)) + (3*5*2) + r->mixFuncOffset](r, bufferPosition, samplesToMix);
- }
+ mixFuncTab[(3*5*2) + r->mixFuncOffset](r, bufferPosition, samplesToMix);
}
}
--- a/src/mixer/ft2_center_mix.c
+++ /dev/null
@@ -1,3479 +1,0 @@
-#include <stdint.h>
-#include <stdbool.h>
-#include "ft2_mix_macros.h"
-#include "../ft2_cpu.h"
-
-/* Check out ft2_mix.c for comments on how this works.
-** These are duplicates for center-mixing (slightly faster when it can be used).
-*/
-
-/* ----------------------------------------------------------------------- */
-/* 8-BIT CENTER MIXING ROUTINES */
-/* ----------------------------------------------------------------------- */
-
-void centerMix8bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- }
- }
-
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- }
- }
-
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- }
- }
-
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix8bRampBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int8_t *base, *revBase, *smpPtr;
- int8_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE8_BIDI
- PREPARE_TAP_FIX8
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_8BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-/* ----------------------------------------------------------------------- */
-/* 16-BIT CENTER MIXING ROUTINES */
-/* ----------------------------------------------------------------------- */
-
-void centerMix16bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO
- GET_MIXER_VARS
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S8INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16_BIDI
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_LINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_S16INTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
-
- HANDLE_SAMPLE_END
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS
- }
- }
-
- WRAP_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
-
-void centerMix16bRampBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples)
-{
- const int16_t *base, *revBase, *smpPtr;
- int16_t *smpTapPtr;
- float fSample, *fMixBufferL, *fMixBufferR;
- int32_t position;
- float fVolumeLDelta, fVolumeL;
- uint32_t i, samplesToMix, samplesLeft;
- uintCPUWord_t positionFrac, tmpDelta;
-
- GET_VOL_MONO_RAMP
- GET_MIXER_VARS_MONO_RAMP
- SET_BASE16_BIDI
- PREPARE_TAP_FIX16
-
- samplesLeft = numSamples;
- while (samplesLeft > 0)
- {
- LIMIT_MIX_NUM
- LIMIT_MIX_NUM_MONO_RAMP
- samplesLeft -= samplesToMix;
-
- START_BIDI
- if (v->hasLooped) // the negative interpolation taps need a special case after the sample has looped once
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- else
- {
- for (i = 0; i < (samplesToMix & 3); i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- samplesToMix >>= 2;
- for (i = 0; i < samplesToMix; i++)
- {
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- RENDER_16BIT_SMP_MONO_CINTRP
- VOLUME_RAMPING_MONO
- INC_POS_BIDI
- }
- }
- END_BIDI
-
- WRAP_BIDI_LOOP
- }
-
- SET_VOL_BACK_MONO
- SET_BACK_MIXER_POS
-}
--- a/src/mixer/ft2_center_mix.h
+++ /dev/null
@@ -1,76 +1,0 @@
-#pragma once
-
-#include <stdint.h>
-#include "../ft2_audio.h"
-
-// no volume ramping
-
-// 8-bit
-void centerMix8bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-
-// 16-bit
-void centerMix16bNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-
-// volume ramping
-
-// 8-bit
-void centerMix8bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix8bRampBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-
-// 16bit
-void centerMix16bRampNoLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampBidiLoop(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampNoLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampBidiLoopS8Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampNoLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampBidiLoopLIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampNoLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampBidiLoopS16Intrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampNoLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
-void centerMix16bRampBidiLoopCIntrp(voice_t *v, uint32_t bufferPos, uint32_t numSamples);
--- a/src/mixer/ft2_mix.c
+++ b/src/mixer/ft2_mix.c
@@ -2,7 +2,6 @@
#include <stdbool.h>
#include "ft2_mix.h"
#include "ft2_mix_macros.h"
-#include "ft2_center_mix.h"
#include "../ft2_cpu.h"
/*
@@ -17,7 +16,7 @@
**
** This file has separate routines for EVERY possible sampling variation:
** Interpolation none/sinc/linear/cubic, volumeramp on/off, 8-bit, 16-bit, no loop, loop, bidi.
-** (36 mixing routines in total + another 36 for center-mixing)
+** (48 mixing routines in total)
**
** Every voice has a function pointer set to the according mixing routine on
** sample trigger (from replayer, but set in audio thread), using a function
@@ -3499,12 +3498,6 @@
const mixFunc mixFuncTab[] =
{
- /*
- ** ---------------------------------
- ** stereo mixing (this file)
- ** ---------------------------------
- */
-
// no volume ramping
// 8-bit
@@ -3575,83 +3568,5 @@
(mixFunc)mix16bRampBidiLoopS16Intrp,
(mixFunc)mix16bRampNoLoopCIntrp,
(mixFunc)mix16bRampLoopCIntrp,
- (mixFunc)mix16bRampBidiLoopCIntrp,
-
- /*
- ** ---------------------------------
- ** center mixing (ft2_center_mix.c)
- ** ---------------------------------
- */
-
- // no volume ramping
-
- // 8-bit
- (mixFunc)centerMix8bNoLoop,
- (mixFunc)centerMix8bLoop,
- (mixFunc)centerMix8bBidiLoop,
- (mixFunc)centerMix8bNoLoopS8Intrp,
- (mixFunc)centerMix8bLoopS8Intrp,
- (mixFunc)centerMix8bBidiLoopS8Intrp,
- (mixFunc)centerMix8bNoLoopLIntrp,
- (mixFunc)centerMix8bLoopLIntrp,
- (mixFunc)centerMix8bBidiLoopLIntrp,
- (mixFunc)centerMix8bNoLoopS16Intrp,
- (mixFunc)centerMix8bLoopS16Intrp,
- (mixFunc)centerMix8bBidiLoopS16Intrp,
- (mixFunc)centerMix8bNoLoopCIntrp,
- (mixFunc)centerMix8bLoopCIntrp,
- (mixFunc)centerMix8bBidiLoopCIntrp,
-
- // 16-bit
- (mixFunc)centerMix16bNoLoop,
- (mixFunc)centerMix16bLoop,
- (mixFunc)centerMix16bBidiLoop,
- (mixFunc)centerMix16bNoLoopS8Intrp,
- (mixFunc)centerMix16bLoopS8Intrp,
- (mixFunc)centerMix16bBidiLoopS8Intrp,
- (mixFunc)centerMix16bNoLoopLIntrp,
- (mixFunc)centerMix16bLoopLIntrp,
- (mixFunc)centerMix16bBidiLoopLIntrp,
- (mixFunc)centerMix16bNoLoopS16Intrp,
- (mixFunc)centerMix16bLoopS16Intrp,
- (mixFunc)centerMix16bBidiLoopS16Intrp,
- (mixFunc)centerMix16bNoLoopCIntrp,
- (mixFunc)centerMix16bLoopCIntrp,
- (mixFunc)centerMix16bBidiLoopCIntrp,
-
- // volume ramping
-
- // 8-bit
- (mixFunc)centerMix8bRampNoLoop,
- (mixFunc)centerMix8bRampLoop,
- (mixFunc)centerMix8bRampBidiLoop,
- (mixFunc)centerMix8bRampNoLoopS8Intrp,
- (mixFunc)centerMix8bRampLoopS8Intrp,
- (mixFunc)centerMix8bRampBidiLoopS8Intrp,
- (mixFunc)centerMix8bRampNoLoopLIntrp,
- (mixFunc)centerMix8bRampLoopLIntrp,
- (mixFunc)centerMix8bRampBidiLoopLIntrp,
- (mixFunc)centerMix8bRampNoLoopS16Intrp,
- (mixFunc)centerMix8bRampLoopS16Intrp,
- (mixFunc)centerMix8bRampBidiLoopS16Intrp,
- (mixFunc)centerMix8bRampNoLoopCIntrp,
- (mixFunc)centerMix8bRampLoopCIntrp,
- (mixFunc)centerMix8bRampBidiLoopCIntrp,
-
- // 16-bit
- (mixFunc)centerMix16bRampNoLoop,
- (mixFunc)centerMix16bRampLoop,
- (mixFunc)centerMix16bRampBidiLoop,
- (mixFunc)centerMix16bRampNoLoopS8Intrp,
- (mixFunc)centerMix16bRampLoopS8Intrp,
- (mixFunc)centerMix16bRampBidiLoopS8Intrp,
- (mixFunc)centerMix16bRampNoLoopLIntrp,
- (mixFunc)centerMix16bRampLoopLIntrp,
- (mixFunc)centerMix16bRampBidiLoopLIntrp,
- (mixFunc)centerMix16bRampNoLoopS16Intrp,
- (mixFunc)centerMix16bRampLoopS16Intrp,
- (mixFunc)centerMix16bRampBidiLoopS16Intrp,
- (mixFunc)centerMix16bRampNoLoopCIntrp,
- (mixFunc)centerMix16bRampLoopCIntrp,
- (mixFunc)centerMix16bRampBidiLoopCIntrp
+ (mixFunc)mix16bRampBidiLoopCIntrp
};
--- a/src/mixer/ft2_mix_macros.h
+++ b/src/mixer/ft2_mix_macros.h
@@ -11,24 +11,14 @@
const float fVolumeL = v->fCurrVolumeL; \
const float fVolumeR = v->fCurrVolumeR;
-#define GET_VOL_MONO \
- const float fVolumeL = v->fCurrVolumeL;
-
#define GET_VOL_RAMP \
fVolumeL = v->fCurrVolumeL; \
fVolumeR = v->fCurrVolumeR;
-#define GET_VOL_MONO_RAMP \
- fVolumeL = v->fCurrVolumeL;
-
#define SET_VOL_BACK \
v->fCurrVolumeL = fVolumeL; \
v->fCurrVolumeR = fVolumeR;
-#define SET_VOL_BACK_MONO \
- v->fCurrVolumeL = fVolumeL; \
- v->fCurrVolumeR = fVolumeL;
-
#define GET_MIXER_VARS \
const uintCPUWord_t delta = v->delta; \
fMixBufferL = audio.fMixBufferL + bufferPos; \
@@ -45,14 +35,6 @@
position = v->position; \
positionFrac = v->positionFrac;
-#define GET_MIXER_VARS_MONO_RAMP \
- const uintCPUWord_t delta = v->delta; \
- fMixBufferL = audio.fMixBufferL + bufferPos; \
- fMixBufferR = audio.fMixBufferR + bufferPos; \
- fVolumeLDelta = v->fVolumeLDelta; \
- position = v->position; \
- positionFrac = v->positionFrac;
-
#define PREPARE_TAP_FIX8 \
const int8_t *loopStartPtr = &v->base8[v->loopStart]; \
const int8_t *leftEdgePtr = loopStartPtr+MAX_LEFT_TAPS;
@@ -92,16 +74,13 @@
v->positionFrac = positionFrac; \
v->position = position;
-/* ----------------------------------------------------------------------- */
-/* SAMPLE RENDERING MACROS */
-/* ----------------------------------------------------------------------- */
-
#define VOLUME_RAMPING \
fVolumeL += fVolumeLDelta; \
fVolumeR += fVolumeRDelta;
-#define VOLUME_RAMPING_MONO \
- fVolumeL += fVolumeLDelta;
+/* ----------------------------------------------------------------------- */
+/* NO INTERPOLATION */
+/* ----------------------------------------------------------------------- */
#define RENDER_8BIT_SMP \
fSample = *smpPtr * (1.0f / 128.0f); \
@@ -108,21 +87,11 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO \
- fSample = (*smpPtr * (1.0f / 128.0f)) * fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP \
fSample = *smpPtr * (1.0f / 32768.0f); \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO \
- fSample = (*smpPtr * (1.0f / 32768.0f)) * fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* ----------------------------------------------------------------------- */
/* LINEAR INTERPOLATION */
/* ----------------------------------------------------------------------- */
@@ -143,23 +112,11 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_LINTRP \
- LINEAR_INTERPOLATION(smpPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_LINTRP \
LINEAR_INTERPOLATION(smpPtr, positionFrac, 32768) \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_LINTRP \
- LINEAR_INTERPOLATION(smpPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* ----------------------------------------------------------------------- */
/* CUBIC SPLINE INTERPOLATION */
/* ----------------------------------------------------------------------- */
@@ -171,7 +128,6 @@
** samples are stored according to loop mode (or no loop).
**
** There is also a second special case for the left edge (negative taps) after the sample has looped once.
-**
*/
#if CUBIC_FSHIFT>=0
@@ -199,26 +155,14 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_CINTRP \
- CUBIC_SPLINE_INTERPOLATION(smpPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_CINTRP \
CUBIC_SPLINE_INTERPOLATION(smpPtr, positionFrac, 32768) \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_CINTRP \
- CUBIC_SPLINE_INTERPOLATION(smpPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* Special left-edge case mixers to get proper tap data after one loop cycle.
-** These are only used with cubic interpolation on looped samples.
+** These are only used on looped samples.
*/
#define RENDER_8BIT_SMP_CINTRP_TAP_FIX \
@@ -227,13 +171,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_CINTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int8_t *)&v->leftEdgeTaps8[(int32_t)(smpPtr-loopStartPtr)] : (int8_t *)smpPtr; \
- CUBIC_SPLINE_INTERPOLATION(smpTapPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_CINTRP_TAP_FIX \
smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
CUBIC_SPLINE_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
@@ -240,13 +177,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_CINTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
- CUBIC_SPLINE_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* ----------------------------------------------------------------------- */
/* WINDOWED-SINC INTERPOLATION */
/* ----------------------------------------------------------------------- */
@@ -258,7 +188,6 @@
** samples are stored according to loop mode (or no loop).
**
** There is also a second special case for the left edge (negative taps) after the sample has looped once.
-**
*/
#if SINC8_FSHIFT>=0
@@ -338,47 +267,23 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_S8INTRP \
- WINDOWED_SINC8_INTERPOLATION(smpPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_S8INTRP \
WINDOWED_SINC8_INTERPOLATION(smpPtr, positionFrac, 32768) \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_S8INTRP \
- WINDOWED_SINC8_INTERPOLATION(smpPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_8BIT_SMP_S16INTRP \
WINDOWED_SINC16_INTERPOLATION(smpPtr, positionFrac, 128) \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_S16INTRP \
- WINDOWED_SINC16_INTERPOLATION(smpPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_S16INTRP \
WINDOWED_SINC16_INTERPOLATION(smpPtr, positionFrac, 32768) \
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_S16INTRP \
- WINDOWED_SINC16_INTERPOLATION(smpPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* Special left-edge case mixers to get proper tap data after one loop cycle.
-** These are only used with sinc interpolation on looped samples.
+** These are only used on looped samples.
*/
#define RENDER_8BIT_SMP_S8INTRP_TAP_FIX \
@@ -387,13 +292,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_S8INTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int8_t *)&v->leftEdgeTaps8[(int32_t)(smpPtr-loopStartPtr)] : (int8_t *)smpPtr; \
- WINDOWED_SINC8_INTERPOLATION(smpTapPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_S8INTRP_TAP_FIX \
smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
WINDOWED_SINC8_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
@@ -400,13 +298,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_S8INTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
- WINDOWED_SINC8_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_8BIT_SMP_S16INTRP_TAP_FIX \
smpTapPtr = (smpPtr <= leftEdgePtr) ? (int8_t *)&v->leftEdgeTaps8[(int32_t)(smpPtr-loopStartPtr)] : (int8_t *)smpPtr; \
WINDOWED_SINC16_INTERPOLATION(smpTapPtr, positionFrac, 128) \
@@ -413,13 +304,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_8BIT_SMP_MONO_S16INTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int8_t *)&v->leftEdgeTaps8[(int32_t)(smpPtr-loopStartPtr)] : (int8_t *)smpPtr; \
- WINDOWED_SINC16_INTERPOLATION(smpTapPtr, positionFrac, 128) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
#define RENDER_16BIT_SMP_S16INTRP_TAP_FIX \
smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
WINDOWED_SINC16_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
@@ -426,13 +310,6 @@
*fMixBufferL++ += fSample * fVolumeL; \
*fMixBufferR++ += fSample * fVolumeR;
-#define RENDER_16BIT_SMP_MONO_S16INTRP_TAP_FIX \
- smpTapPtr = (smpPtr <= leftEdgePtr) ? (int16_t *)&v->leftEdgeTaps16[(int32_t)(smpPtr-loopStartPtr)] : (int16_t *)smpPtr; \
- WINDOWED_SINC16_INTERPOLATION(smpTapPtr, positionFrac, 32768) \
- fSample *= fVolumeL; \
- *fMixBufferL++ += fSample; \
- *fMixBufferR++ += fSample;
-
/* ----------------------------------------------------------------------- */
/* SAMPLES-TO-MIX LIMITING MACROS */
/* ----------------------------------------------------------------------- */
@@ -479,24 +356,6 @@
fVolumeLDelta = 0.0f; \
fVolumeRDelta = 0.0f; \
\
- if (v->isFadeOutVoice) \
- { \
- v->active = false; /* volume ramp fadeout-voice is done, shut it down */ \
- return; \
- } \
- } \
- else \
- { \
- if (samplesToMix > v->volumeRampLength) \
- samplesToMix = v->volumeRampLength; \
- \
- v->volumeRampLength -= samplesToMix; \
- }
-
-#define LIMIT_MIX_NUM_MONO_RAMP \
- if (v->volumeRampLength == 0) \
- { \
- fVolumeLDelta = 0.0f; \
if (v->isFadeOutVoice) \
{ \
v->active = false; /* volume ramp fadeout-voice is done, shut it down */ \