Skip to content

Latest commit

 

History

History
557 lines (495 loc) · 11.7 KB

mix.c

File metadata and controls

557 lines (495 loc) · 11.7 KB
 
Oct 21, 1999
Oct 21, 1999
1
/*
Oct 18, 2017
Oct 18, 2017
2
Oct 21, 1999
Oct 21, 1999
3
4
5
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
Dec 31, 2011
Dec 31, 2011
6
7
This program is free software; you can redistribute it and/or modify
it under the terms of the Perl Artistic License, available in COPYING.
Oct 18, 2017
Oct 18, 2017
8
9
10
11
12
13
mix.c */
#if HAVE_CONFIG_H
# include <config.h>
#endif
Oct 21, 1999
Oct 21, 1999
14
15
16
#include <math.h>
#include <stdio.h>
Aug 19, 2001
Aug 19, 2001
17
#include <stdlib.h>
Oct 21, 1999
Oct 21, 1999
18
Oct 18, 2017
Oct 18, 2017
19
20
21
22
#include "SDL.h"
#include "timidity.h"
#include "options.h"
Oct 21, 1999
Oct 21, 1999
23
24
25
26
27
28
29
30
#include "instrum.h"
#include "playmidi.h"
#include "output.h"
#include "tables.h"
#include "resample.h"
#include "mix.h"
/* Returns 1 if envelope runs out */
Oct 18, 2017
Oct 18, 2017
31
int recompute_envelope(MidiSong *song, int v)
Oct 21, 1999
Oct 21, 1999
32
33
34
{
int stage;
Oct 18, 2017
Oct 18, 2017
35
stage = song->voice[v].envelope_stage;
Oct 21, 1999
Oct 21, 1999
36
37
38
39
if (stage>5)
{
/* Envelope ran out. */
Oct 18, 2017
Oct 18, 2017
40
song->voice[v].status = VOICE_FREE;
Oct 21, 1999
Oct 21, 1999
41
42
43
return 1;
}
Oct 18, 2017
Oct 18, 2017
44
if (song->voice[v].sample->modes & MODES_ENVELOPE)
Oct 21, 1999
Oct 21, 1999
45
{
Oct 18, 2017
Oct 18, 2017
46
if (song->voice[v].status==VOICE_ON || song->voice[v].status==VOICE_SUSTAINED)
Oct 21, 1999
Oct 21, 1999
47
48
49
50
{
if (stage>2)
{
/* Freeze envelope until note turns off. Trumpets want this. */
Oct 18, 2017
Oct 18, 2017
51
song->voice[v].envelope_increment=0;
Oct 21, 1999
Oct 21, 1999
52
53
54
55
return 0;
}
}
}
Oct 18, 2017
Oct 18, 2017
56
57
song->voice[v].envelope_stage=stage+1;
Oct 21, 2017
Oct 21, 2017
58
59
60
if (song->voice[v].envelope_volume==song->voice[v].sample->envelope_offset[stage] ||
(stage > 2 && song->voice[v].envelope_volume <
song->voice[v].sample->envelope_offset[stage]))
Oct 18, 2017
Oct 18, 2017
61
62
63
64
65
return recompute_envelope(song, v);
song->voice[v].envelope_target = song->voice[v].sample->envelope_offset[stage];
song->voice[v].envelope_increment = song->voice[v].sample->envelope_rate[stage];
if (song->voice[v].envelope_target < song->voice[v].envelope_volume)
song->voice[v].envelope_increment = -song->voice[v].envelope_increment;
Oct 21, 1999
Oct 21, 1999
66
67
68
return 0;
}
Oct 18, 2017
Oct 18, 2017
69
void apply_envelope_to_amp(MidiSong *song, int v)
Oct 21, 1999
Oct 21, 1999
70
{
Oct 18, 2017
Oct 18, 2017
71
72
73
float lamp = song->voice[v].left_amp, ramp;
Sint32 la,ra;
if (song->voice[v].panned == PANNED_MYSTERY)
Oct 21, 1999
Oct 21, 1999
74
{
Oct 18, 2017
Oct 18, 2017
75
76
ramp = song->voice[v].right_amp;
if (song->voice[v].tremolo_phase_increment)
Oct 21, 1999
Oct 21, 1999
77
{
Oct 18, 2017
Oct 18, 2017
78
79
lamp *= song->voice[v].tremolo_volume;
ramp *= song->voice[v].tremolo_volume;
Oct 21, 1999
Oct 21, 1999
80
}
Oct 18, 2017
Oct 18, 2017
81
if (song->voice[v].sample->modes & MODES_ENVELOPE)
Oct 21, 1999
Oct 21, 1999
82
{
Oct 18, 2017
Oct 18, 2017
83
84
lamp *= (float)vol_table[song->voice[v].envelope_volume>>23];
ramp *= (float)vol_table[song->voice[v].envelope_volume>>23];
Oct 21, 1999
Oct 21, 1999
85
86
}
Oct 18, 2017
Oct 18, 2017
87
88
89
90
91
92
93
94
la = (Sint32)FSCALE(lamp,AMP_BITS);
if (la>MAX_AMP_VALUE)
la=MAX_AMP_VALUE;
ra = (Sint32)FSCALE(ramp,AMP_BITS);
if (ra>MAX_AMP_VALUE)
ra=MAX_AMP_VALUE;
Oct 21, 1999
Oct 21, 1999
95
Oct 18, 2017
Oct 18, 2017
96
97
song->voice[v].left_mix = la;
song->voice[v].right_mix = ra;
Oct 21, 1999
Oct 21, 1999
98
99
100
}
else
{
Oct 18, 2017
Oct 18, 2017
101
102
103
104
if (song->voice[v].tremolo_phase_increment)
lamp *= song->voice[v].tremolo_volume;
if (song->voice[v].sample->modes & MODES_ENVELOPE)
lamp *= (float)vol_table[song->voice[v].envelope_volume>>23];
Oct 21, 1999
Oct 21, 1999
105
Oct 18, 2017
Oct 18, 2017
106
la = (Sint32)FSCALE(lamp,AMP_BITS);
Oct 21, 1999
Oct 21, 1999
107
108
109
110
if (la>MAX_AMP_VALUE)
la=MAX_AMP_VALUE;
Oct 18, 2017
Oct 18, 2017
111
song->voice[v].left_mix = la;
Oct 21, 1999
Oct 21, 1999
112
113
114
}
}
Oct 18, 2017
Oct 18, 2017
115
static int update_envelope(MidiSong *song, int v)
Oct 21, 1999
Oct 21, 1999
116
{
Oct 18, 2017
Oct 18, 2017
117
song->voice[v].envelope_volume += song->voice[v].envelope_increment;
Oct 21, 1999
Oct 21, 1999
118
/* Why is there no ^^ operator?? */
Oct 18, 2017
Oct 18, 2017
119
120
121
122
if (((song->voice[v].envelope_increment < 0) &&
(song->voice[v].envelope_volume <= song->voice[v].envelope_target)) ||
((song->voice[v].envelope_increment > 0) &&
(song->voice[v].envelope_volume >= song->voice[v].envelope_target)))
Oct 21, 1999
Oct 21, 1999
123
{
Oct 18, 2017
Oct 18, 2017
124
125
song->voice[v].envelope_volume = song->voice[v].envelope_target;
if (recompute_envelope(song, v))
Oct 21, 1999
Oct 21, 1999
126
127
128
129
130
return 1;
}
return 0;
}
Oct 18, 2017
Oct 18, 2017
131
static void update_tremolo(MidiSong *song, int v)
Oct 21, 1999
Oct 21, 1999
132
{
Oct 18, 2017
Oct 18, 2017
133
Sint32 depth = song->voice[v].sample->tremolo_depth << 7;
Oct 21, 1999
Oct 21, 1999
134
Oct 18, 2017
Oct 18, 2017
135
if (song->voice[v].tremolo_sweep)
Oct 21, 1999
Oct 21, 1999
136
137
138
{
/* Update sweep position */
Oct 18, 2017
Oct 18, 2017
139
140
141
song->voice[v].tremolo_sweep_position += song->voice[v].tremolo_sweep;
if (song->voice[v].tremolo_sweep_position >= (1 << SWEEP_SHIFT))
song->voice[v].tremolo_sweep=0; /* Swept to max amplitude */
Oct 21, 1999
Oct 21, 1999
142
143
144
else
{
/* Need to adjust depth */
Oct 18, 2017
Oct 18, 2017
145
depth *= song->voice[v].tremolo_sweep_position;
Oct 21, 1999
Oct 21, 1999
146
147
148
149
depth >>= SWEEP_SHIFT;
}
}
Oct 18, 2017
Oct 18, 2017
150
song->voice[v].tremolo_phase += song->voice[v].tremolo_phase_increment;
Oct 21, 1999
Oct 21, 1999
151
Oct 18, 2017
Oct 18, 2017
152
153
/* if (song->voice[v].tremolo_phase >= (SINE_CYCLE_LENGTH<<RATE_SHIFT))
song->voice[v].tremolo_phase -= SINE_CYCLE_LENGTH<<RATE_SHIFT; */
Oct 21, 1999
Oct 21, 1999
154
Oct 18, 2017
Oct 18, 2017
155
156
song->voice[v].tremolo_volume = (float)
(1.0 - FSCALENEG((sine(song->voice[v].tremolo_phase >> RATE_SHIFT) + 1.0)
Oct 21, 1999
Oct 21, 1999
157
* depth * TREMOLO_AMPLITUDE_TUNING,
Feb 1, 2000
Feb 1, 2000
158
17));
Oct 21, 1999
Oct 21, 1999
159
160
161
162
163
164
/* I'm not sure about the +1.0 there -- it makes tremoloed voices'
volumes on average the lower the higher the tremolo amplitude. */
}
/* Returns 1 if the note died */
Oct 18, 2017
Oct 18, 2017
165
static int update_signal(MidiSong *song, int v)
Oct 21, 1999
Oct 21, 1999
166
{
Oct 18, 2017
Oct 18, 2017
167
if (song->voice[v].envelope_increment && update_envelope(song, v))
Oct 21, 1999
Oct 21, 1999
168
169
return 1;
Oct 18, 2017
Oct 18, 2017
170
171
if (song->voice[v].tremolo_phase_increment)
update_tremolo(song, v);
Oct 21, 1999
Oct 21, 1999
172
Oct 18, 2017
Oct 18, 2017
173
apply_envelope_to_amp(song, v);
Oct 21, 1999
Oct 21, 1999
174
175
176
return 0;
}
Oct 18, 2017
Oct 18, 2017
177
#define MIXATION(a) *lp++ += (a)*s;
Aug 21, 2004
Aug 21, 2004
178
Oct 18, 2017
Oct 18, 2017
179
180
static void mix_mystery_signal(MidiSong *song, sample_t *sp, Sint32 *lp, int v,
int count)
Oct 21, 1999
Oct 21, 1999
181
{
Oct 18, 2017
Oct 18, 2017
182
Voice *vp = song->voice + v;
Oct 21, 1999
Oct 21, 1999
183
184
final_volume_t
left=vp->left_mix,
Oct 18, 2017
Oct 18, 2017
185
right=vp->right_mix;
Oct 21, 1999
Oct 21, 1999
186
int cc;
Oct 18, 2017
Oct 18, 2017
187
sample_t s;
Oct 21, 1999
Oct 21, 1999
188
189
190
if (!(cc = vp->control_counter))
{
Oct 18, 2017
Oct 18, 2017
191
192
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
193
return; /* Envelope ran out */
Oct 18, 2017
Oct 18, 2017
194
195
left = vp->left_mix;
right = vp->right_mix;
Oct 21, 1999
Oct 21, 1999
196
197
198
199
200
201
202
203
204
}
while (count)
if (cc < count)
{
count -= cc;
while (cc--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
205
206
MIXATION(left);
MIXATION(right);
Oct 21, 1999
Oct 21, 1999
207
}
Oct 18, 2017
Oct 18, 2017
208
209
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
210
211
212
213
214
215
216
217
218
219
return; /* Envelope ran out */
left = vp->left_mix;
right = vp->right_mix;
}
else
{
vp->control_counter = cc - count;
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
220
221
MIXATION(left);
MIXATION(right);
Oct 21, 1999
Oct 21, 1999
222
223
224
225
226
}
return;
}
}
Oct 18, 2017
Oct 18, 2017
227
228
static void mix_center_signal(MidiSong *song, sample_t *sp, Sint32 *lp, int v,
int count)
Oct 21, 1999
Oct 21, 1999
229
{
Oct 18, 2017
Oct 18, 2017
230
Voice *vp = song->voice + v;
Oct 21, 1999
Oct 21, 1999
231
232
233
final_volume_t
left=vp->left_mix;
int cc;
Oct 18, 2017
Oct 18, 2017
234
sample_t s;
Oct 21, 1999
Oct 21, 1999
235
236
237
if (!(cc = vp->control_counter))
{
Oct 18, 2017
Oct 18, 2017
238
239
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
240
241
242
243
244
245
246
247
248
249
250
return; /* Envelope ran out */
left = vp->left_mix;
}
while (count)
if (cc < count)
{
count -= cc;
while (cc--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
251
252
MIXATION(left);
MIXATION(left);
Oct 21, 1999
Oct 21, 1999
253
}
Oct 18, 2017
Oct 18, 2017
254
255
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
256
257
258
259
260
261
262
263
264
return; /* Envelope ran out */
left = vp->left_mix;
}
else
{
vp->control_counter = cc - count;
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
265
266
MIXATION(left);
MIXATION(left);
Aug 21, 2004
Aug 21, 2004
267
268
269
270
271
}
return;
}
}
Oct 18, 2017
Oct 18, 2017
272
273
static void mix_single_signal(MidiSong *song, sample_t *sp, Sint32 *lp, int v,
int count)
Aug 21, 2004
Aug 21, 2004
274
{
Oct 18, 2017
Oct 18, 2017
275
Voice *vp = song->voice + v;
Aug 21, 2004
Aug 21, 2004
276
277
278
final_volume_t
left=vp->left_mix;
int cc;
Oct 18, 2017
Oct 18, 2017
279
sample_t s;
Aug 21, 2004
Aug 21, 2004
280
281
282
if (!(cc = vp->control_counter))
{
Oct 18, 2017
Oct 18, 2017
283
284
cc = song->control_ratio;
if (update_signal(song, v))
Aug 21, 2004
Aug 21, 2004
285
286
287
288
289
290
291
292
293
294
295
return; /* Envelope ran out */
left = vp->left_mix;
}
while (count)
if (cc < count)
{
count -= cc;
while (cc--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
296
297
MIXATION(left);
lp++;
Aug 21, 2004
Aug 21, 2004
298
}
Oct 18, 2017
Oct 18, 2017
299
300
cc = song->control_ratio;
if (update_signal(song, v))
Aug 21, 2004
Aug 21, 2004
301
302
303
304
305
306
307
308
309
return; /* Envelope ran out */
left = vp->left_mix;
}
else
{
vp->control_counter = cc - count;
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
310
311
MIXATION(left);
lp++;
Oct 21, 1999
Oct 21, 1999
312
313
314
315
316
}
return;
}
}
Oct 18, 2017
Oct 18, 2017
317
318
static void mix_mono_signal(MidiSong *song, sample_t *sp, Sint32 *lp, int v,
int count)
Oct 21, 1999
Oct 21, 1999
319
{
Oct 18, 2017
Oct 18, 2017
320
Voice *vp = song->voice + v;
Oct 21, 1999
Oct 21, 1999
321
322
323
final_volume_t
left=vp->left_mix;
int cc;
Oct 18, 2017
Oct 18, 2017
324
sample_t s;
Oct 21, 1999
Oct 21, 1999
325
326
327
if (!(cc = vp->control_counter))
{
Oct 18, 2017
Oct 18, 2017
328
329
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
330
331
332
333
334
335
336
337
338
339
340
341
342
return; /* Envelope ran out */
left = vp->left_mix;
}
while (count)
if (cc < count)
{
count -= cc;
while (cc--)
{
s = *sp++;
MIXATION(left);
}
Oct 18, 2017
Oct 18, 2017
343
344
cc = song->control_ratio;
if (update_signal(song, v))
Oct 21, 1999
Oct 21, 1999
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
return; /* Envelope ran out */
left = vp->left_mix;
}
else
{
vp->control_counter = cc - count;
while (count--)
{
s = *sp++;
MIXATION(left);
}
return;
}
}
Oct 18, 2017
Oct 18, 2017
360
static void mix_mystery(MidiSong *song, sample_t *sp, Sint32 *lp, int v, int count)
Oct 21, 1999
Oct 21, 1999
361
362
{
final_volume_t
Oct 18, 2017
Oct 18, 2017
363
364
365
left = song->voice[v].left_mix,
right = song->voice[v].right_mix;
sample_t s;
Oct 21, 1999
Oct 21, 1999
366
367
368
369
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
370
371
MIXATION(left);
MIXATION(right);
Oct 21, 1999
Oct 21, 1999
372
373
374
}
}
Oct 18, 2017
Oct 18, 2017
375
static void mix_center(MidiSong *song, sample_t *sp, Sint32 *lp, int v, int count)
Oct 21, 1999
Oct 21, 1999
376
377
{
final_volume_t
Oct 18, 2017
Oct 18, 2017
378
379
left = song->voice[v].left_mix;
sample_t s;
Oct 21, 1999
Oct 21, 1999
380
381
382
383
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
384
385
MIXATION(left);
MIXATION(left);
Oct 21, 1999
Oct 21, 1999
386
387
388
}
}
Oct 18, 2017
Oct 18, 2017
389
static void mix_single(MidiSong *song, sample_t *sp, Sint32 *lp, int v, int count)
Aug 21, 2004
Aug 21, 2004
390
391
{
final_volume_t
Oct 18, 2017
Oct 18, 2017
392
393
left = song->voice[v].left_mix;
sample_t s;
Aug 21, 2004
Aug 21, 2004
394
395
396
397
while (count--)
{
s = *sp++;
Oct 18, 2017
Oct 18, 2017
398
399
MIXATION(left);
lp++;
Oct 21, 1999
Oct 21, 1999
400
401
402
}
}
Oct 18, 2017
Oct 18, 2017
403
static void mix_mono(MidiSong *song, sample_t *sp, Sint32 *lp, int v, int count)
Oct 21, 1999
Oct 21, 1999
404
405
{
final_volume_t
Oct 18, 2017
Oct 18, 2017
406
407
left = song->voice[v].left_mix;
sample_t s;
Oct 21, 1999
Oct 21, 1999
408
409
410
411
412
413
414
415
416
while (count--)
{
s = *sp++;
MIXATION(left);
}
}
/* Ramp a note out in c samples */
Oct 18, 2017
Oct 18, 2017
417
static void ramp_out(MidiSong *song, sample_t *sp, Sint32 *lp, int v, Sint32 c)
Oct 21, 1999
Oct 21, 1999
418
419
{
Oct 18, 2017
Oct 18, 2017
420
421
/* should be final_volume_t, but Uint8 gives trouble. */
Sint32 left, right, li, ri;
Oct 21, 1999
Oct 21, 1999
422
Oct 18, 2017
Oct 18, 2017
423
sample_t s=0; /* silly warning about uninitialized s */
Oct 21, 1999
Oct 21, 1999
424
Oct 18, 2017
Oct 18, 2017
425
426
427
left=song->voice[v].left_mix;
li=-(left/c);
if (!li) li=-1;
Oct 21, 1999
Oct 21, 1999
428
429
430
/* printf("Ramping out: left=%d, c=%d, li=%d\n", left, c, li); */
Oct 18, 2017
Oct 18, 2017
431
if (!(song->encoding & PE_MONO))
Oct 21, 1999
Oct 21, 1999
432
{
Oct 18, 2017
Oct 18, 2017
433
if (song->voice[v].panned==PANNED_MYSTERY)
Oct 21, 1999
Oct 21, 1999
434
{
Oct 18, 2017
Oct 18, 2017
435
right=song->voice[v].right_mix;
Oct 21, 1999
Oct 21, 1999
436
437
438
ri=-(right/c);
while (c--)
{
Oct 18, 2017
Oct 18, 2017
439
440
441
442
443
444
left += li;
if (left<0)
left=0;
right += ri;
if (right<0)
right=0;
Oct 21, 1999
Oct 21, 1999
445
s=*sp++;
Oct 18, 2017
Oct 18, 2017
446
447
MIXATION(left);
MIXATION(right);
Oct 21, 1999
Oct 21, 1999
448
449
}
}
Oct 18, 2017
Oct 18, 2017
450
else if (song->voice[v].panned==PANNED_CENTER)
Oct 21, 1999
Oct 21, 1999
451
452
453
454
455
456
457
{
while (c--)
{
left += li;
if (left<0)
return;
s=*sp++;
Oct 18, 2017
Oct 18, 2017
458
459
MIXATION(left);
MIXATION(left);
Oct 21, 1999
Oct 21, 1999
460
461
}
}
Oct 18, 2017
Oct 18, 2017
462
else if (song->voice[v].panned==PANNED_LEFT)
Oct 21, 1999
Oct 21, 1999
463
464
465
466
467
468
469
470
{
while (c--)
{
left += li;
if (left<0)
return;
s=*sp++;
MIXATION(left);
Oct 18, 2017
Oct 18, 2017
471
lp++;
Oct 21, 1999
Oct 21, 1999
472
473
}
}
Oct 18, 2017
Oct 18, 2017
474
else if (song->voice[v].panned==PANNED_RIGHT)
Oct 21, 1999
Oct 21, 1999
475
476
477
478
479
480
481
{
while (c--)
{
left += li;
if (left<0)
return;
s=*sp++;
Oct 18, 2017
Oct 18, 2017
482
lp++;
Oct 21, 1999
Oct 21, 1999
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
MIXATION(left);
}
}
}
else
{
/* Mono output. */
while (c--)
{
left += li;
if (left<0)
return;
s=*sp++;
MIXATION(left);
}
}
}
/**************** interface function ******************/
Oct 18, 2017
Oct 18, 2017
504
void mix_voice(MidiSong *song, Sint32 *buf, int v, Sint32 c)
Oct 21, 1999
Oct 21, 1999
505
{
Oct 18, 2017
Oct 18, 2017
506
507
Voice *vp = song->voice + v;
sample_t *sp;
Oct 21, 1999
Oct 21, 1999
508
509
if (vp->status==VOICE_DIE)
{
Oct 18, 2017
Oct 18, 2017
510
511
512
if (c>=MAX_DIE_TIME)
c=MAX_DIE_TIME;
sp=resample_voice(song, v, &c);
Oct 21, 2017
Oct 21, 2017
513
514
if(c > 0)
ramp_out(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
515
516
517
518
vp->status=VOICE_FREE;
}
else
{
Oct 18, 2017
Oct 18, 2017
519
520
sp=resample_voice(song, v, &c);
if (song->encoding & PE_MONO)
Oct 21, 1999
Oct 21, 1999
521
522
523
{
/* Mono output. */
if (vp->envelope_increment || vp->tremolo_phase_increment)
Oct 18, 2017
Oct 18, 2017
524
mix_mono_signal(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
525
else
Oct 18, 2017
Oct 18, 2017
526
mix_mono(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
527
528
529
530
531
532
}
else
{
if (vp->panned == PANNED_MYSTERY)
{
if (vp->envelope_increment || vp->tremolo_phase_increment)
Oct 18, 2017
Oct 18, 2017
533
mix_mystery_signal(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
534
else
Oct 18, 2017
Oct 18, 2017
535
mix_mystery(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
536
537
538
539
}
else if (vp->panned == PANNED_CENTER)
{
if (vp->envelope_increment || vp->tremolo_phase_increment)
Oct 18, 2017
Oct 18, 2017
540
mix_center_signal(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
541
else
Oct 18, 2017
Oct 18, 2017
542
mix_center(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
543
544
545
546
547
}
else
{
/* It's either full left or full right. In either case,
every other sample is 0. Just get the offset right: */
Oct 18, 2017
Oct 18, 2017
548
if (vp->panned == PANNED_RIGHT) buf++;
Oct 21, 1999
Oct 21, 1999
549
550
if (vp->envelope_increment || vp->tremolo_phase_increment)
Oct 18, 2017
Oct 18, 2017
551
mix_single_signal(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
552
else
Oct 18, 2017
Oct 18, 2017
553
mix_single(song, sp, buf, v, c);
Oct 21, 1999
Oct 21, 1999
554
555
556
557
}
}
}
}