Mercurial > hg > dmlib
annotate minijss/jmixtmpl_c.h @ 1086:7681f7063500
Constify.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 02 Mar 2015 20:10:36 +0200 |
parents | d7bd9c11229e |
children | e22d4ceb6414 |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Mixing routine in C, innerloop template | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
4 * (C) Copyright 2006-2007 Tecnic Software productions (TNSP) | |
5 */ | |
6 | |
287
1e89cd081956
Use fixed point everywhere in the mixing internals, to avoid going over
Matti Hamalainen <ccr@tnsp.org>
parents:
233
diff
changeset
|
7 int JMIXER_NAME (JSSMixer *mixer, JSSChannel *chn, JMIXER_ADDBUF_TYPE *addBuffer, const int mixLength, const DMFixedPoint endPos) |
0 | 8 #ifdef JMIXER_HEADER |
233 | 9 ; |
0 | 10 #else |
11 { | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
12 const DMFixedPoint tmpDelta = chn->chDeltaO, tmpDeltaV = chn->chDeltaV; |
319 | 13 DMFixedPoint tmpPos = chn->chPos, |
14 tmpVolume = chn->chVolume; | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
15 JMIXER_ADDBUF_TYPE |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
16 *ap = addBuffer, |
57
2edda27f951c
Silly interpolation in mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
17 *tr = chn->chPrevR, |
2edda27f951c
Silly interpolation in mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
18 *tl = chn->chPrevL; |
230 | 19 int strideLength = 0; |
759 | 20 (void) tr; |
21 (void) tl; | |
57
2edda27f951c
Silly interpolation in mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
22 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
23 JMIXER_SAMPLE_TYPE *sp = (JMIXER_SAMPLE_TYPE *) chn->chData; |
0 | 24 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
25 JMIXER_INIT |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
26 |
230 | 27 if (chn->chVolumeD > 0) |
28 { | |
29 const int tmpLength = chn->chVolumeD < mixLength ? chn->chVolumeD : mixLength; | |
30 chn->chVolumeD -= tmpLength; | |
31 | |
32 while (strideLength < tmpLength && JMIXER_ENDCOND) | |
33 { | |
34 JMIXER_FUNC | |
35 JMIXER_DEBUG | |
36 JMIXER_NEXT | |
37 FP_ADD(tmpVolume, tmpDeltaV); | |
38 strideLength++; | |
39 } | |
40 } | |
41 | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
42 while (strideLength < mixLength && JMIXER_ENDCOND) |
0 | 43 { |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
44 JMIXER_FUNC |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
45 JMIXER_DEBUG |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
46 JMIXER_NEXT |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
47 strideLength++; |
0 | 48 } |
49 | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
50 chn->chPos = tmpPos; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
51 chn->chVolume = tmpVolume; |
0 | 52 return strideLength; |
53 } | |
35
fb5200deeda8
Another fix, related to 7908061da010.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
54 #endif |
0 | 55 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
56 #undef JMIXER_NAME |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
57 #undef JMIXER_NEXT |
0 | 58 #undef JMIXER_ENDCOND |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
59 |