Mercurial > hg > dmlib
diff jssmod.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 | a17e54015bd9 |
line wrap: on
line diff
--- a/jssmod.c Mon Oct 01 06:28:29 2012 +0300 +++ b/jssmod.c Mon Oct 01 06:59:00 2012 +0300 @@ -197,39 +197,6 @@ return TRUE; } -#ifdef JSS_MIX_FP -/* Convert sample data from S16 or U8 to floating point - */ -int jssConvertSampleToFP(void **dst, void * src, const size_t len, const int flags) -{ - size_t count = len; - float *out; - - *dst = out = dmMalloc(sizeof(float) * len); - if (out == NULL) - return DMERR_MALLOC; - - if (flags & jsf16bit) - { - Sint16 *in = (Sint16 *) src; - while (count--) - { - *(out++) = (float) (*(in++)) / 32768.0f; - } - } - else - { - Uint8 *in = (Uint8 *) src; - while (count--) - { - *(out++) = ((float) *(in++) - 128.0f) / 56.0f; - } - } - - return DMERR_OK; -} - -#endif /* Convert sample data from U8 to S16 */ @@ -252,8 +219,7 @@ } /* Converts the given module in preparation for playing it. - * This involves sample format conversion (8 to 16 bit, or - * if floating point mixing is enabled, 8/16 bit to FP.) + * This involves sample format conversion (8 to 16 bit, etc.) * * NOTICE! The converted module can only be saved in JSSMOD * format, but this is not recommended. @@ -272,16 +238,7 @@ { int res; void *data = NULL; -#ifdef JSS_MIX_FP - if (inst->flags & jsfFP) - continue; - if ((res = jssConvertSampleToFP(&data, inst->data, inst->size, inst->flags)) != DMERR_OK) - return res; - - inst->flags &= !(jsf16bit); - inst->flags |= jsfFP; -#else if (inst->flags & jsf16bit) continue; @@ -289,7 +246,6 @@ return res; inst->flags |= jsf16bit; -#endif dmFree(inst->data); inst->data = data; }