annotate jmix_c_in.c @ 49:033c660c25f5

Restructure module playing, removing 8bit sample mixing (output can still be 8bit, but samples are internally upconverted to 16bit after module loading.) Also prepare for floating point mixing support.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Oct 2012 02:51:41 +0300
parents f939d3896937
children 36e2f910219c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * miniJSS - Mixing routines in C
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 //#define JMIXER_DEBUG fprintf(stderr, "[%.8x:%.8x / %.8x]: %d\n", FP_GETH(tmpPos), FP_GETL(tmpPos), endPos, sp[FP_GETH(tmpPos)]);
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #define JMIXER_DEBUG
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 /* Mono / Linear Interpolation
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 */
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
12 #ifdef JSS_MIX_FP
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
13 #define JMIXER_ADDBUF_TYPE float
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
14 #define JMIXER_SAMPLE_TYPE float
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
15 #define JMIXER_INIT const float vol = (float) (chn->chVolume * mixer->globalVol) / (256.0f * 64.0f);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
16 #define JMIXER_FUNC tr = (sp[FP_GETH(tmpPos)] * vol + tr) / 2.0f; *(ap++) += tr;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
17
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
18
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
19 #define JMIXER_NAME jvmMix_Mono_C_FW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
20 #define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
21 #define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
22 #include "jmixtmpl_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
23
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
24
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
25 #define JMIXER_NAME jvmMix_Mono_C_BW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
26 #define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
27 #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
28 #include "jmixtmpl_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
29
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
30 #undef JMIXER_ADDBUF_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
31 #undef JMIXER_SAMPLE_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
32 #undef JMIXER_INIT
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
33 #undef JMIXER_FUNC
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
35 #else
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
36
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
37 #define JMIXER_ADDBUF_TYPE Sint32
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
38 #define JMIXER_SAMPLE_TYPE Sint16
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
39 #define JMIXER_INIT const Sint32 vol = (chn->chVolume * mixer->globalVol) / 256;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
40 #define JMIXER_FUNC tr = (((Sint32) sp[FP_GETH(tmpPos)]) * vol + tr) / (256 * 2); *(ap++) += tr;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
41
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
42 #define JMIXER_NAME jvmMix_Mono_C_FW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
43 #define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
44 #define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
45 #include "jmixtmpl_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
47 #define JMIXER_NAME jvmMix_Mono_C_BW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
48 #define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
49 #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
50 #include "jmixtmpl_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
52 #undef JMIXER_ADDBUF_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
53 #undef JMIXER_SAMPLE_TYPE
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 #undef JMIXER_INIT
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
55 #undef JMIXER_FUNC
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
57 #endif
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 /* Stereo / Linear Interpolation
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 */
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
61 #ifdef JSS_MIX_FP
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
62 #define JMIXER_ADDBUF_TYPE float
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
63 #define JMIXER_SAMPLE_TYPE float
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
64 #define JMIXER_INIT const float vol_l = (chn->chVolume * mixer->globalVol) / (256.0f * 64.0f), \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
65 vol_r = (chn->chVolume * mixer->globalVol) / (256.0f * 64.0f);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
66
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
67 #define JMIXER_FUNC tl = (sp[FP_GETH(tmpPos)] * vol_l + tl) / 2.0f; *(ap++) += tl; \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
68 tr = (sp[FP_GETH(tmpPos)] * vol_r + tr) / 2.0f; *(ap++) += tr;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
69
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
70 #define JMIXER_NAME jvmMix_Stereo_C_FW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
71 #define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
72 #define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
73 #include "jmixtmpl_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
74
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
75 #define JMIXER_NAME jvmMix_Stereo_C_BW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
76 #define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
77 #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
78 #include "jmixtmpl_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
79
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
80 #undef JMIXER_ADDBUF_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
81 #undef JMIXER_SAMPLE_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
82 #undef JMIXER_INIT
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
83 #undef JMIXER_FUNC
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
85 #else
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
86
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
87 #define JMIXER_ADDBUF_TYPE Sint32
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
88 #define JMIXER_SAMPLE_TYPE Sint16
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
89 #define JMIXER_INIT const Sint32 vol_l = (chn->chVolume * mixer->globalVol) / 256, \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
90 vol_r = (chn->chVolume * mixer->globalVol) / 256;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
91
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
92 #define JMIXER_FUNC tl = (((Sint32) sp[FP_GETH(tmpPos)]) * vol_l + tl) / (256 * 2); *(ap++) += tl; \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
93 tr = (((Sint32) sp[FP_GETH(tmpPos)]) * vol_r + tr) / (256 * 2); *(ap++) += tr;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
95 #define JMIXER_NAME jvmMix_Stereo_C_FW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
96 #define JMIXER_NEXT FP_ADD(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
97 #define JMIXER_ENDCOND (FP_GETH(tmpPos) < endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
98 #include "jmixtmpl_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
100 #define JMIXER_NAME jvmMix_Stereo_C_BW
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
101 #define JMIXER_NEXT FP_SUB(tmpPos, tmpDelta);
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
102 #define JMIXER_ENDCOND (FP_GETH(tmpPos) > endPos)
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
103 #include "jmixtmpl_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
104
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
105 #undef JMIXER_ADDBUF_TYPE
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
106 #undef JMIXER_SAMPLE_TYPE
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 #undef JMIXER_INIT
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
108 #undef JMIXER_FUNC
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
110 #endif
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 /* Post processing functions
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 */
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
114 #ifdef JSS_MIX_FP
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
115
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
116 #define JMIXER_ADDBUF_TYPE float
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
117
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
118 #define JMIXER_CLAMP \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
119 if (t < -1.0f) t = -1.0f; else \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
120 if (t > 1.0f) t = 1.0f; \
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
121
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 #define JMIXER_NAME jvmPostProcess_U8_C
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 #define JMIXER_TYPE Uint8
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
124 #define JMIXER_FUNCTION *(sp++) = (t + 1.0f) * 127.0f;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
125 #include "jmix_post_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 #define JMIXER_NAME jvmPostProcess_S8_C
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 #define JMIXER_TYPE Sint8
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
130 #define JMIXER_FUNCTION *(sp++) = t * 127.0f;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
131 #include "jmix_post_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 #define JMIXER_NAME jvmPostProcess_U16_C
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 #define JMIXER_TYPE Uint16
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
136 #define JMIXER_FUNCTION *(sp++) = (t + 1.0f) * 32767.0f;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
137 #include "jmix_post_c.h"
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 #define JMIXER_NAME jvmPostProcess_S16_C
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 #define JMIXER_TYPE Sint16
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
142 #define JMIXER_FUNCTION *(sp++) = t * 32767.0f;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
143 #include "jmix_post_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
144
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
145
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
146 #else
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
147
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
148 #define JMIXER_ADDBUF_TYPE Sint32
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
149
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
150 #define JMIXER_CLAMP \
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 if (t < JVM_LIMIT_16_NEG) t = JVM_LIMIT_16_NEG; else \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 if (t > JVM_LIMIT_16_POS) t = JVM_LIMIT_16_POS; \
49
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
153
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
154 #define JMIXER_NAME jvmPostProcess_U8_C
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
155 #define JMIXER_TYPE Uint8
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
156 #define JMIXER_FUNCTION *(sp++) = (t + JVM_ADD_16) >> 8;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
157 #include "jmix_post_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
158
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
159
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
160 #define JMIXER_NAME jvmPostProcess_S8_C
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
161 #define JMIXER_TYPE Sint8
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
162 #define JMIXER_FUNCTION *(sp++) = t >> 8;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
163 #include "jmix_post_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
164
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
165
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
166 #define JMIXER_NAME jvmPostProcess_U16_C
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
167 #define JMIXER_TYPE Uint16
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
168 #define JMIXER_FUNCTION *(sp++) = t + JVM_ADD_16;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
169 #include "jmix_post_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
170
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
171
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
172 #define JMIXER_NAME jvmPostProcess_S16_C
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
173 #define JMIXER_TYPE Sint16
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
174 #define JMIXER_FUNCTION *(sp++) = t;
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
175 #include "jmix_post_c.h"
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
176
033c660c25f5 Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents: 46
diff changeset
177 #endif