Mercurial > hg > dmlib
annotate minijss/jmixtmpl_c.h @ 2298:b5abfff07ca9
Add new DMGrowBuf helper functions dmGrowBufCopyOffsSize() and
dmGrowBufConstCopyOffsSize().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 04 Jul 2019 10:54:16 +0300 |
parents | b52905e2788e |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Mixing routine in C, innerloop template | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
1193 | 4 * (C) Copyright 2006-2015 Tecnic Software productions (TNSP) |
0 | 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 | |
1189 | 36 JMIXER_NEXT_RAMP |
230 | 37 strideLength++; |
38 } | |
39 } | |
1127
e22d4ceb6414
Cosmetics pass, remove excess and trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
759
diff
changeset
|
40 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
41 while (strideLength < mixLength && JMIXER_ENDCOND) |
0 | 42 { |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
43 JMIXER_FUNC |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
44 JMIXER_DEBUG |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
45 JMIXER_NEXT |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
46 strideLength++; |
0 | 47 } |
48 | |
134
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
49 chn->chPos = tmpPos; |
1ba202b448e0
Implement volume and panning ramps (interpolation between callbacks aka "frames")
Matti Hamalainen <ccr@tnsp.org>
parents:
57
diff
changeset
|
50 chn->chVolume = tmpVolume; |
0 | 51 return strideLength; |
52 } | |
35
fb5200deeda8
Another fix, related to 7908061da010.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
53 #endif |
0 | 54 |
49
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
55 #undef JMIXER_NAME |
033c660c25f5
Restructure module playing, removing 8bit sample mixing (output can still be
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
56 #undef JMIXER_NEXT |
1189 | 57 #undef JMIXER_NEXT_RAMP |
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 |