Mercurial > hg > dmlib
annotate jmixtmpl_c.h @ 570:a26636faa6b7
Update copyright.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 05 Jan 2013 19:58:23 +0200 |
parents | 37382bee0619 |
children |
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; |
57
2edda27f951c
Silly interpolation in mixing.
Matti Hamalainen <ccr@tnsp.org>
parents:
51
diff
changeset
|
20 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
21 JMIXER_SAMPLE_TYPE *sp = (JMIXER_SAMPLE_TYPE *) chn->chData; |
0 | 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_INIT |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
24 |
230 | 25 if (chn->chVolumeD > 0) |
26 { | |
27 const int tmpLength = chn->chVolumeD < mixLength ? chn->chVolumeD : mixLength; | |
28 chn->chVolumeD -= tmpLength; | |
29 | |
30 while (strideLength < tmpLength && JMIXER_ENDCOND) | |
31 { | |
32 JMIXER_FUNC | |
33 JMIXER_DEBUG | |
34 JMIXER_NEXT | |
35 FP_ADD(tmpVolume, tmpDeltaV); | |
36 strideLength++; | |
37 } | |
38 } | |
39 | |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
40 while (strideLength < mixLength && JMIXER_ENDCOND) |
0 | 41 { |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
42 JMIXER_FUNC |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
43 JMIXER_DEBUG |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
44 JMIXER_NEXT |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
45 strideLength++; |
0 | 46 } |
47 | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
48 chn->chPos = tmpPos; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
49 chn->chVolume = tmpVolume; |
0 | 50 return strideLength; |
51 } | |
35
fb5200deeda8
Another fix, related to 7908061da010.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
52 #endif |
0 | 53 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
54 #undef JMIXER_NAME |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
55 #undef JMIXER_NEXT |
0 | 56 #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
|
57 |