Mercurial > hg > dmlib
annotate jssplr.c @ 299:26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
column tone portamento and effect column tone portamento on same channel.)
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Oct 2012 17:50:06 +0300 |
parents | 64876c3cbcf3 |
children | 5a003246a735 |
rev | line source |
---|---|
0 | 1 /* |
2 * miniJSS - Module playing routines | |
3 * Programmed and designed by Matti 'ccr' Hamalainen | |
142 | 4 * (C) Copyright 2006-2012 Tecnic Software productions (TNSP) |
0 | 5 */ |
6 #include "jssplr.h" | |
7 | |
8 // FIXME!! FIX ME! | |
9 #include <math.h> | |
10 | |
11 /* Miscellaneous tables | |
12 */ | |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
13 static const Uint8 jmpSineTab[32] = |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
14 { |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
15 0, 24, 49, 74, 97, 120, 141, 161, |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
16 180, 197, 212, 224, 235, 244, 250, 253, |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
17 255, 253, 250, 244, 235, 224, 212, 197, |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
18 180, 161, 141, 120, 97, 74, 49, 24 |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
19 }; |
0 | 20 |
21 | |
22 static const Sint16 jmpXMAmigaPeriodTab[13 * 8] = { | |
23 907, 900, 894, 887, 881, 875, 868, 862, 856, 850, 844, 838, | |
24 832, 826, 820, 814, 808, 802, 796, 791, 785, 779, 774, 768, | |
25 762, 757, 752, 746, 741, 736, 730, 725, 720, 715, 709, 704, | |
26 699, 694, 689, 684, 678, 675, 670, 665, 660, 655, 651, 646, | |
27 640, 636, 632, 628, 623, 619, 614, 610, 604, 601, 597, 592, | |
28 588, 584, 580, 575, 570, 567, 563, 559, 555, 551, 547, 543, | |
29 538, 535, 532, 528, 524, 520, 516, 513, 508, 505, 502, 498, | |
30 494, 491, 487, 484, 480, 477, 474, 470, 467, 463, 460, 457, | |
31 | |
32 453, 450, 447, 443, 440, 437, 434, 431 | |
33 }; | |
34 | |
35 | |
36 #define jmpNMODEffectTable (36) | |
37 static const char jmpMODEffectTable[jmpNMODEffectTable] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
38 | |
39 | |
40 /* Helper functions | |
41 */ | |
136 | 42 static int jmpNoteToAmigaPeriod(int note, int finetune) |
0 | 43 { |
154 | 44 int tmp = dmClamp(note + finetune + 8, 0, 103); |
0 | 45 return jmpXMAmigaPeriodTab[tmp]; |
46 } | |
47 | |
48 | |
49 static int jmpGetPeriodFromNote(JSSPlayer *mp, int note, int finetune) | |
50 { | |
51 int res; | |
52 | |
53 if (JMPGETMODFLAGS(mp, jmdfAmigaPeriods)) | |
54 { | |
55 int mfinetune = finetune / 16, | |
56 mnote = (note % 12) * 8, | |
57 moctave = note / 12, | |
58 period1, period2; | |
59 | |
60 period1 = jmpNoteToAmigaPeriod(mnote, mfinetune); | |
61 | |
62 if (finetune < 0) | |
63 { | |
64 mfinetune--; | |
65 finetune = -finetune; | |
66 } else | |
67 mfinetune++; | |
68 | |
69 period2 = jmpNoteToAmigaPeriod(mnote, mfinetune); | |
70 | |
71 mfinetune = finetune & 15; | |
72 period1 *= (16 - mfinetune); | |
73 period2 *= mfinetune; | |
74 | |
75 res = ((period1 + period2) * 2) >> moctave; | |
76 | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
77 //fprintf(stderr, "jmpGetAmigaPeriod(%d, %d) = %d\n", note, finetune, res); |
0 | 78 } |
79 else | |
80 { | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
81 //fprintf(stderr, "jmpGetLinearPeriod(%d, %d) = %d\n", note, finetune, res); |
0 | 82 //res = ((120 - note) << 6) - (finetune / 2); |
83 res = 7680 - (note * 64) - (finetune / 2); | |
84 if (res < 1) res = 1; | |
85 } | |
86 | |
87 return res; | |
88 } | |
89 | |
90 | |
193
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
91 static void jmpCSetPitch(JSSPlayer *mp, JSSPlayerChannel *chn, int value) |
0 | 92 { |
93 if (value > 0) | |
94 { | |
95 if (JMPGETMODFLAGS(mp, jmdfAmigaPeriods)) | |
96 { | |
97 // Frequency = 8363*1712 / Period | |
193
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
98 chn->cfreq = chn->freq = 14317456 / value; |
0 | 99 } |
100 else | |
101 { | |
102 // Frequency = Frequency = 8363*2^((6*12*16*4 - Period) / (12*16*4)) | |
193
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
103 chn->cfreq = chn->freq = 8363.0f * pow(2.0f, (4608.0f - (double) value) / 768.0f); |
0 | 104 } |
218 | 105 |
106 JMPSETNDFLAGS(cdfNewFreq); | |
0 | 107 } |
108 } | |
109 | |
110 | |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
111 static void jmpCSetVolume(JSSPlayer * mp, JSSPlayerChannel *chn, int channel, int volume, int init) |
0 | 112 { |
113 assert(mp != NULL); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
114 assert(mp->device != NULL); |
0 | 115 |
154 | 116 volume = dmClamp(volume, mpMinVol, mpMaxVol); |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
117 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
118 //fprintf(stderr, "chn %d: vol=%d, fad=%d, env=%d\n", channel, volume, chn->fadeOutVol, chn->volumeEnv.value); |
157 | 119 |
188
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
120 jvmSetVolumeRamp(mp->device, channel, |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
121 init ? 0 : jvmGetVolume(mp->device, channel), |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
122 (chn->fadeOutVol * chn->volumeEnv.value * volume) / (16 * 65536), |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
123 init ? 5 : 0); |
0 | 124 } |
125 | |
126 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
127 static void jmpCSetPanning(JSSPlayer * mp, JSSPlayerChannel *chn, int channel, int panning) |
0 | 128 { |
129 assert(mp != NULL); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
130 assert(mp->device != NULL); |
0 | 131 |
188
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
132 jvmSetPanRamp(mp->device, channel, |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
133 jvmGetPan(mp->device, channel), |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
134 panning + (((chn->panningEnv.value - 32) * (128 - abs(panning - 128))) / 32), |
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
135 0); |
0 | 136 } |
137 | |
138 | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
139 static BOOL jmpExecEnvelope(JSSEnvelope *env, JSSPlayerEnvelope *pe, BOOL keyOff) |
0 | 140 { |
220
b0407a4c0a11
Simplify frame finding in envelope update function.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
141 int point; |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
142 |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
143 if (!pe->exec) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
144 return FALSE; |
0 | 145 |
189 | 146 // Find current point, if not last point |
220
b0407a4c0a11
Simplify frame finding in envelope update function.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
147 for (point = 0; point < env->npoints - 1; point++) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
148 { |
220
b0407a4c0a11
Simplify frame finding in envelope update function.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
149 if (pe->frame < env->points[point + 1].frame) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
150 break; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
151 } |
189 | 152 |
219 | 153 if (env->flags & jenvfLooped && pe->frame >= env->points[env->loopE].frame) |
154 { | |
155 point = env->loopS; | |
156 pe->frame = env->points[env->loopS].frame; | |
157 pe->value = env->points[point].value; | |
158 } | |
159 | |
189 | 160 // Check for last point |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
161 if (pe->frame >= env->points[env->npoints - 1].frame) |
0 | 162 { |
219 | 163 point = env->npoints - 1; |
164 pe->exec = FALSE; | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
165 pe->value = env->points[point].value; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
166 } |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
167 else |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
168 { |
189 | 169 // Linearly interpolate the value between current and next point |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
170 JSSEnvelopePoint |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
171 *ep1 = &env->points[point], |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
172 *ep2 = &env->points[point + 1]; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
173 |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
174 int delta = ep2->frame - ep1->frame; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
175 if (delta > 0) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
176 pe->value = ep1->value + ((ep2->value - ep1->value) * (pe->frame - ep1->frame)) / delta; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
177 else |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
178 pe->value = ep1->value; |
0 | 179 } |
180 | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
181 if (pe->exec) |
0 | 182 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
183 // The frame counter IS processed even if the envelope is not! |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
184 if ((env->flags & jenvfSustain) && point == env->sustain && |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
185 env->points[point].frame == env->points[env->sustain].frame) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
186 { |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
187 if (keyOff) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
188 pe->frame++; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
189 } else |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
190 pe->frame++; |
0 | 191 } |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
192 |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
193 return TRUE; |
0 | 194 } |
195 | |
196 | |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
197 static void jmpProcessExtInstrument(JSSPlayerChannel *chn, int channel) |
0 | 198 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
199 JSSExtInstrument *inst = chn->extInstrument; |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
200 (void) channel; |
0 | 201 |
202 // Get the instrument for envelope data | |
203 if (!inst) return; | |
204 | |
205 // Process the autovibrato | |
206 /* | |
207 FIXME fix me FIX me!!! todo. | |
208 */ | |
209 | |
210 if (inst->volumeEnv.flags & jenvfUsed) | |
211 { | |
169
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
212 // Process the instrument volume fadeout |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
213 if (chn->keyOff && chn->fadeOutVol > 0 && inst->fadeOut > 0) |
169
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
214 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
215 int tmp = chn->fadeOutVol - inst->fadeOut; |
169
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
216 if (tmp < 0) tmp = 0; |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
217 chn->fadeOutVol = tmp; |
169
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
218 |
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
219 JMPSETNDFLAGS(cdfNewVolume); |
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
220 } |
13f27b9882bc
Backed out changeset 21f54947eb18. No, it isn't. :(
Matti Hamalainen <ccr@tnsp.org>
parents:
168
diff
changeset
|
221 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
222 // Execute the volume envelope |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
223 if (jmpExecEnvelope(&inst->volumeEnv, &chn->volumeEnv, chn->keyOff)) |
0 | 224 JMPSETNDFLAGS(cdfNewVolume); |
225 } | |
226 else | |
227 { | |
228 // If the envelope is not used, set max volume | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
229 chn->volumeEnv.value = mpMaxVol; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
230 chn->fadeOutVol = chn->keyOff ? 0 : mpMaxFadeoutVol; |
174
520c18f581c7
Fix handling of fadeouts when volume envelope is not enabled.
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
231 JMPSETNDFLAGS(cdfNewVolume); |
0 | 232 } |
233 | |
234 if (inst->panningEnv.flags & jenvfUsed) | |
235 { | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
236 // Process the panning envelope |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
237 if (jmpExecEnvelope(&inst->panningEnv, &chn->panningEnv, chn->keyOff)) |
0 | 238 JMPSETNDFLAGS(cdfNewPanPos); |
239 } | |
240 else | |
241 { | |
242 // If the envelope is not used, set center panning | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
243 if (chn->panningEnv.value != mpPanCenter) |
0 | 244 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
245 chn->panningEnv.value = mpPanCenter; |
0 | 246 JMPSETNDFLAGS(cdfNewPanPos); |
247 } | |
248 } | |
249 } | |
250 | |
251 | |
252 /* | |
253 * The player | |
254 */ | |
255 JSSPlayer *jmpInit(JSSMixer *pDevice) | |
256 { | |
257 JSSPlayer *mp; | |
258 | |
259 // Allocate a player structure | |
260 mp = dmMalloc0(sizeof(JSSPlayer)); | |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
261 if (mp == NULL) |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
262 JSSERROR(DMERR_MALLOC, NULL, "Could not allocate memory for player structure.\n"); |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
263 |
0 | 264 // Set variables |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
265 mp->device = pDevice; |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
266 |
0 | 267 #ifdef JSS_SUP_THREADS |
268 mp->mutex = dmCreateMutex(); | |
269 #endif | |
270 | |
271 return mp; | |
272 } | |
273 | |
274 | |
275 int jmpClose(JSSPlayer * mp) | |
276 { | |
277 if (mp == NULL) | |
278 return DMERR_NULLPTR; | |
279 | |
280 // Stop player | |
281 jmpStop(mp); | |
282 | |
283 // Deallocate resources | |
284 #ifdef JSS_SUP_THREADS | |
285 dmDestroyMutex(mp->mutex); | |
286 #endif | |
287 | |
288 // Clear structure | |
289 memset(mp, 0, sizeof(JSSPlayer)); | |
290 dmFree(mp); | |
291 | |
292 return DMERR_OK; | |
293 } | |
294 | |
295 | |
296 /* Reset the envelopes for given channel. | |
297 */ | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
298 static void jmpResetEnvelope(JSSPlayerEnvelope *env) |
0 | 299 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
300 env->frame = env->value = 0; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
301 env->exec = TRUE; |
0 | 302 } |
303 | |
304 | |
305 /* Clear module player structure | |
306 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
307 void jmpClearChannel(JSSPlayerChannel *chn) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
308 { |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
309 memset(chn, 0, sizeof(JSSPlayerChannel)); |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
310 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
311 chn->note = jsetNotSet; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
312 chn->ninstrument = jsetNotSet; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
313 chn->nextInstrument = jsetNotSet; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
314 chn->panning = mpPanCenter; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
315 chn->panningEnv.value = mpPanCenter; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
316 } |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
317 |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
318 |
0 | 319 void jmpClearPlayer(JSSPlayer * mp) |
320 { | |
321 int i; | |
322 assert(mp != NULL); | |
323 JSS_LOCK(mp); | |
324 | |
325 // Initialize general variables | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
326 mp->patternDelay = 0; |
170 | 327 mp->newRowSet = FALSE; |
328 mp->newOrderSet = FALSE; | |
329 mp->tick = jsetNotSet; | |
330 mp->row = 0; | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
331 mp->lastPatLoopRow = 0; |
0 | 332 |
333 // Initialize channel data | |
334 for (i = 0; i < jsetNChannels; i++) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
335 jmpClearChannel(&mp->channels[i]); |
0 | 336 |
337 JSS_UNLOCK(mp); | |
338 } | |
339 | |
340 | |
341 /* Set module | |
342 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
343 void jmpSetModule(JSSPlayer * mp, JSSModule * module) |
0 | 344 { |
345 assert(mp != NULL); | |
346 JSS_LOCK(mp); | |
347 | |
348 jmpStop(mp); | |
349 jmpClearPlayer(mp); | |
350 | |
188
47c327fb321a
Another cleanup, remove the "future player" data prediction hack, it is not needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
187
diff
changeset
|
351 mp->module = module; |
0 | 352 |
353 JSS_UNLOCK(mp); | |
354 } | |
355 | |
356 | |
357 /* Stop playing | |
358 */ | |
359 void jmpStop(JSSPlayer * mp) | |
360 { | |
361 assert(mp != NULL); | |
362 JSS_LOCK(mp); | |
363 | |
364 if (mp->isPlaying) | |
365 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
366 jvmRemoveCallback(mp->device); |
0 | 367 mp->isPlaying = FALSE; |
368 } | |
369 | |
370 JSS_UNLOCK(mp); | |
371 } | |
372 | |
373 | |
374 /* Resume playing | |
375 */ | |
376 void jmpResume(JSSPlayer * mp) | |
377 { | |
378 assert(mp != NULL); | |
379 JSS_LOCK(mp); | |
380 | |
381 if (!mp->isPlaying) | |
382 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
383 int result = jvmSetCallback(mp->device, jmpExec, (void *) mp); |
0 | 384 if (result != DMERR_OK) |
385 JSSERROR(result,, "Could not initialize callback for player.\n"); | |
386 | |
387 mp->isPlaying = TRUE; | |
388 } | |
389 | |
390 JSS_UNLOCK(mp); | |
391 } | |
392 | |
393 | |
394 /* Sets new order using given value as reference. | |
395 * Jumps over skip-points and invalid values, loops | |
396 * to first order if enabled. | |
397 */ | |
398 static void jmpSetNewOrder(JSSPlayer * mp, int order) | |
399 { | |
400 BOOL orderOK; | |
401 int pattern; | |
402 | |
403 pattern = jsetOrderEnd; | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
404 mp->order = jsetNotSet; |
0 | 405 orderOK = FALSE; |
406 | |
407 while (!orderOK) | |
408 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
409 if (order < 0 || order >= mp->module->norders) |
0 | 410 { |
411 jmpStop(mp); | |
412 orderOK = TRUE; | |
413 } | |
414 else | |
415 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
416 pattern = mp->module->orderList[order]; |
0 | 417 if (pattern == jsetOrderSkip) |
418 { | |
419 order++; | |
420 } | |
421 else | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
422 if (pattern >= mp->module->npatterns || pattern == jsetOrderEnd) |
0 | 423 { |
424 jmpStop(mp); | |
425 orderOK = TRUE; | |
426 } | |
427 else | |
428 { | |
429 // All OK | |
430 orderOK = TRUE; | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
431 mp->pattern = mp->module->patterns[pattern]; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
432 mp->npattern = pattern; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
433 mp->order = order; |
0 | 434 } |
435 } | |
436 } | |
437 } | |
438 | |
439 | |
440 /* Set new tempo-value of the player. | |
441 */ | |
136 | 442 static void jmpSetTempo(JSSPlayer * mp, int tempo) |
0 | 443 { |
444 assert(mp != NULL); | |
445 JSS_LOCK(mp); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
446 assert(mp->device != NULL); |
0 | 447 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
448 mp->tempo = tempo; |
186
dc22e3f77c9a
Fix tempo (callback frequency) calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
183
diff
changeset
|
449 jvmSetCallbackFreq(mp->device, (mp->device->outFreq * 5) / (tempo * 2)); |
0 | 450 JSS_UNLOCK(mp); |
451 } | |
452 | |
453 | |
136 | 454 static void jmpClearChannels(JSSPlayer * mp) |
0 | 455 { |
456 int i; | |
457 assert(mp != NULL); | |
458 JSS_LOCK(mp); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
459 assert(mp->device != NULL); |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
460 assert(mp->module != NULL); |
0 | 461 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
462 for (i = 0; i < mp->module->nchannels; i++) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
463 jvmStop(mp->device, i); |
0 | 464 |
172
cfb087000db3
Clear player channel data as well in here.
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
465 // Initialize channel data |
cfb087000db3
Clear player channel data as well in here.
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
466 for (i = 0; i < jsetNChannels; i++) |
cfb087000db3
Clear player channel data as well in here.
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
467 jmpClearChannel(&mp->channels[i]); |
cfb087000db3
Clear player channel data as well in here.
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
468 |
0 | 469 JSS_UNLOCK(mp); |
470 } | |
471 | |
472 | |
473 /* Starts playing module from a given ORDER. | |
474 */ | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
475 static int jmpPlayStart(JSSPlayer *mp) |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
476 { |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
477 int result; |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
478 |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
479 mp->speed = mp->module->defSpeed; |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
480 jmpSetTempo(mp, mp->module->defTempo); |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
481 |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
482 result = jvmSetCallback(mp->device, jmpExec, (void *) mp); |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
483 if (result != DMERR_OK) |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
484 { |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
485 JSSERROR(result, result, "Could not initialize callback for player.\n"); |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
486 } |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
487 |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
488 mp->isPlaying = TRUE; |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
489 return DMERR_OK; |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
490 } |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
491 |
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
492 |
182
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
493 int jmpChangeOrder(JSSPlayer *mp, int order) |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
494 { |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
495 assert(mp != NULL); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
496 |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
497 JSS_LOCK(mp); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
498 assert(mp->module != NULL); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
499 |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
500 jmpClearChannels(mp); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
501 jmpClearPlayer(mp); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
502 |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
503 jmpSetNewOrder(mp, order); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
504 if (mp->order == jsetNotSet) |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
505 { |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
506 JSS_UNLOCK(mp); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
507 JSSERROR(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED, |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
508 "Could not start playing from given order #%i\n", order); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
509 } |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
510 |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
511 JSS_UNLOCK(mp); |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
512 return DMERR_OK; |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
513 } |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
514 |
9024d249e47a
Add a new function jmpChangeOrder() to change orderlist position "on fly",
Matti Hamalainen <ccr@tnsp.org>
parents:
181
diff
changeset
|
515 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
516 int jmpPlayOrder(JSSPlayer * mp, int order) |
0 | 517 { |
518 int result; | |
519 assert(mp != NULL); | |
520 | |
521 JSS_LOCK(mp); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
522 assert(mp->module != NULL); |
0 | 523 |
524 // Stop if already playing | |
525 jmpStop(mp); | |
526 jmpClearChannels(mp); | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
527 jmpClearPlayer(mp); |
0 | 528 |
529 // Check starting order | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
530 jmpSetNewOrder(mp, order); |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
531 if (mp->order == jsetNotSet) |
0 | 532 { |
533 JSS_UNLOCK(mp); | |
534 JSSERROR(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED, | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
535 "Could not start playing from given order #%i\n", order); |
0 | 536 } |
537 | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
538 if ((result = jmpPlayStart(mp)) != DMERR_OK) |
0 | 539 { |
540 JSS_UNLOCK(mp); | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
541 return result; |
0 | 542 } |
543 | |
544 JSS_UNLOCK(mp); | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
545 return DMERR_OK; |
0 | 546 } |
547 | |
548 | |
549 /* Play given pattern | |
550 */ | |
551 int jmpPlayPattern(JSSPlayer * mp, int pattern) | |
552 { | |
553 int result; | |
554 assert(mp != NULL); | |
555 JSS_LOCK(mp); | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
556 assert(mp->module != NULL); |
0 | 557 |
558 // Stop if already playing | |
559 jmpStop(mp); | |
560 jmpClearPlayer(mp); | |
561 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
562 mp->npattern = pattern; |
0 | 563 |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
564 if ((result = jmpPlayStart(mp)) != DMERR_OK) |
0 | 565 { |
566 JSS_UNLOCK(mp); | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
567 return result; |
0 | 568 } |
569 | |
570 JSS_UNLOCK(mp); | |
181
879b2488340a
Clean up player logic some more.
Matti Hamalainen <ccr@tnsp.org>
parents:
180
diff
changeset
|
571 return DMERR_OK; |
0 | 572 } |
573 | |
574 | |
575 /* Set volume for given module channel. | |
576 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
577 static void jmpSetVolume(JSSPlayerChannel * chn, int channel, int volume) |
0 | 578 { |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
579 (void) channel; |
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
580 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
581 chn->volume = dmClamp(volume, mpMinVol, mpMaxVol); |
0 | 582 JMPSETNDFLAGS(cdfNewVolume); |
583 } | |
584 | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
585 #define jmpChangeVolume(Q, Z, X) jmpSetVolume(Q, Z, chn->volume + (X)) |
0 | 586 |
587 | |
588 /* Change the pitch of given channel by ADelta. | |
589 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
590 static void jmpChangePitch(JSSPlayerChannel *chn, int channel, int delta) |
0 | 591 { |
592 int value; | |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
593 (void) channel; |
0 | 594 |
595 // Calculate new pitch and check it | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
596 value = chn->pitch + delta; |
0 | 597 if (value < 0) |
598 value = 0; | |
599 | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
600 chn->pitch = value; |
0 | 601 JMPSETNDFLAGS(cdfNewPitch); |
602 } | |
603 | |
604 | |
605 /* Do a note portamento (pitch slide) effect for given module channel. | |
606 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
607 static void jmpDoPortamento(JSSPlayerChannel * chn, int channel) |
0 | 608 { |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
609 (void) channel; |
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
610 |
0 | 611 // Check for zero parameter |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
612 if (chn->iLastPortaToNoteParam == 0) |
0 | 613 { |
614 JMPSETNDFLAGS(cdfNewPitch); | |
615 return; | |
616 } | |
617 | |
618 /* Slide the pitch of channel to the destination value | |
619 * with speed of iLastPortaToNoteParam[] * 4 and stop when it equals. | |
620 */ | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
621 if (chn->pitch < chn->iLastPortaToNotePitch) |
0 | 622 { |
175 | 623 // Increase pitch UP |
624 jmpChangePitch(chn, channel, chn->iLastPortaToNoteParam * 4); | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
625 if (chn->pitch > chn->iLastPortaToNotePitch) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
626 chn->pitch = chn->iLastPortaToNotePitch; |
175 | 627 } |
628 else | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
629 if (chn->pitch > chn->iLastPortaToNotePitch) |
175 | 630 { |
631 // Decrease pitch DOWN | |
632 jmpChangePitch(chn, channel, -(chn->iLastPortaToNoteParam * 4)); | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
633 if (chn->pitch < chn->iLastPortaToNotePitch) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
634 chn->pitch = chn->iLastPortaToNotePitch; |
0 | 635 } |
636 } | |
637 | |
638 | |
639 /* Do a tremolo effect for given module channel. | |
640 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
641 static void jmpDoTremolo(JSSPlayer * mp, JSSPlayerChannel *chn, int channel) |
0 | 642 { |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
643 (void) channel; |
0 | 644 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
645 if (chn->tremolo.depth != 0 && chn->tremolo.speed != 0) |
0 | 646 { |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
647 int delta, tmp = chn->tremolo.pos & 31; |
0 | 648 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
649 switch (chn->tremolo.wc & 3) |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
650 { |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
651 case 0: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
652 delta = jmpSineTab[tmp]; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
653 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
654 case 1: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
655 tmp <<= 3; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
656 delta = (chn->tremolo.pos < 0) ? 255 - tmp : tmp; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
657 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
658 case 2: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
659 delta = 255; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
660 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
661 case 3: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
662 delta = jmpSineTab[tmp]; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
663 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
664 } |
0 | 665 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
666 delta = (delta * chn->tremolo.depth) >> 6; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
667 |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
668 // jmpCSetVolume(mp, chn, channel, chn->volume + (chn->tremolo.pos >= 0 ? ), FALSE); |
0 | 669 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
670 chn->tremolo.pos += chn->tremolo.speed; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
671 if (chn->tremolo.pos > 31) |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
672 chn->tremolo.pos -= 64; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
673 } |
0 | 674 } |
675 | |
676 | |
677 /* Do a vibrato effect for given module channel. | |
678 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
679 static void jmpDoVibrato(JSSPlayer * mp, JSSPlayerChannel *chn, int channel) |
0 | 680 { |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
681 (void) channel; |
0 | 682 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
683 if (chn->vibrato.depth != 0 && chn->vibrato.speed != 0) |
0 | 684 { |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
685 int delta, tmp = chn->vibrato.pos & 31; |
0 | 686 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
687 switch (chn->vibrato.wc & 3) |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
688 { |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
689 case 0: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
690 delta = jmpSineTab[tmp]; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
691 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
692 case 1: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
693 tmp <<= 3; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
694 delta = (chn->vibrato.pos < 0) ? 255 - tmp : tmp; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
695 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
696 case 2: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
697 delta = 255; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
698 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
699 case 3: |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
700 delta = jmpSineTab[tmp]; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
701 break; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
702 } |
0 | 703 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
704 delta = ((delta * chn->vibrato.depth) >> 7) << 2; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
705 chn->freq = chn->cfreq + (chn->vibrato.pos >= 0 ? delta : -delta); |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
706 JMPSETNDFLAGS(cdfNewFreq); |
0 | 707 |
231
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
708 chn->vibrato.pos += chn->vibrato.speed; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
709 if (chn->vibrato.pos > 31) |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
710 chn->vibrato.pos -= 64; |
e65fed571d7a
Improve vibrato implementation. Might not work in Amiga periods mode, tho.
Matti Hamalainen <ccr@tnsp.org>
parents:
228
diff
changeset
|
711 } |
0 | 712 } |
713 | |
714 | |
715 /* Do a volume slide effect for given module channel. | |
716 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
717 static void jmpDoVolumeSlide(JSSPlayerChannel * chn, int channel, int param) |
0 | 718 { |
719 int paramX, paramY; | |
720 | |
721 JMPMAKEPARAM(param, paramX, paramY) | |
722 | |
723 if (paramY == 0) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
724 jmpChangeVolume(chn, channel, paramX); |
0 | 725 if (paramX == 0) |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
726 jmpChangeVolume(chn, channel, -paramY); |
0 | 727 } |
728 | |
225
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
729 static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, BOOL newExtInstrument); |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
730 |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
731 |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
732 static void jmpDoMultiRetrigNote(JSSPlayer *mp, JSSPlayerChannel *chn, int channel) |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
733 { |
226 | 734 if (chn->lastMultiRetrigParamY != 0 && |
735 (mp->tick % chn->lastMultiRetrigParamY) == 0) | |
225
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
736 { |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
737 BOOL change = TRUE; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
738 int volume = chn->volume; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
739 switch (chn->lastMultiRetrigParamX) |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
740 { |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
741 case 0x1: volume -= 1; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
742 case 0x2: volume -= 2; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
743 case 0x3: volume -= 4; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
744 case 0x4: volume -= 8; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
745 case 0x5: volume -= 16; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
746 case 0x6: volume = (volume * 2) / 3; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
747 case 0x7: volume /= 2; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
748 |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
749 case 0x9: volume += 1; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
750 case 0xA: volume += 2; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
751 case 0xB: volume += 4; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
752 case 0xC: volume += 8; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
753 case 0xD: volume += 16; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
754 case 0xE: volume = (volume * 3) / 2; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
755 case 0xF: volume *= 2; break; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
756 default: change = FALSE; |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
757 } |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
758 jmpTriggerNote(mp, chn, FALSE); |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
759 if (change) |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
760 { |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
761 chn->volume = dmClamp(volume, mpMinVol, mpMaxVol); |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
762 JMPSETNDFLAGS(cdfNewVolume); |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
763 } |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
764 } |
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
765 } |
0 | 766 |
767 /* Execute a pattern loop effect/command for given module channel. | |
768 * | |
769 * This routine works for most of the supported formats, as they | |
770 * use the 'standard' implementation ascending from MOD. However, | |
771 * here is included also a slightly kludgy implementation of the | |
772 * FT2 patloop bug. | |
773 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
774 static void jmpDoPatternLoop(JSSPlayer * mp, JSSPlayerChannel *chn, int channel, int paramY) |
0 | 775 { |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
776 (void) channel; |
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
777 |
0 | 778 // Check what we need to do |
779 if (paramY > 0) | |
780 { | |
781 // SBx/E6x loops 'x' times | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
782 if (chn->iPatLoopCount == 1) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
783 chn->iPatLoopCount = 0; |
0 | 784 else |
785 { | |
786 // Check if we need to set the count | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
787 if (chn->iPatLoopCount == 0) |
175 | 788 chn->iPatLoopCount = paramY + 1; |
0 | 789 |
790 // Loop to specified row | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
791 chn->iPatLoopCount--; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
792 mp->newRow = chn->iPatLoopRow; |
0 | 793 mp->newRowSet = TRUE; |
794 } | |
795 } | |
796 else | |
797 { | |
798 // SB0/E60 sets the loop start point | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
799 chn->iPatLoopRow = mp->row; |
0 | 800 |
801 // This is here because of the infamous FT2 patloop bug | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
802 mp->lastPatLoopRow = mp->row; |
0 | 803 } |
804 } | |
805 | |
806 | |
807 /* Do arpeggio effect | |
808 */ | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
809 static void jmpDoArpeggio(JSSPlayer * mp, JSSPlayerChannel *chn, int channel, int paramY, int paramX) |
0 | 810 { |
218 | 811 JSSInstrument *inst = chn->instrument; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
812 |
218 | 813 if (inst != NULL) |
0 | 814 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
815 int tmp = chn->note; |
218 | 816 if (tmp == jsetNotSet || tmp == jsetNoteOff) |
817 return; | |
818 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
819 switch (mp->tick & 3) |
0 | 820 { |
821 case 1: | |
822 tmp += paramX; | |
823 break; | |
824 case 2: | |
825 tmp += paramY; | |
826 break; | |
827 } | |
218 | 828 |
829 tmp = dmClamp(tmp + inst->ERelNote, 0, 119); | |
830 jmpCSetPitch(mp, chn, jmpGetPeriodFromNote(mp, tmp, inst->EFineTune)); | |
0 | 831 } |
832 } | |
833 | |
834 | |
835 /* | |
836 * Process pattern effects | |
837 */ | |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
838 static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, BOOL newExtInstrument) |
0 | 839 { |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
840 if (chn->nextInstrument >= 0 && |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
841 chn->nextInstrument < mp->module->nextInstruments && |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
842 mp->module->extInstruments[chn->nextInstrument] != NULL) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
843 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
844 chn->extInstrument = mp->module->extInstruments[chn->nextInstrument]; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
845 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
846 else |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
847 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
848 chn->extInstrument = NULL; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
849 chn->instrument = NULL; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
850 chn->ninstrument = jsetNotSet; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
851 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
852 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
853 if (chn->extInstrument != NULL) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
854 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
855 int tmp = chn->extInstrument->sNumForNotes[chn->note]; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
856 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
857 if (tmp >= 0 && tmp < mp->module->ninstruments && |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
858 mp->module->instruments[tmp] != NULL) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
859 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
860 if (chn->ninstrument != tmp) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
861 JMPSETNDFLAGS(cdfNewInstr); |
228
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
862 else |
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
863 JMPSETNDFLAGS(cdfPlay); |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
864 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
865 chn->ninstrument = tmp; |
228
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
866 chn->instrument = mp->module->instruments[tmp]; |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
867 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
868 if (newExtInstrument) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
869 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
870 chn->volume = chn->instrument->volume; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
871 chn->panning = chn->instrument->EPanning; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
872 JMPSETNDFLAGS(cdfNewPanPos | cdfNewVolume); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
873 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
874 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
875 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
876 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
877 if (chn->instrument != NULL) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
878 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
879 int tmp; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
880 JSSInstrument *inst = chn->instrument; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
881 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
882 // Save old pitch for later use |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
883 chn->oldPitch = chn->pitch; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
884 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
885 chn->position = 0; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
886 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
887 // Compute new pitch |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
888 tmp = dmClamp(chn->note + inst->ERelNote, 0, 119); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
889 chn->pitch = jmpGetPeriodFromNote(mp, tmp, inst->EFineTune); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
890 JMPSETNDFLAGS(cdfNewPitch | cdfPlay | cdfNewPos); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
891 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
892 else |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
893 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
894 chn->volume = 0; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
895 chn->panning = jchPanMiddle; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
896 JMPSETNDFLAGS(cdfStop | cdfNewPanPos | cdfNewVolume); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
897 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
898 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
899 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
900 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
901 static void jmpProcessNewRow(JSSPlayer * mp, int channel) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
902 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
903 JSSNote *currNote; |
299
26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
904 BOOL newNote = FALSE, newExtInstrument = FALSE, volumePortaSet = FALSE; |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
905 char effect; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
906 int param, paramX, paramY; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
907 JSSPlayerChannel *chn = &(mp->channels[channel]); |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
908 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
909 JMPGETNOTE(currNote, mp->row, channel); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
910 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
911 // Check for a new note/keyoff here |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
912 if (currNote->note == jsetNoteOff) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
913 chn->keyOff = TRUE; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
914 else |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
915 if (currNote->note >= 0 && currNote->note <= 96) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
916 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
917 newNote = TRUE; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
918 chn->oldNote = chn->note; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
919 chn->note = currNote->note; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
920 chn->keyOff = FALSE; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
921 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
922 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
923 // Check for new instrument |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
924 if (currNote->instrument != jsetNotSet) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
925 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
926 /* Envelopes and ext.instrument fadeout are initialized always if |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
927 * new instrument is set, even if the instrument does not exist. |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
928 */ |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
929 jmpResetEnvelope(&chn->volumeEnv); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
930 jmpResetEnvelope(&chn->panningEnv); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
931 chn->keyOff = FALSE; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
932 chn->fadeOutVol = mpMaxFadeoutVol; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
933 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
934 JMPSETNDFLAGS(cdfNewPanPos | cdfPlay | cdfNewVolume); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
935 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
936 // We save the instrument number here for later use |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
937 chn->nextInstrument = currNote->instrument; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
938 newExtInstrument = TRUE; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
939 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
940 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
941 if (newNote) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
942 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
943 jmpTriggerNote(mp, chn, newExtInstrument); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
944 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
945 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
946 // Process the volume column |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
947 JMPMAKEPARAM(currNote->volume, paramX, paramY); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
948 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
949 switch (paramX) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
950 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
951 case 0x0: |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
952 case 0x1: |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
953 case 0x2: |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
954 case 0x3: |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
955 case 0x4: |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
956 jmpSetVolume(chn, channel, currNote->volume); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
957 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
958 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
959 case 0x7: // Dx = Fine Volumeslide Down : IMPL.VERIFIED |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
960 jmpChangeVolume(chn, channel, -paramY); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
961 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
962 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
963 case 0x8: // Ux = Fine Volumeslide Up : IMPL.VERIFIED |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
964 jmpChangeVolume(chn, channel, paramY); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
965 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
966 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
967 case 0x9: // Sx = Set vibrato speed : IMPL.VERIFIED |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
968 chn->vibrato.speed = paramY; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
969 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
970 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
971 case 0xa: // Vx = Vibrato : IMPL.VERIFIED |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
972 if (paramY) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
973 chn->vibrato.depth = paramY; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
974 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
975 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
976 case 0xe: // Mx = Porta To Note : IMPL.VERIFIED |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
977 if (paramY) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
978 chn->iLastPortaToNoteParam = paramY * 16; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
979 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
980 if (currNote->note != jsetNotSet && currNote->note != jsetNoteOff) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
981 { |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
982 chn->lastPortaToNoteNote = chn->note; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
983 chn->iLastPortaToNotePitch = chn->pitch; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
984 chn->pitch = chn->oldPitch; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
985 chn->note = chn->oldNote; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
986 JMPUNSETNDFLAGS(cdfNewPitch | cdfPlay); |
299
26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
987 volumePortaSet = TRUE; |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
988 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
989 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
990 } |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
991 |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
992 // ...And finally process the Normal effects |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
993 if (currNote->effect == jsetNotSet) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
994 return; |
0 | 995 |
996 param = currNote->param; | |
997 JMPMAKEPARAM(param, paramX, paramY); | |
998 JMPGETEFFECT(effect, currNote->effect); | |
999 | |
1000 switch (effect) | |
1001 { | |
1002 case '0': // 0xy = Arpeggio | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1003 jmpDoArpeggio(mp, chn, channel, paramX, paramY); |
0 | 1004 break; |
1005 | |
1006 case 'W': // Used widely in demo-music as MIDAS Sound System sync-command | |
1007 case 'Q': // SoundTracker/OpenCP: Qxx = Set LP filter resonance | |
1008 case 'Z': // SoundTracker/OpenCP: Zxx = Set LP filter cutoff freq | |
1009 break; | |
1010 | |
1011 case '1': | |
1012 case '2': // 1xy = Portamento Up, 2xy = Portamento Down : IMPL.VERIFIED | |
1013 if (param) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1014 chn->iLastPortaParam = param; |
0 | 1015 break; |
1016 | |
1017 case '3': // 3xy = Porta To Note | |
299
26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
1018 if (volumePortaSet) |
26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
1019 break; |
26ead9094940
Implement correct handling of 'M' and '3xx' effects together (aka volume
Matti Hamalainen <ccr@tnsp.org>
parents:
272
diff
changeset
|
1020 |
0 | 1021 if (param) |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1022 chn->iLastPortaToNoteParam = param; |
0 | 1023 |
170 | 1024 if (currNote->note != jsetNotSet && currNote->note != jsetNoteOff) |
1025 { | |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1026 chn->lastPortaToNoteNote = chn->note; |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1027 chn->iLastPortaToNotePitch = chn->pitch; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1028 chn->pitch = chn->oldPitch; |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1029 chn->note = chn->oldNote; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1030 JMPUNSETNDFLAGS(cdfNewPitch | cdfPlay); |
0 | 1031 } |
1032 break; | |
1033 | |
1034 case '4': // 4xy = Vibrato : IMPL.VERIFIED | |
1035 if (paramX) | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1036 chn->vibrato.speed = paramX; |
0 | 1037 |
1038 if (paramY) | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1039 chn->vibrato.depth = paramY; |
0 | 1040 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1041 if ((chn->vibrato.wc & 4) == 0) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1042 chn->vibrato.pos = 0; |
0 | 1043 break; |
1044 | |
1045 case '5': // 5xy = Portamento + Volume Slide | |
1046 case '6': // 6xy = Vibrato + Volume slide | |
1047 if (param) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1048 chn->iLastVolSlideParam = param; |
0 | 1049 break; |
1050 | |
1051 case '7': // 7xy = Tremolo | |
1052 if (paramX) | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1053 chn->tremolo.speed = paramX; |
0 | 1054 |
1055 if (paramY) | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1056 chn->tremolo.depth = paramY; |
0 | 1057 |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1058 if ((chn->tremolo.wc & 4) == 0) |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1059 chn->tremolo.pos = 0; |
0 | 1060 break; |
1061 | |
1062 case '8': // 8xx = Set Panning | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1063 chn->panning = param; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1064 JMPSETNDFLAGS(cdfNewPanPos); |
0 | 1065 break; |
1066 | |
1067 case '9': // 9xx = Set Sample Offset : IMPL.VERIFIED | |
271
6d9a3577741b
XM effect '9xx' stores its last non-zero parameter.
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
1068 if (param != 0) |
6d9a3577741b
XM effect '9xx' stores its last non-zero parameter.
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
1069 chn->lastSampleOffsetParam = param; |
272
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1070 if (chn->newDataFlags & cdfNewPitch && chn->instrument != NULL) |
30 | 1071 { |
272
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1072 int pos = chn->lastSampleOffsetParam * 0x100, |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1073 end = (chn->instrument->flags & jsfLooped) ? |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1074 chn->instrument->loopE : chn->instrument->size; |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1075 if (pos <= end) |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1076 { |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1077 chn->position = pos; |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1078 JMPSETNDFLAGS(cdfNewPos); |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1079 } |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1080 else |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1081 { |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1082 JMPSETNDFLAGS(cdfStop); |
64876c3cbcf3
XM sample offset effect '9xx' stops note playing if offset is > sample
Matti Hamalainen <ccr@tnsp.org>
parents:
271
diff
changeset
|
1083 } |
0 | 1084 } |
1085 break; | |
1086 | |
1087 case 'A': // Axy = Volume Slide : IMPL.VERIFIED | |
1088 if (param) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1089 chn->iLastVolSlideParam = param; |
0 | 1090 break; |
1091 | |
1092 case 'B': // Bxx = Pattern Jump : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1093 mp->newOrder = param; |
0 | 1094 mp->newOrderSet = TRUE; |
1095 mp->jumpFlag = TRUE; | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1096 mp->lastPatLoopRow = 0; |
0 | 1097 break; |
1098 | |
1099 case 'C': // Cxx = Set Volume : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1100 jmpSetVolume(chn, channel, param); |
0 | 1101 break; |
1102 | |
1103 case 'D': // Dxx = Pattern Break : IMPL.VERIFIED | |
1104 // Compute the new row | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1105 mp->newRow = (paramX * 10) + paramY; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1106 if (mp->newRow >= mp->pattern->nrows) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1107 mp->newRow = 0; |
0 | 1108 |
1109 mp->newRowSet = TRUE; | |
1110 | |
1111 // Now we do some tricky tests | |
1112 if (!mp->breakFlag && !mp->jumpFlag) { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1113 mp->newOrder = mp->order + 1; |
0 | 1114 mp->newOrderSet = TRUE; |
1115 } | |
1116 | |
1117 mp->breakFlag = TRUE; | |
1118 break; | |
1119 | |
1120 case 'E': // Exy = Special Effects | |
1121 switch (paramX) { | |
1122 case 0x00: // E0x - Set filter (NOT SUPPORTED) | |
1123 JMPDEBUG("Set Filter used, UNSUPPORTED"); | |
1124 break; | |
1125 | |
1126 case 0x01: // E1x - Fine Portamento Up | |
1127 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1128 chn->iCLastFinePortamentoUpParam = paramY; |
0 | 1129 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1130 jmpChangePitch(chn, channel, -(chn->iCLastFinePortamentoUpParam * 4)); |
0 | 1131 break; |
1132 | |
1133 case 0x02: // E2x - Fine Portamento Down | |
1134 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1135 chn->iCLastFinePortamentoDownParam = paramY; |
0 | 1136 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1137 jmpChangePitch(chn, channel, (chn->iCLastFinePortamentoDownParam * 4)); |
0 | 1138 break; |
1139 | |
1140 case 0x03: // E3x - Glissando Control (NOT SUPPORTED) | |
1141 break; | |
1142 | |
1143 case 0x04: // E4x - Set Vibrato waveform | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1144 chn->vibrato.wc = paramY; |
0 | 1145 break; |
1146 | |
1147 case 0x05: // E5x - Set Finetune | |
1148 JMPDEBUG("Set Finetune used, UNIMPLEMENTED"); | |
1149 break; | |
1150 | |
1151 case 0x06: // E6x - Set Pattern Loop | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1152 jmpDoPatternLoop(mp, chn, channel, paramY); |
0 | 1153 break; |
1154 | |
1155 case 0x07: // E7x - Set Tremolo waveform | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1156 chn->tremolo.wc = paramY; |
0 | 1157 break; |
1158 | |
1159 case 0x08: // E8x - Set Pan Position | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1160 chn->panning = (paramY * 16); |
0 | 1161 JMPSETNDFLAGS(cdfNewPanPos); |
1162 break; | |
1163 | |
224
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1164 case 0x09: // E9x - Retrig note |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1165 if (mp->tick == paramY) |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1166 jmpTriggerNote(mp, chn, FALSE); |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1167 break; |
81f3993412ae
Move jmpProcessRowEffect() into jmpProcessNewRow(); Fix volume-column tone
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
1168 |
0 | 1169 case 0x0a: // EAx - Fine Volumeslide Up |
1170 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1171 chn->iCLastFineVolumeslideUpParam = paramY; |
0 | 1172 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1173 jmpChangeVolume(chn, channel, chn->iCLastFineVolumeslideUpParam); |
0 | 1174 break; |
1175 | |
1176 case 0x0b: // EBx - Fine Volumeslide Down | |
1177 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1178 chn->iCLastFineVolumeslideDownParam = paramY; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1179 jmpChangeVolume(chn, channel, -(chn->iCLastFineVolumeslideDownParam)); |
0 | 1180 break; |
1181 | |
1182 case 0x0c: // ECx - Set Note Cut (NOT PROCESSED IN TICK0) | |
1183 break; | |
1184 | |
1185 case 0x0d: // EDx - Set Note Delay : IMPL.VERIFIED | |
1186 if (paramY > 0) | |
1187 { | |
1188 // Save the ND-flags, then clear | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1189 chn->iSaveNDFlags = chn->newDataFlags; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1190 chn->newDataFlags = 0; |
0 | 1191 // TODO .. does this only affect NOTE or also instrument? |
1192 } | |
1193 break; | |
1194 | |
1195 case 0x0e: // EEx - Set Pattern Delay : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1196 mp->patternDelay = paramY; |
0 | 1197 break; |
1198 | |
1199 case 0x0f: // EFx - Invert Loop (NOT SUPPORTED) | |
1200 JMPDEBUG("Invert Loop used, UNSUPPORTED"); | |
1201 break; | |
1202 | |
1203 default: | |
1204 JMPDEBUG("Unsupported special command used"); | |
1205 } | |
1206 break; | |
1207 | |
1208 case 'F': // Fxy = Set Speed / Tempo : IMPL.VERIFIED | |
1209 if (param > 0) | |
1210 { | |
1211 if (param < 0x20) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1212 mp->speed = param; |
0 | 1213 else |
1214 jmpSetTempo(mp, param); | |
1215 } | |
1216 break; | |
1217 | |
1218 case 'G': // Gxx = Global Volume | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1219 mp->globalVol = param; |
0 | 1220 JMPSETNDFLAGS(cdfNewGlobalVol); |
1221 break; | |
1222 | |
1223 | |
1224 case 'H': // Hxx = Global Volume Slide | |
1225 JMPDEBUG("Global Volume Slide used, UNIMPLEMENTED"); | |
1226 break; | |
1227 | |
1228 case 'K': // Kxx = Key-off (Same as key-off note) | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1229 chn->keyOff = TRUE; |
0 | 1230 break; |
1231 | |
1232 case 'L': // Lxx = Set Envelope Position | |
1233 JMPDEBUG("Set Envelope Position used, NOT verified with FT2"); | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1234 chn->panningEnv.frame = param; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1235 chn->volumeEnv.frame = param; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1236 chn->panningEnv.exec = TRUE; |
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1237 chn->volumeEnv.exec = TRUE; |
0 | 1238 break; |
1239 | |
1240 case 'R': // Rxy = Multi Retrig note | |
223
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1241 if (paramX != 0) |
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1242 chn->lastMultiRetrigParamX = paramX; |
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1243 if (paramY != 0) |
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1244 chn->lastMultiRetrigParamY = paramY; |
0 | 1245 break; |
1246 | |
1247 case 'T': // Txy = Tremor | |
1248 if (param) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1249 chn->iLastTremorParam = param; |
0 | 1250 break; |
1251 | |
1252 case 'X': // Xxy = Extra Fine Portamento | |
1253 switch (paramX) | |
1254 { | |
1255 case 0x01: // X1y - Extra Fine Portamento Up | |
1256 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1257 chn->iCLastExtraFinePortamentoUpParam = paramY; |
0 | 1258 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1259 jmpChangePitch(chn, channel, - chn->iCLastExtraFinePortamentoUpParam); |
0 | 1260 break; |
1261 | |
1262 case 0x02: // X2y - Extra Fine Portamento Down | |
1263 if (paramY) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1264 chn->iCLastExtraFinePortamentoDownParam = paramY; |
0 | 1265 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1266 jmpChangePitch(chn, channel, chn->iCLastExtraFinePortamentoUpParam); |
0 | 1267 break; |
1268 | |
1269 default: | |
1270 JMPDEBUG("Unsupported value in Extra Fine Portamento command!"); | |
1271 break; | |
1272 } | |
1273 break; | |
1274 | |
1275 default: | |
1276 JMPDEBUG("Unsupported effect"); | |
1277 break; | |
1278 } | |
1279 } | |
1280 | |
1281 | |
1282 static void jmpProcessEffects(JSSPlayer * mp, int channel) | |
1283 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1284 JSSPlayerChannel *chn = &(mp->channels[channel]); |
0 | 1285 JSSNote *currNote; |
1286 int param, paramX, paramY, tmp; | |
1287 char effect; | |
1288 | |
1289 // Process the volume column effects | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1290 JMPGETNOTE(currNote, mp->row, channel); |
0 | 1291 JMPMAKEPARAM(currNote->volume, paramX, paramY); |
1292 | |
1293 switch (paramX) | |
1294 { | |
1295 case 0x05: // -x = Volumeslide Down : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1296 jmpChangeVolume(chn, channel, -paramY); |
0 | 1297 break; |
1298 | |
1299 case 0x06: // +x = Volumeslide Down : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1300 jmpChangeVolume(chn, channel, paramY); |
0 | 1301 break; |
1302 | |
1303 case 0x0a: // Vx = Vibrato : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1304 jmpDoVibrato(mp, chn, channel); |
0 | 1305 break; |
1306 | |
1307 case 0x0e: // Mx = Porta To Note : IMPL.VERIFIED | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1308 jmpDoPortamento(chn, channel); |
0 | 1309 break; |
1310 } | |
1311 | |
1312 // ...And finally process the Normal effects | |
1313 if (currNote->effect == jsetNotSet) | |
1314 return; | |
1315 | |
1316 param = currNote->param; | |
1317 JMPMAKEPARAM(param, paramX, paramY); | |
1318 JMPGETEFFECT(effect, currNote->effect); | |
1319 | |
1320 switch (effect) | |
1321 { | |
1322 case '0': // 0xy = Arpeggio | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1323 jmpDoArpeggio(mp, chn, channel, paramX, paramY); |
0 | 1324 break; |
1325 | |
1326 case '1': // 1xy = Portamento Up | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1327 if (chn->iLastPortaParam > 0) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1328 jmpChangePitch(chn, channel, -(chn->iLastPortaParam * 4)); |
0 | 1329 break; |
1330 | |
1331 case '2': // 2xy = Portamento Down | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1332 if (chn->iLastPortaParam > 0) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1333 jmpChangePitch(chn, channel, (chn->iLastPortaParam * 4)); |
0 | 1334 break; |
1335 | |
1336 case '3': // 3xy = Porta To Note | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1337 jmpDoPortamento(chn, channel); |
0 | 1338 break; |
1339 | |
1340 case '4': // 4xy = Vibrato | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1341 jmpDoVibrato(mp, chn, channel); |
0 | 1342 break; |
1343 | |
1344 case '5': // 5xy = Portamento + Volume Slide | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1345 jmpDoPortamento(chn, channel); |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1346 jmpDoVolumeSlide(chn, channel, chn->iLastVolSlideParam); |
0 | 1347 break; |
1348 | |
1349 case '6': // 6xy = Vibrato + Volume Slide | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1350 jmpDoVibrato(mp, chn, channel); |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1351 jmpDoVolumeSlide(chn, channel, chn->iLastVolSlideParam); |
0 | 1352 break; |
1353 | |
1354 case '7': // 7xy = Tremolo | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1355 jmpDoTremolo(mp, chn, channel); |
0 | 1356 break; |
1357 | |
1358 case 'A': // Axy = Volume slide | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1359 jmpDoVolumeSlide(chn, channel, chn->iLastVolSlideParam); |
0 | 1360 break; |
1361 | |
1362 case 'E': // Exy = Special Effects | |
1363 switch (paramX) | |
1364 { | |
222
63be671823d3
Implement effect E9x - Retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
221
diff
changeset
|
1365 case 0x09: // E9x - Retrig note |
63be671823d3
Implement effect E9x - Retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
221
diff
changeset
|
1366 if (mp->tick == paramY) |
63be671823d3
Implement effect E9x - Retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
221
diff
changeset
|
1367 jmpTriggerNote(mp, chn, FALSE); |
63be671823d3
Implement effect E9x - Retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
221
diff
changeset
|
1368 break; |
63be671823d3
Implement effect E9x - Retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
221
diff
changeset
|
1369 |
0 | 1370 case 0x0c: // ECx - Set Note Cut |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1371 if (mp->tick == paramY) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1372 jmpSetVolume(chn, channel, jsetMinVol); |
0 | 1373 break; |
1374 | |
1375 case 0x0d: // EDx - Set Note Delay | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1376 if (mp->tick == paramY) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1377 chn->newDataFlags = chn->iSaveNDFlags; |
0 | 1378 break; |
1379 } | |
1380 break; | |
1381 | |
223
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1382 case 'R': // Rxy = Multi Retrig note |
225
83f942efc55d
Move multi retrig note code to a separate function.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
1383 jmpDoMultiRetrigNote(mp, chn, channel); |
223
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1384 break; |
9fa8e9326d18
Implement effect Rxy - multi retrig note.
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
1385 |
0 | 1386 case 'T': // Txy = Tremor |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1387 JMPMAKEPARAM(chn->iLastTremorParam, paramX, paramY) |
0 | 1388 paramX++; |
1389 paramY++; | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1390 tmp = (chn->iTremorCount % (paramX + paramY)); |
0 | 1391 if (tmp < paramX) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1392 jmpCSetVolume(mp, chn, channel, chn->volume, FALSE); |
0 | 1393 else |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1394 jmpCSetVolume(mp, chn, channel, jsetMinVol, FALSE); |
0 | 1395 |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1396 chn->iTremorCount = (tmp + 1); |
0 | 1397 break; |
1398 } | |
1399 } | |
1400 | |
1401 | |
1402 /* This is the main processing callback-loop of a module player. | |
1403 * It processes the ticks, calling the needed jmpProcessNewRow() | |
1404 * and jmpProcessEffects() methods for processing the module playing. | |
1405 */ | |
1406 void jmpExec(void *pDEV, void *pMP) | |
1407 { | |
1408 JSSPlayer *mp; | |
1409 JSSMixer *dev; | |
146
3226778033fd
Move variable a bit further into the block where it is actually used.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
1410 int channel; |
0 | 1411 |
1412 // Check some things via assert() | |
1413 mp = (JSSPlayer *) pMP; | |
1414 JSS_LOCK(mp); | |
1415 | |
1416 dev = (JSSMixer *) pDEV; | |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1417 |
0 | 1418 // Check if we are playing |
1419 if (!mp->isPlaying) | |
1420 goto out; | |
1421 | |
1422 // Clear channel new data flags | |
1423 mp->jumpFlag = FALSE; | |
1424 mp->breakFlag = FALSE; | |
1425 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1426 for (channel = 0; channel < jsetNChannels; channel++) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1427 mp->channels[channel].newDataFlags = 0; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1428 |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1429 //fprintf(stderr, "1: tick=%d, order=%d, iPattern=%d, row=%d\n", mp->tick, mp->order, mp->npattern, mp->row); |
0 | 1430 |
1431 // Check for init-tick | |
187 | 1432 if (mp->tick == jsetNotSet) |
0 | 1433 { |
1434 // Initialize pattern | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1435 mp->newRow = 0; |
0 | 1436 mp->newRowSet = TRUE; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1437 mp->tick = mp->speed; |
187 | 1438 mp->patternDelay = 0; |
0 | 1439 } |
1440 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1441 //fprintf(stderr, "2: tick=%d, order=%d, iPattern=%d, row=%d\n", mp->tick, mp->order, mp->npattern, mp->row); |
0 | 1442 |
1443 // Check if we are playing | |
1444 if (!mp->isPlaying) | |
1445 goto out; | |
1446 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1447 assert(mp->pattern); |
0 | 1448 |
1449 // Update the tick | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1450 mp->tick++; |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1451 if (mp->tick >= mp->speed) |
0 | 1452 { |
1453 // Re-init tick counter | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1454 mp->tick = 0; |
0 | 1455 |
1456 // Check pattern delay | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1457 if (mp->patternDelay > 0) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1458 mp->patternDelay--; |
0 | 1459 else |
1460 { | |
1461 // New pattern row | |
1462 if (mp->newRowSet) | |
1463 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1464 mp->row = mp->newRow; |
0 | 1465 mp->newRowSet = FALSE; |
1466 } else | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1467 mp->row++; |
0 | 1468 |
1469 // Check for end of pattern | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1470 if (mp->row >= mp->pattern->nrows) |
0 | 1471 { |
1472 // Go to next order | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1473 if (mp->order != jsetNotSet) |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1474 jmpSetNewOrder(mp, mp->order + 1); |
0 | 1475 else |
1476 mp->isPlaying = FALSE; | |
1477 | |
1478 // Check for FT2 quirks | |
1479 if (JMPGETMODFLAGS(mp, jmdfFT2Replay)) | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1480 mp->row = mp->lastPatLoopRow; |
0 | 1481 else |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1482 mp->row = 0; |
0 | 1483 } |
1484 | |
1485 if (!mp->isPlaying) | |
1486 goto out; | |
1487 | |
1488 // Check current order | |
1489 if (mp->newOrderSet) | |
1490 { | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1491 jmpSetNewOrder(mp, mp->newOrder); |
0 | 1492 mp->newOrderSet = FALSE; |
1493 } | |
1494 | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1495 //fprintf(stderr, "3: tick=%d, order=%d, iPattern=%d, row=%d\n", mp->tick, mp->order, mp->npattern, mp->row); |
0 | 1496 |
1497 if (!mp->isPlaying) | |
1498 goto out; | |
1499 | |
1500 // TICK #0: Process new row | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1501 for (channel = 0; channel < mp->module->nchannels; channel++) |
0 | 1502 jmpProcessNewRow(mp, channel); |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1503 } // patternDelay |
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1504 } // tick |
0 | 1505 else |
1506 { | |
1507 // Implement FT2's pattern delay-effect: don't update effects while on patdelay | |
1508 if (!JMPGETMODFLAGS(mp, jmdfFT2Replay) || | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1509 (JMPGETMODFLAGS(mp, jmdfFT2Replay) && mp->patternDelay <= 0)) |
0 | 1510 { |
1511 // TICK n: Process the effects | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1512 for (channel = 0; channel < mp->module->nchannels; channel++) |
0 | 1513 jmpProcessEffects(mp, channel); |
1514 } | |
1515 } | |
1516 | |
1517 // Check if playing has stopped | |
1518 if (!mp->isPlaying) | |
1519 goto out; | |
1520 | |
1521 // Update player data to audio device/mixer | |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1522 for (channel = 0; channel < mp->module->nchannels; channel++) |
0 | 1523 { |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1524 JSSPlayerChannel *chn = &mp->channels[channel]; |
146
3226778033fd
Move variable a bit further into the block where it is actually used.
Matti Hamalainen <ccr@tnsp.org>
parents:
145
diff
changeset
|
1525 int flags; |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1526 |
0 | 1527 // Process extended instruments |
61
a33e47232161
Silence some "unused parameter" warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
55
diff
changeset
|
1528 jmpProcessExtInstrument(chn, channel); |
0 | 1529 |
1530 // Check NDFlags and update channel data | |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1531 flags = chn->newDataFlags; |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1532 if (!flags) |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1533 continue; |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1534 |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1535 // Check if we stop? |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1536 if (flags & cdfStop) |
0 | 1537 { |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1538 jvmStop(mp->device, channel); |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1539 } |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1540 else |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1541 { |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1542 // No, handle other flags |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1543 if (flags & cdfNewInstr) |
55
e0e470c3fc8e
Initial round of cleaning up the player code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
1544 { |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1545 JSSInstrument *instr = chn->instrument; |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1546 if (instr != NULL) |
0 | 1547 { |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1548 jvmSetSample(mp->device, channel, |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1549 instr->data, instr->size, |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1550 instr->loopS, instr->loopE, |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1551 instr->flags); |
0 | 1552 } |
180
bc8019c38ba5
Refactoring of the note triggering and other player logic, fixes various
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
1553 } |
bc8019c38ba5
Refactoring of the note triggering and other player logic, fixes various
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
1554 |
bc8019c38ba5
Refactoring of the note triggering and other player logic, fixes various
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
1555 if (flags & cdfPlay) |
228
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
1556 { |
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
1557 jvmReset(mp->device, channel); |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1558 jvmPlay(mp->device, channel); |
228
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
1559 } |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1560 |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1561 if (flags & cdfNewPitch) |
193
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
1562 jmpCSetPitch(mp, chn, chn->pitch); |
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
1563 |
218 | 1564 if (flags & (cdfNewFreq | cdfNewPitch)) |
193
b778cc2fe7c8
Create a separate new frequency flag (vs. new pitch), for future changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
189
diff
changeset
|
1565 jvmSetFreq(mp->device, channel, chn->freq); |
0 | 1566 |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1567 if (flags & cdfNewPos) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1568 jvmSetPos(mp->device, channel, chn->position); |
0 | 1569 |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1570 if (flags & cdfNewVolume) |
228
4d979914e837
Use jvmReset appropriately, fixes(?) taotao.xm vs. boost.xm vs. vital.xm issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
226
diff
changeset
|
1571 jmpCSetVolume(mp, chn, channel, chn->volume, flags & cdfNewInstr); |
0 | 1572 |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1573 if (flags & cdfNewPanPos) |
183
a65f0c3deaa7
Some more player logic cleanups and variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
182
diff
changeset
|
1574 jmpCSetPanning(mp, chn, channel, chn->panning); |
0 | 1575 |
144
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1576 if (flags & cdfNewGlobalVol) |
22e1be63f6af
Various improvements in XM replay: implement the 5ms volume fadein and
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
1577 jvmSetGlobalVol(mp->device, mp->globalVol); |
0 | 1578 } |
1579 } | |
1580 | |
1581 out: | |
1582 JSS_UNLOCK(mp); | |
1583 } |