/[svn]/linuxsampler/trunk/src/engines/sfz/SfzSignalUnitRack.cpp
ViewVC logotype

Contents of /linuxsampler/trunk/src/engines/sfz/SfzSignalUnitRack.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2232 - (show annotations) (download)
Mon Aug 8 13:40:04 2011 UTC (6 years, 11 months ago) by iliev
File size: 22122 byte(s)
* sfz engine: implemented opcode volume_smoothccN

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2011 Grigor Iliev *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #include "SfzSignalUnitRack.h"
24 #include "Voice.h"
25 #include <SF.h>
26
27 namespace LinuxSampler { namespace sfz {
28
29 SfzSignalUnit::SfzSignalUnit(SfzSignalUnitRack* rack): SignalUnit(rack), pVoice(rack->pVoice) {
30
31 }
32
33 double SfzSignalUnit::GetSampleRate() {
34 return pVoice->GetSampleRate() / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;
35 }
36
37 float SfzSignalUnit::GetInfluence(ArrayList< ::sfz::CC>& cc) {
38 float f = 0;
39 for (int i = 0; i < cc.size(); i++) {
40 int val = pVoice->GetControllerValue(cc[i].Controller);
41 f += (val / 127.0f) * cc[i].Influence;
42 }
43 return f;
44 }
45
46
47 void EGv2Unit::Trigger() {
48 egInfo = *pEGInfo;
49 for (int i = 0; i < egInfo.node.size(); i++) {
50 float f = GetInfluence(egInfo.node[i].level_oncc);
51 egInfo.node[i].level = std::min(egInfo.node[i].level + f, 1.0f);
52
53 f = GetInfluence(egInfo.node[i].time_oncc);
54 egInfo.node[i].time = std::min(egInfo.node[i].time + f, 100.0f);
55 }
56 EG.trigger(egInfo, GetSampleRate(), pVoice->MIDIVelocity);
57 }
58
59
60 void PitchEGUnit::Trigger() {
61 ::sfz::Region* const pRegion = pVoice->pRegion;
62 depth = pRegion->pitcheg_depth;
63
64 // the length of the decay and release curves are dependent on the velocity
65 const double velrelease = 1 / pVoice->GetVelocityRelease(pVoice->MIDIVelocity);
66
67 // set the delay trigger
68 uiDelayTrigger = (pRegion->pitcheg_delay + pRegion->pitcheg_vel2delay * velrelease) * GetSampleRate();
69
70 EG.trigger(uint(pRegion->pitcheg_start * 10),
71 std::max(0.0, pRegion->pitcheg_attack + pRegion->pitcheg_vel2attack * velrelease),
72 std::max(0.0, pRegion->pitcheg_hold + pRegion->pitcheg_vel2hold * velrelease),
73 std::max(0.0, pRegion->pitcheg_decay + pRegion->pitcheg_vel2decay * velrelease),
74 uint(std::min(std::max(0.0, 10 * (pRegion->pitcheg_sustain + pRegion->pitcheg_vel2sustain * velrelease)), 1000.0)),
75 std::max(0.0, pRegion->pitcheg_release + pRegion->pitcheg_vel2release * velrelease),
76 GetSampleRate());
77 }
78
79
80 void FilEGUnit::Trigger() {
81 ::sfz::Region* const pRegion = pVoice->pRegion;
82 depth = pRegion->fileg_depth;
83
84 // the length of the decay and release curves are dependent on the velocity
85 const double velrelease = 1 / pVoice->GetVelocityRelease(pVoice->MIDIVelocity);
86
87 // set the delay trigger
88 uiDelayTrigger = (pRegion->fileg_delay + pRegion->fileg_vel2delay * velrelease) * GetSampleRate();
89
90 EG.trigger(uint(pRegion->fileg_start * 10),
91 std::max(0.0, pRegion->fileg_attack + pRegion->fileg_vel2attack * velrelease),
92 std::max(0.0, pRegion->fileg_hold + pRegion->fileg_vel2hold * velrelease),
93 std::max(0.0, pRegion->fileg_decay + pRegion->fileg_vel2decay * velrelease),
94 uint(std::min(std::max(0.0, 10 * (pRegion->fileg_sustain + pRegion->fileg_vel2sustain * velrelease)), 1000.0)),
95 std::max(0.0, pRegion->fileg_release + pRegion->fileg_vel2release * velrelease),
96 GetSampleRate());
97 }
98
99
100 void AmpEGUnit::Trigger() {
101 ::sfz::Region* const pRegion = pVoice->pRegion;
102
103 // the length of the decay and release curves are dependent on the velocity
104 const double velrelease = 1 / pVoice->GetVelocityRelease(pVoice->MIDIVelocity);
105
106 // set the delay trigger
107 float delay = pRegion->ampeg_delay + pRegion->ampeg_vel2delay * velrelease;
108 delay += GetInfluence(pRegion->ampeg_delaycc);
109 uiDelayTrigger = std::max(0.0f, delay) * GetSampleRate();
110
111 float start = (pRegion->ampeg_start + GetInfluence(pRegion->ampeg_startcc)) * 10;
112
113 float attack = pRegion->ampeg_attack + pRegion->ampeg_vel2attack * velrelease;
114 attack = std::max(0.0f, attack + GetInfluence(pRegion->ampeg_attackcc));
115
116 float hold = pRegion->ampeg_hold + pRegion->ampeg_vel2hold * velrelease;
117 hold = std::max(0.0f, hold + GetInfluence(pRegion->ampeg_holdcc));
118
119 float decay = pRegion->ampeg_decay + pRegion->ampeg_vel2decay * velrelease;
120 decay = std::max(0.0f, decay + GetInfluence(pRegion->ampeg_decaycc));
121
122 float sustain = pRegion->ampeg_sustain + pRegion->ampeg_vel2sustain * velrelease;
123 sustain = 10 * (sustain + GetInfluence(pRegion->ampeg_sustaincc));
124
125 float release = pRegion->ampeg_release + pRegion->ampeg_vel2release * velrelease;
126 release = std::max(0.0f, release + GetInfluence(pRegion->ampeg_releasecc));
127
128 EG.trigger (
129 uint(std::min(std::max(0.0f, start), 1000.0f)), attack, hold, decay,
130 uint(std::min(std::max(0.0f, sustain), 1000.0f)), release, GetSampleRate()
131 );
132 }
133
134
135 LFOUnit::LFOUnit(SfzSignalUnitRack* rack)
136 : SfzSignalUnit(rack), pLfoInfo(NULL), pLFO(NULL),
137 suFadeEG(rack), suFreqOnCC(rack, this)
138 { }
139
140 LFOUnit::LFOUnit(const LFOUnit& Unit)
141 : SfzSignalUnit(Unit), suFadeEG(static_cast<SfzSignalUnitRack*>(Unit.pRack)),
142 suFreqOnCC(static_cast<SfzSignalUnitRack*>(Unit.pRack), this)
143 {
144 Copy(Unit);
145 }
146
147 void LFOUnit::Increment() {
148 if (DelayStage()) return;
149
150 SignalUnit::Increment();
151
152 Level = pLFO->Render();
153 if (suFadeEG.Active()) Level *= suFadeEG.GetLevel();
154 }
155
156 void LFOUnit::Trigger() {
157 //reset
158 Level = 0;
159
160 // set the delay trigger
161 uiDelayTrigger = pLfoInfo->delay * GetSampleRate();
162 if(pLfoInfo->fade != 0 || !pLfoInfo->fade_oncc.empty()) {
163 float f = pLfoInfo->fade;
164 f += GetInfluence(pLfoInfo->fade_oncc);
165
166 if (f != 0) {
167 suFadeEG.uiDelayTrigger = pLfoInfo->delay * GetSampleRate();
168 suFadeEG.EG.trigger(0, f, 0, 0, 1000, 0, GetSampleRate());
169 }
170 }
171 }
172
173 void LFOUnit::ValueChanged(CCSignalUnit* pUnit) {
174 pLFO->SetFrequency(std::max(0.0f, suFreqOnCC.GetLevel() + pLfoInfo->freq), GetSampleRate());
175 }
176
177
178 void LFOv1Unit::Trigger() {
179 LFOUnit::Trigger();
180
181 lfo.trigger (
182 pLfoInfo->freq + suFreqOnCC.GetLevel(),
183 start_level_mid,
184 1, 0, false, GetSampleRate()
185 );
186 lfo.update(0);
187 }
188
189
190 LFOv2Unit::LFOv2Unit(SfzSignalUnitRack* rack)
191 : LFOUnit(rack), lfos(8), lfo0(1200.0f), lfo1(1200.0f), lfo2(1200.0f),
192 lfo3(1200.0f), lfo4(1200.0f), lfo5(1200.0f), lfo6(1200.0f), lfo7(1200.0f),
193 suPitchOnCC(rack)
194 {
195 lfos.add(&lfo0);
196 lfos.add(&lfo1);
197 lfos.add(&lfo2);
198 lfos.add(&lfo3);
199 lfos.add(&lfo4);
200 lfos.add(&lfo5);
201 lfos.add(&lfo6);
202 lfos.add(&lfo7);
203 }
204
205 void LFOv2Unit::Trigger() {
206 LFOUnit::Trigger();
207
208 if (pLfoInfo->wave < 0 || pLfoInfo->wave >= lfos.size()) pLFO = &lfo0;
209 else pLFO = lfos[pLfoInfo->wave];
210
211 pLFO->Trigger (
212 pLfoInfo->freq + suFreqOnCC.GetLevel(),
213 start_level_mid,
214 1, 0, false, GetSampleRate()
215 );
216 pLFO->Update(0);
217
218 float phase = pLfoInfo->phase + GetInfluence(pLfoInfo->phase_oncc);
219 if (phase != 0) pLFO->SetPhase(phase);
220 }
221
222 void AmpLFOUnit::Trigger() {
223 ::sfz::Region* const pRegion = pVoice->pRegion;
224 pLfoInfo->delay = pRegion->amplfo_delay;
225 pLfoInfo->freq = pRegion->amplfo_freq;
226 pLfoInfo->fade = pRegion->amplfo_fade;
227 pLfoInfo->volume = pRegion->amplfo_depth;
228
229 LFOv1Unit::Trigger();
230 }
231
232 void PitchLFOUnit::Trigger() {
233 ::sfz::Region* const pRegion = pVoice->pRegion;
234 pLfoInfo->delay = pRegion->pitchlfo_delay;
235 pLfoInfo->freq = pRegion->pitchlfo_freq;
236 pLfoInfo->fade = pRegion->pitchlfo_fade;
237 pLfoInfo->pitch = pRegion->pitchlfo_depth;
238
239 LFOv1Unit::Trigger();
240 }
241
242 void FilLFOUnit::Trigger() {
243 ::sfz::Region* const pRegion = pVoice->pRegion;
244 pLfoInfo->delay = pRegion->fillfo_delay;
245 pLfoInfo->freq = pRegion->fillfo_freq;
246 pLfoInfo->fade = pRegion->fillfo_fade;
247 pLfoInfo->cutoff = pRegion->fillfo_depth;
248
249 LFOv1Unit::Trigger();
250 }
251
252 CCUnit::CCUnit(SfzSignalUnitRack* rack, Listener* l): CCSignalUnit(rack, l) {
253 pVoice = NULL;
254 }
255
256 void CCUnit::Trigger() {
257 for (int i = 0; i < Ctrls.size(); i++) {
258 Ctrls[i].Value = pVoice->GetControllerValue(Ctrls[i].Controller);
259 if (Ctrls[i].pSmoother != NULL) Ctrls[i].pSmoother->setValue(Ctrls[i].Value);
260 }
261 CCSignalUnit::Trigger();
262 }
263
264 void CCUnit::SetCCs(::sfz::Array<int>& cc) {
265 RemoveAllCCs();
266 for (int i = 0; i < 128; i++) {
267 if (cc[i] != 0) AddCC(i, cc[i]);
268 }
269 }
270
271 void CCUnit::SetCCs(ArrayList< ::sfz::CC>& cc) {
272 RemoveAllCCs();
273 for (int i = 0; i < cc.size(); i++) {
274 if (cc[i].Influence != 0) {
275 short int curve = cc[i].Curve;
276 if (curve >= GetCurveCount()) curve = -1;
277 AddSmoothCC(cc[i].Controller, cc[i].Influence, curve, cc[i].Smooth);
278 }
279 }
280 }
281
282 void CCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) {
283 AddCC(Controller, Influence, Curve);
284 }
285
286 int CCUnit::GetCurveCount() {
287 return pVoice->pRegion->GetInstrument()->curves.size();
288 }
289
290 ::sfz::Curve* CCUnit::GetCurve(int idx) {
291 return &pVoice->pRegion->GetInstrument()->curves[idx];
292 }
293
294 double CCUnit::GetSampleRate() {
295 return pVoice->GetSampleRate() / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;
296 }
297
298 void SmoothCCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) {
299 if (Smooth > 0) {
300 Smoothers[Controller].trigger(Smooth / 1000.0f, GetSampleRate());
301 AddCC(Controller, Influence, Curve, &Smoothers[Controller]);
302 } else {
303 AddCC(Controller, Influence, Curve);
304 }
305 }
306
307
308 EndpointUnit::EndpointUnit(SfzSignalUnitRack* rack): EndpointSignalUnit(rack) {
309
310 }
311
312 SfzSignalUnitRack* const EndpointUnit::GetRack() {
313 return static_cast<SfzSignalUnitRack* const>(pRack);
314 }
315
316 void EndpointUnit::Trigger() {
317
318 }
319
320 bool EndpointUnit::Active() {
321 if (GetRack()->suVolEG.Active()) return true;
322
323 bool b = false;
324 for (int i = 0; i < GetRack()->volEGs.size(); i++) {
325 if (GetRack()->volEGs[i]->Active()) { b = true; break; }
326 }
327
328 return b;
329 }
330
331 float EndpointUnit::GetVolume() {
332 float vol = GetRack()->suVolEG.Active() ? GetRack()->suVolEG.GetLevel() : 0;
333
334 for (int i = 0; i < GetRack()->volEGs.size(); i++) {
335 EGv2Unit* eg = GetRack()->volEGs[i];
336 if (!eg->Active()) continue;
337 vol += eg->GetLevel() * (eg->pEGInfo->amplitude / 100.0f);
338
339 }
340
341 AmpLFOUnit* u = &(GetRack()->suAmpLFO);
342 vol *= u->Active() ? ::sf2::ToRatio((u->GetLevel() * u->pLfoInfo->volume) * 10.0) : 1;
343
344 vol *= ::sf2::ToRatio(GetRack()->suVolOnCC.GetLevel() * 10.0);
345
346 return vol;
347 }
348
349 float EndpointUnit::GetFilterCutoff() {
350 float val;
351
352 FilLFOUnit* u = &(GetRack()->suFilLFO);
353 val = u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->pLfoInfo->cutoff) : 1;
354
355 FilEGUnit* u2 = &(GetRack()->suFilEG);
356 val *= u2->Active() ? RTMath::CentsToFreqRatioUnlimited(u2->GetLevel() * u2->depth) : 1;
357
358 for (int i = 0; i < GetRack()->filLFOs.size(); i++) {
359 LFOv2Unit* lfo = GetRack()->filLFOs[i];
360 if (!lfo->Active()) continue;
361
362 float f = lfo->GetLevel() * lfo->pLfoInfo->cutoff;
363 val *= RTMath::CentsToFreqRatioUnlimited(f);
364 }
365
366 return val;
367 }
368
369 float EndpointUnit::GetPitch() {
370 double p;
371 EGv1Unit* u = &(GetRack()->suPitchEG);
372 p = u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->depth) : 1;
373
374 PitchLFOUnit* u2 = &(GetRack()->suPitchLFO);
375 CCSignalUnit* u3 = &(GetRack()->suPitchLFO.suDepthCC);
376 float f = u3->Active() ? u3->GetLevel() : 0;
377 p *= u2->Active() ? RTMath::CentsToFreqRatioUnlimited(u2->GetLevel() * (u2->pLfoInfo->pitch + f)) : 1;
378
379 for (int i = 0; i < GetRack()->pitchLFOs.size(); i++) {
380 LFOv2Unit* lfo = GetRack()->pitchLFOs[i];
381 if (!lfo->Active()) continue;
382
383 float f = lfo->suPitchOnCC.Active() ? lfo->suPitchOnCC.GetLevel() : 0;
384 p *= RTMath::CentsToFreqRatioUnlimited(lfo->GetLevel() * (lfo->pLfoInfo->pitch + f));
385 }
386
387 return p;
388 }
389
390 float EndpointUnit::GetResonance() {
391 float val = 0;
392
393 for (int i = 0; i < GetRack()->resLFOs.size(); i++) {
394 LFOv2Unit* lfo = GetRack()->resLFOs[i];
395 if (!lfo->Active()) continue;
396
397 val += lfo->GetLevel() * lfo->pLfoInfo->resonance;
398 }
399
400 return val;
401 }
402
403 float EndpointUnit::GetPan() {
404 float pan = 0;
405
406 for (int i = 0; i < GetRack()->panLFOs.size(); i++) {
407 LFOv2Unit* lfo = GetRack()->panLFOs[i];
408 if (!lfo->Active()) continue;
409
410 pan += lfo->GetLevel() * lfo->pLfoInfo->pan;
411 }
412
413 if(pan < -100) return -100;
414 if(pan > 100) return 100;
415
416 return pan;
417 }
418
419
420 SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice)
421 : SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this),
422 EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), suVolOnCC(this),
423 suAmpLFO(this), suPitchLFO(this), suFilLFO(this),
424 LFOs(maxLfoCount), pitchLFOs(maxLfoCount), filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount)
425 {
426 suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;
427 suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = suVolOnCC.pVoice = voice;
428 suPitchLFO.suDepthCC.pVoice = suPitchLFO.suFadeEG.pVoice = suPitchLFO.suFreqOnCC.pVoice = voice;
429 suFilLFO.suFadeEG.pVoice = suFilLFO.suFreqOnCC.pVoice = voice;
430 suAmpLFO.suFadeEG.pVoice = suAmpLFO.suFreqOnCC.pVoice = voice;
431
432 for (int i = 0; i < EGs.capacity(); i++) {
433 EGs[i] = new EGv2Unit(this);
434 EGs[i]->pVoice = voice;
435 }
436
437 for (int i = 0; i < LFOs.capacity(); i++) {
438 LFOs[i] = new LFOv2Unit(this);
439 LFOs[i]->pVoice = voice;
440 LFOs[i]->suFadeEG.pVoice = voice;
441 LFOs[i]->suPitchOnCC.pVoice = voice;
442 LFOs[i]->suFreqOnCC.pVoice = voice;
443 }
444 }
445
446 SfzSignalUnitRack::~SfzSignalUnitRack() {
447 for (int i = 0; i < EGs.capacity(); i++) {
448 delete EGs[i]; EGs[i] = NULL;
449 }
450
451 for (int i = 0; i < LFOs.capacity(); i++) {
452 delete LFOs[i]; LFOs[i] = NULL;
453 }
454 }
455
456 void SfzSignalUnitRack::Trigger() {
457 EGs.clear();
458 volEGs.clear();
459 pitchEGs.clear();
460
461 LFOs.clear();
462 pitchLFOs.clear();
463 filLFOs.clear();
464 resLFOs.clear();
465 panLFOs.clear();
466
467 ::sfz::Region* const pRegion = pVoice->pRegion;
468
469 suVolOnCC.SetCCs(pRegion->volume_oncc);
470
471 for (int i = 0; i < pRegion->eg.size(); i++) {
472 if (pRegion->eg[i].node.size() == 0) continue;
473
474 if(EGs.size() < EGs.capacity()) {
475 EGv2Unit eg(this);
476 eg.pEGInfo = &(pRegion->eg[i]);
477 EGs.increment()->Copy(eg);
478 } else { std::cerr << "Maximum number of EGs reached!" << std::endl; break; }
479
480 if (pRegion->eg[i].amplitude > 0) {
481 if(volEGs.size() < volEGs.capacity()) volEGs.add(EGs[EGs.size() - 1]);
482 else std::cerr << "Maximum number of EGs reached!" << std::endl;
483 }
484 }
485
486 if (pRegion->ampeg_sustain == -1) {
487 if (volEGs.size() > 0) pRegion->ampeg_sustain = 0;
488 else pRegion->ampeg_sustain = 100;
489 }
490
491 // LFO
492 for (int i = 0; i < pRegion->lfos.size(); i++) {
493 if (pRegion->lfos[i].freq == -1) continue; // Not initialized
494
495 if(LFOs.size() < LFOs.capacity()) {
496 LFOv2Unit lfo(this);
497 lfo.pLfoInfo = &(pRegion->lfos[i]);
498 LFOs.increment()->Copy(lfo);
499 LFOs[LFOs.size() - 1]->suPitchOnCC.SetCCs(pRegion->lfos[i].pitch_oncc);
500 LFOs[LFOs.size() - 1]->suFreqOnCC.SetCCs(pRegion->lfos[i].freq_oncc);
501 } else { std::cerr << "Maximum number of LFOs reached!" << std::endl; break; }
502
503 if (pRegion->lfos[i].pitch != 0 || !pRegion->lfos[i].pitch_oncc.empty()) {
504 if(pitchLFOs.size() < pitchLFOs.capacity()) pitchLFOs.add(LFOs[LFOs.size() - 1]);
505 else std::cerr << "Maximum number of LFOs reached!" << std::endl;
506 }
507
508 if (pRegion->lfos[i].cutoff != 0) {
509 if(filLFOs.size() < filLFOs.capacity()) filLFOs.add(LFOs[LFOs.size() - 1]);
510 else std::cerr << "Maximum number of LFOs reached!" << std::endl;
511 }
512
513 if (pRegion->lfos[i].resonance != 0) {
514 if(resLFOs.size() < resLFOs.capacity()) resLFOs.add(LFOs[LFOs.size() - 1]);
515 else std::cerr << "Maximum number of LFOs reached!" << std::endl;
516 }
517
518 if (pRegion->lfos[i].pan != 0) {
519 if(panLFOs.size() < panLFOs.capacity()) panLFOs.add(LFOs[LFOs.size() - 1]);
520 else std::cerr << "Maximum number of LFOs reached!" << std::endl;
521 }
522 }
523
524 suPitchLFO.suDepthCC.SetCCs(pRegion->pitchlfo_depthcc);
525 suPitchLFO.suFreqOnCC.SetCCs(pRegion->pitchlfo_freqcc);
526
527 suFilLFO.suFreqOnCC.SetCCs(pRegion->fillfo_freqcc);
528
529 suAmpLFO.suFreqOnCC.SetCCs(pRegion->amplfo_freqcc);
530
531 Units.clear();
532
533 Units.add(&suVolOnCC);
534
535 Units.add(&suVolEG);
536 Units.add(&suFilEG);
537 Units.add(&suPitchEG);
538
539 Units.add(&suPitchLFO.suFreqOnCC); // Don't change order! (should be triggered before the LFO)
540 Units.add(&suPitchLFO);
541 Units.add(&suPitchLFO.suDepthCC);
542 Units.add(&suPitchLFO.suFadeEG);
543
544 Units.add(&suAmpLFO.suFreqOnCC); // Don't change order! (should be triggered before the LFO)
545 Units.add(&suAmpLFO);
546 Units.add(&suAmpLFO.suFadeEG);
547
548 Units.add(&suFilLFO.suFreqOnCC); // Don't change order! (should be triggered before the LFO)
549 Units.add(&suFilLFO);
550 Units.add(&suFilLFO.suFadeEG);
551
552 for (int i = 0; i < EGs.size(); i++) {
553 Units.add(EGs[i]);
554 }
555
556 for (int i = 0; i < LFOs.size(); i++) {
557 Units.add(&(LFOs[i]->suFreqOnCC)); // Don't change order! (should be triggered before the LFO)
558 Units.add(LFOs[i]);
559 Units.add(&(LFOs[i]->suFadeEG));
560 Units.add(&(LFOs[i]->suPitchOnCC));
561 }
562
563 Units.add(&suEndpoint);
564
565 SignalUnitRack::Trigger();
566 }
567
568 EndpointSignalUnit* SfzSignalUnitRack::GetEndpointUnit() {
569 return &suEndpoint;
570 }
571
572 void SfzSignalUnitRack::EnterFadeOutStage() {
573 suVolEG.EG.enterFadeOutStage();
574
575 for (int i = 0; i < volEGs.size(); i++) {
576 volEGs[i]->EG.enterFadeOutStage();
577 }
578 }
579
580 }} // namespace LinuxSampler::sfz

  ViewVC Help
Powered by ViewVC