Mercurial > hg > dmlib
diff jmix_c_in.c @ 56:8725853609db
Remove the floating point mixing .. it wasn't so good idea after all.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 06:59:00 +0300 |
parents | 36e2f910219c |
children | 2edda27f951c |
line wrap: on
line diff
--- a/jmix_c_in.c Mon Oct 01 06:28:29 2012 +0300 +++ b/jmix_c_in.c Mon Oct 01 06:59:00 2012 +0300 @@ -7,35 +7,10 @@ //#define JMIXER_DEBUG fprintf(stderr, "[%.8x:%.8x / %.8x]: %d\n", FP_GETH(tmpPos), FP_GETL(tmpPos), endPos, sp[FP_GETH(tmpPos)]); #define JMIXER_DEBUG -#ifndef JMIXER_ADDBUF_TYPE -#ifdef JSS_MIX_FP -#define JMIXER_ADDBUF_TYPE double -#else #define JMIXER_ADDBUF_TYPE Sint32 -#endif -#endif /* Mono / Linear Interpolation */ -#ifdef JSS_MIX_FP -#define JMIXER_SAMPLE_TYPE float -#define JMIXER_INIT const float vol = (float) (chn->chVolume * mixer->globalVol) / (256.0f * 64.0f); -#define JMIXER_FUNC tr = (sp[FP_GETH(tmpPos)] * vol + tr) / 2.0f; *(ap++) += tr; - - -#define JMIXER_NAME jvmMix_Mono_C_FW -#define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta); -#define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos) -#include "jmixtmpl_c.h" - - -#define JMIXER_NAME jvmMix_Mono_C_BW -#define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta); -#define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos) -#include "jmixtmpl_c.h" - -#else - #define JMIXER_ADDBUF_TYPE Sint32 #define JMIXER_SAMPLE_TYPE Sint16 #define JMIXER_INIT const Sint32 vol = (chn->chVolume * mixer->globalVol) / 256; @@ -51,34 +26,13 @@ #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos) #include "jmixtmpl_c.h" -#endif - #undef JMIXER_SAMPLE_TYPE #undef JMIXER_INIT #undef JMIXER_FUNC + /* Stereo / Linear Interpolation */ -#ifdef JSS_MIX_FP -#define JMIXER_SAMPLE_TYPE float -#define JMIXER_INIT const double vol_l = (chn->chVolume * mixer->globalVol) / 256.0f, \ - vol_r = (chn->chVolume * mixer->globalVol) / 256.0f; - -#define JMIXER_FUNC tl = ((double)sp[FP_GETH(tmpPos)] * vol_l + tl) / (2.0f * 256.0f); *(ap++) += tl; \ - tr = ((double)sp[FP_GETH(tmpPos)] * vol_r + tr) / (2.0f * 256.0f); *(ap++) += tr; - -#define JMIXER_NAME jvmMix_Stereo_C_FW -#define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta); -#define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos) -#include "jmixtmpl_c.h" - -#define JMIXER_NAME jvmMix_Stereo_C_BW -#define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta); -#define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos) -#include "jmixtmpl_c.h" - -#else - #define JMIXER_SAMPLE_TYPE Sint16 #define JMIXER_INIT const Sint32 vol_l = (chn->chVolume * mixer->globalVol) / 256, \ vol_r = (chn->chVolume * mixer->globalVol) / 256; @@ -96,8 +50,6 @@ #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos) #include "jmixtmpl_c.h" -#endif - #undef JMIXER_SAMPLE_TYPE #undef JMIXER_INIT #undef JMIXER_FUNC @@ -105,38 +57,6 @@ /* Post processing functions */ -#ifdef JSS_MIX_FP - -#define JMIXER_CLAMP \ - if (t < -1.0f) t = -1.0f; else \ - if (t > 1.0f) t = 1.0f; - -#define JMIXER_NAME jvmPostProcess_U8_C -#define JMIXER_TYPE Uint8 -#define JMIXER_FUNCTION *(sp++) = (t + 1.0f) * 127.0f; -#include "jmix_post_c.h" - - -#define JMIXER_NAME jvmPostProcess_S8_C -#define JMIXER_TYPE Sint8 -#define JMIXER_FUNCTION *(sp++) = t * 127.0f; -#include "jmix_post_c.h" - - -#define JMIXER_NAME jvmPostProcess_U16_C -#define JMIXER_TYPE Uint16 -#define JMIXER_FUNCTION *(sp++) = (t + 1.0f) * 32767.0f; -#include "jmix_post_c.h" - - -#define JMIXER_NAME jvmPostProcess_S16_C -#define JMIXER_TYPE Sint16 -#define JMIXER_FUNCTION *(sp++) = t * 32767.0f; -#include "jmix_post_c.h" - - -#else - #define JMIXER_CLAMP \ if (t < JVM_LIMIT_16_NEG) t = JVM_LIMIT_16_NEG; else \ if (t > JVM_LIMIT_16_POS) t = JVM_LIMIT_16_POS; @@ -163,5 +83,3 @@ #define JMIXER_TYPE Sint16 #define JMIXER_FUNCTION *(sp++) = t; #include "jmix_post_c.h" - -#endif