Mercurial > hg > dmlib
annotate jmix_c_in.c @ 51:36e2f910219c
A non-working implementation of floating point audio mixing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 03:48:21 +0300 |
parents | 033c660c25f5 |
children | 8725853609db |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Mixing routines in C | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
4 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP) | |
5 */ | |
6 | |
7 //#define JMIXER_DEBUG fprintf(stderr, "[%.8x:%.8x / %.8x]: %d\n", FP_GETH(tmpPos), FP_GETL(tmpPos), endPos, sp[FP_GETH(tmpPos)]); | |
8 #define JMIXER_DEBUG | |
9 | |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
10 #ifndef JMIXER_ADDBUF_TYPE |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
11 #ifdef JSS_MIX_FP |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
12 #define JMIXER_ADDBUF_TYPE double |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
13 #else |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
14 #define JMIXER_ADDBUF_TYPE Sint32 |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
15 #endif |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
16 #endif |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
17 |
0 | 18 /* Mono / Linear Interpolation |
19 */ | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
20 #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
|
21 #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
|
22 #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
|
23 #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
|
24 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
25 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
26 #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
|
27 #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
|
28 #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
|
29 #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
|
30 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
31 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
32 #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
|
33 #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
|
34 #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
|
35 #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
|
36 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
37 #else |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
38 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
39 #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
|
40 #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
|
41 #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
|
42 #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
|
43 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
44 #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
|
45 #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
|
46 #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
|
47 #include "jmixtmpl_c.h" |
0 | 48 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
49 #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
|
50 #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
|
51 #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
|
52 #include "jmixtmpl_c.h" |
0 | 53 |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
54 #endif |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
55 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
56 #undef JMIXER_SAMPLE_TYPE |
0 | 57 #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
|
58 #undef JMIXER_FUNC |
0 | 59 |
60 /* Stereo / Linear Interpolation | |
61 */ | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
62 #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
|
63 #define JMIXER_SAMPLE_TYPE float |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
64 #define JMIXER_INIT const double vol_l = (chn->chVolume * mixer->globalVol) / 256.0f, \ |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
65 vol_r = (chn->chVolume * mixer->globalVol) / 256.0f; |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
66 |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
67 #define JMIXER_FUNC tl = ((double)sp[FP_GETH(tmpPos)] * vol_l + tl) / (2.0f * 256.0f); *(ap++) += tl; \ |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
68 tr = ((double)sp[FP_GETH(tmpPos)] * vol_r + tr) / (2.0f * 256.0f); *(ap++) += tr; |
49
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 #else |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
81 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
82 #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
|
83 #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
|
84 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
|
85 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
86 #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
|
87 tr = (((Sint32) sp[FP_GETH(tmpPos)]) * vol_r + tr) / (256 * 2); *(ap++) += tr; |
0 | 88 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
89 #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
|
90 #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
|
91 #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
|
92 #include "jmixtmpl_c.h" |
0 | 93 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
94 #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
|
95 #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
|
96 #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
|
97 #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
|
98 |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
99 #endif |
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
100 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
101 #undef JMIXER_SAMPLE_TYPE |
0 | 102 #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
|
103 #undef JMIXER_FUNC |
0 | 104 |
105 | |
106 /* Post processing functions | |
107 */ | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
108 #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
|
109 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
110 #define JMIXER_CLAMP \ |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
111 if (t < -1.0f) t = -1.0f; else \ |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
112 if (t > 1.0f) t = 1.0f; |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
113 |
0 | 114 #define JMIXER_NAME jvmPostProcess_U8_C |
115 #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
|
116 #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
|
117 #include "jmix_post_c.h" |
0 | 118 |
119 | |
120 #define JMIXER_NAME jvmPostProcess_S8_C | |
121 #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
|
122 #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
|
123 #include "jmix_post_c.h" |
0 | 124 |
125 | |
126 #define JMIXER_NAME jvmPostProcess_U16_C | |
127 #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
|
128 #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
|
129 #include "jmix_post_c.h" |
0 | 130 |
131 | |
132 #define JMIXER_NAME jvmPostProcess_S16_C | |
133 #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
|
134 #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
|
135 #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
|
136 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
137 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
138 #else |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
139 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
140 #define JMIXER_CLAMP \ |
0 | 141 if (t < JVM_LIMIT_16_NEG) t = JVM_LIMIT_16_NEG; else \ |
51
36e2f910219c
A non-working implementation of floating point audio mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
142 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
|
143 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
144 #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
|
145 #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
|
146 #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
|
147 #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
|
148 |
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_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
|
151 #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
|
152 #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
|
153 #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
|
154 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
155 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
156 #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
|
157 #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
|
158 #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
|
159 #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
|
160 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
161 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
162 #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
|
163 #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
|
164 #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
|
165 #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
|
166 |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
167 #endif |