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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2203 - (show annotations) (download)
Sat Jul 9 16:44:27 2011 UTC (7 years, 3 months ago) by persson
File size: 23051 byte(s)
* sf2 engine: fine-tuned amplitude EG (by switching from gig to sfz EG)
* sfz engine: added support for EG hold (ampeg_hold)
* Mac OS X: made it possible to specify plugin installation dir to
  configure

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2008 Christian Schoenebeck *
7 * Copyright (C) 2009 - 2011 Christian Schoenebeck and Grigor Iliev *
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, write to the Free Software *
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
22 * MA 02111-1307 USA *
23 ***************************************************************************/
24
25 #include "Voice.h"
26
27 #include "Engine.h"
28 #include "EngineChannel.h"
29
30 #define LN_10_DIV_20 0.115129254649702
31
32 namespace LinuxSampler { namespace sfz {
33
34 Voice::Voice() {
35 pEngine = NULL;
36 }
37
38 Voice::~Voice() {
39
40 }
41
42 EngineChannel* Voice::GetSfzEngineChannel() {
43 return static_cast<EngineChannel*>(pEngineChannel);
44 }
45
46 void Voice::SetEngine(LinuxSampler::Engine* pEngine) {
47 Engine* engine = static_cast<Engine*>(pEngine);
48 this->pEngine = engine;
49 this->pDiskThread = engine->pDiskThread;
50 dmsg(6,("Voice::SetEngine()\n"));
51 }
52
53 Voice::SampleInfo Voice::GetSampleInfo() {
54 SampleInfo si;
55 si.SampleRate = pSample->GetSampleRate();
56 si.ChannelCount = pSample->GetChannelCount();
57 si.FrameSize = pSample->GetFrameSize();
58 si.BitDepth = (pSample->GetFrameSize() / pSample->GetChannelCount()) * 8;
59 si.TotalFrameCount = pSample->GetTotalFrameCount();
60
61 si.HasLoops = pRegion->HasLoop();
62 si.LoopStart = pRegion->GetLoopStart();
63 si.LoopLength = pRegion->GetLoopEnd() - pRegion->GetLoopStart();
64 si.LoopPlayCount = pRegion->GetLoopCount();
65 si.Unpitched = pRegion->pitch_keytrack == 0;
66 return si;
67 }
68
69 Voice::RegionInfo Voice::GetRegionInfo() {
70 RegionInfo ri;
71 ri.UnityNote = pRegion->pitch_keycenter;
72 ri.FineTune = pRegion->tune + pRegion->transpose * 100;
73 ri.Pan = int(pRegion->pan * 0.63); // convert from -100..100 to -64..63
74 ri.SampleStartOffset = 0; // TODO:
75
76 ri.EG2PreAttack = pRegion->fileg_start * 10;
77 ri.EG2Attack = pRegion->fileg_attack;
78 //ri.EG2Hold = pRegion->fileg_hold; // TODO:
79 ri.EG2Decay1 = pRegion->fileg_decay;
80 ri.EG2Decay2 = pRegion->fileg_decay;
81 ri.EG2Sustain = pRegion->fileg_sustain * 10;
82 ri.EG2InfiniteSustain = true;
83 ri.EG2Release = pRegion->fileg_release;
84
85 ri.EG3Attack = pRegion->pitcheg_attack;
86 ri.EG3Depth = 0; // TODO:
87 ri.VCFEnabled = pRegion->cutoff;
88 switch (pRegion->fil_type) {
89 case ::sfz::LPF_1P:
90 ri.VCFType = Filter::vcf_type_1p_lowpass;
91 break;
92 case ::sfz::LPF_2P:
93 ri.VCFType = Filter::vcf_type_2p_lowpass;
94 break;
95 case ::sfz::LPF_4P:
96 ri.VCFType = Filter::vcf_type_4p_lowpass;
97 break;
98 case ::sfz::LPF_6P:
99 ri.VCFType = Filter::vcf_type_6p_lowpass;
100 break;
101 case ::sfz::HPF_1P:
102 ri.VCFType = Filter::vcf_type_1p_highpass;
103 break;
104 case ::sfz::HPF_2P:
105 ri.VCFType = Filter::vcf_type_2p_highpass;
106 break;
107 case ::sfz::HPF_4P:
108 ri.VCFType = Filter::vcf_type_4p_highpass;
109 break;
110 case ::sfz::HPF_6P:
111 ri.VCFType = Filter::vcf_type_6p_highpass;
112 break;
113 case ::sfz::BPF_1P:
114 case ::sfz::BPF_2P:
115 ri.VCFType = Filter::vcf_type_2p_bandpass;
116 break;
117 case ::sfz::BRF_1P:
118 case ::sfz::BRF_2P:
119 ri.VCFType = Filter::vcf_type_2p_bandreject;
120 break;
121 case ::sfz::APF_1P:
122 case ::sfz::PKF_2P:
123 default:
124 ri.VCFEnabled = false;
125 break;
126 }
127
128 ri.VCFResonance = pRegion->resonance;
129
130 // rt_decay is in dB. Precalculate a suitable value for exp in
131 // GetReleaseTriggerAttenuation: -ln(10) / 20 * rt_decay
132 ri.ReleaseTriggerDecay = -LN_10_DIV_20 * pRegion->rt_decay;
133
134 return ri;
135 }
136
137 Voice::InstrumentInfo Voice::GetInstrumentInfo() {
138 InstrumentInfo ii;
139 ii.FineTune = 0; // TODO:
140 ii.PitchbendRange = 2; // TODO:
141
142 return ii;
143 }
144
145 double Voice::GetSampleAttenuation() {
146 return exp(LN_10_DIV_20 * pRegion->volume);
147 }
148
149 double Voice::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) {
150 return pRegion->amp_velcurve[MIDIKeyVelocity];
151 }
152
153 double Voice::GetVelocityRelease(uint8_t MIDIKeyVelocity) {
154 return 127.0 / MIDIKeyVelocity;
155 }
156
157 void Voice::ProcessCCEvent(RTList<Event>::Iterator& itEvent) {
158 /*if (itEvent->Type == Event::type_control_change && itEvent->Param.CC.Controller) { // if (valid) MIDI control change event
159 if (pRegion->AttenuationController.type == ::gig::attenuation_ctrl_t::type_controlchange &&
160 itEvent->Param.CC.Controller == pRegion->AttenuationController.controller_number) {
161 CrossfadeSmoother.update(AbstractEngine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.CC.Value)]);
162 }
163 }*/ // TODO: ^^^
164 }
165
166 void Voice::ProcessCutoffEvent(RTList<Event>::Iterator& itEvent) {
167 int ccvalue = itEvent->Param.CC.Value;
168 if (VCFCutoffCtrl.value == ccvalue) return;
169 VCFCutoffCtrl.value = ccvalue;
170
171 float cutoff = CutoffBase * RTMath::CentsToFreqRatioUnlimited(
172 ccvalue / 127.0f * pRegion->cutoff_oncc[VCFCutoffCtrl.controller]);
173 if (cutoff > 0.49 * pEngine->SampleRate) cutoff = 0.49 * pEngine->SampleRate;
174
175 VCFCutoffCtrl.fvalue = cutoff; // needed for initialization of fFinalCutoff next time
176 fFinalCutoff = cutoff;
177 }
178
179 double Voice::CalculateCrossfadeVolume(uint8_t MIDIKeyVelocity) {
180 /*float crossfadeVolume;
181 switch (pRegion->AttenuationController.type) {
182 case ::gig::attenuation_ctrl_t::type_channelaftertouch:
183 crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(GetSfzEngineChannel()->ControllerTable[128])];
184 break;
185 case ::gig::attenuation_ctrl_t::type_velocity:
186 crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(MIDIKeyVelocity)];
187 break;
188 case ::gig::attenuation_ctrl_t::type_controlchange: //FIXME: currently not sample accurate
189 crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(GetSfzEngineChannel()->ControllerTable[pRegion->AttenuationController.controller_number])];
190 break;
191 case ::gig::attenuation_ctrl_t::type_none: // no crossfade defined
192 default:
193 crossfadeVolume = 1.0f;
194 }
195
196 return crossfadeVolume;*/ // TODO: ^^^
197 return 1.0f;
198 }
199
200 double Voice::GetEG1ControllerValue(uint8_t MIDIKeyVelocity) {
201 /*double eg1controllervalue = 0;
202 switch (pRegion->EG1Controller.type) {
203 case ::gig::eg1_ctrl_t::type_none: // no controller defined
204 eg1controllervalue = 0;
205 break;
206 case ::gig::eg1_ctrl_t::type_channelaftertouch:
207 eg1controllervalue = GetSfzEngineChannel()->ControllerTable[128];
208 break;
209 case ::gig::eg1_ctrl_t::type_velocity:
210 eg1controllervalue = MIDIKeyVelocity;
211 break;
212 case ::gig::eg1_ctrl_t::type_controlchange: // MIDI control change controller
213 eg1controllervalue = GetSfzEngineChannel()->ControllerTable[pRegion->EG1Controller.controller_number];
214 break;
215 }
216 if (pRegion->EG1ControllerInvert) eg1controllervalue = 127 - eg1controllervalue;
217
218 return eg1controllervalue;*/ // TODO: ^^^
219 return 0;
220 }
221
222 Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) {
223 /*EGInfo eg;
224 // (eg1attack is different from the others)
225 eg.Attack = (pRegion->EG1ControllerAttackInfluence) ?
226 1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ?
227 1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0;
228 eg.Decay = (pRegion->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence) * eg1ControllerValue : 1.0;
229 eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0;
230
231 return eg;*/ // TODO: ^^^
232 EGInfo eg;
233 eg.Attack = 1.0;
234 eg.Decay = 1.0;
235 eg.Release = 1.0;
236 return eg;
237 }
238
239 void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
240
241 // TODO: controller modulation
242
243 // first check if there is a v2 EG for amplitude
244 for (int i = 0 ; i < pRegion->eg.size() ; i++) {
245 if (pRegion->eg[i].amplitude > 0) {
246 // TODO: actually use the value of the amplitude parameter
247 pEG1 = &EG1;
248 EG1.trigger(pRegion->eg[i], sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE, velocity);
249 return;
250 }
251 }
252
253 // otherwise use the v1 EGADSR
254 pEG1 = &EGADSR1;
255 EGADSR1.trigger(uint(pRegion->ampeg_start * 10),
256 std::max(0.0, pRegion->ampeg_attack + pRegion->ampeg_vel2attack * velrelease),
257 std::max(0.0, pRegion->ampeg_hold + pRegion->ampeg_vel2hold * velrelease),
258 std::max(0.0, pRegion->ampeg_decay + pRegion->ampeg_vel2decay * velrelease),
259 uint(std::min(std::max(0.0, 10 * (pRegion->ampeg_sustain + pRegion->ampeg_vel2sustain * velrelease)), 1000.0)),
260 std::max(0.0, pRegion->ampeg_release + pRegion->ampeg_vel2release * velrelease),
261 sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
262 }
263
264 double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) {
265 /*double eg2controllervalue = 0;
266 switch (pRegion->EG2Controller.type) {
267 case ::gig::eg2_ctrl_t::type_none: // no controller defined
268 eg2controllervalue = 0;
269 break;
270 case ::gig::eg2_ctrl_t::type_channelaftertouch:
271 eg2controllervalue = GetSfzEngineChannel()->ControllerTable[128];
272 break;
273 case ::gig::eg2_ctrl_t::type_velocity:
274 eg2controllervalue = MIDIKeyVelocity;
275 break;
276 case ::gig::eg2_ctrl_t::type_controlchange: // MIDI control change controller
277 eg2controllervalue = GetSfzEngineChannel()->ControllerTable[pRegion->EG2Controller.controller_number];
278 break;
279 }
280 if (pRegion->EG2ControllerInvert) eg2controllervalue = 127 - eg2controllervalue;
281
282 return eg2controllervalue;*/ // TODO: ^^^
283 return 0;
284 }
285
286 Voice::EGInfo Voice::CalculateEG2ControllerInfluence(double eg2ControllerValue) {
287 /*EGInfo eg;
288 eg.Attack = (pRegion->EG2ControllerAttackInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerAttackInfluence) * eg2ControllerValue : 1.0;
289 eg.Decay = (pRegion->EG2ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerDecayInfluence) * eg2ControllerValue : 1.0;
290 eg.Release = (pRegion->EG2ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerReleaseInfluence) * eg2ControllerValue : 1.0;
291
292 return eg;*/ // TODO: ^^^
293 EGInfo eg;
294 eg.Attack = 1.0;
295 eg.Decay = 1.0;
296 eg.Release = 1.0;
297 return eg;
298 }
299
300 void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
301
302 // TODO: the sfz filter EG should modulate cents, not hertz,
303 // so we can't use the EG or EGADSR as it is. Disable for now.
304
305 pEG2 = &EGADSR2;
306 EGADSR2.trigger(0,
307 0,
308 false,
309 0,
310 1000,
311 0,
312 sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
313 }
314
315 void Voice::InitLFO1() {
316 /*uint16_t lfo1_internal_depth;
317 switch (pRegion->LFO1Controller) {
318 case ::gig::lfo1_ctrl_internal:
319 lfo1_internal_depth = pRegion->LFO1InternalDepth;
320 pLFO1->ExtController = 0; // no external controller
321 bLFO1Enabled = (lfo1_internal_depth > 0);
322 break;
323 case ::gig::lfo1_ctrl_modwheel:
324 lfo1_internal_depth = 0;
325 pLFO1->ExtController = 1; // MIDI controller 1
326 bLFO1Enabled = (pRegion->LFO1ControlDepth > 0);
327 break;
328 case ::gig::lfo1_ctrl_breath:
329 lfo1_internal_depth = 0;
330 pLFO1->ExtController = 2; // MIDI controller 2
331 bLFO1Enabled = (pRegion->LFO1ControlDepth > 0);
332 break;
333 case ::gig::lfo1_ctrl_internal_modwheel:
334 lfo1_internal_depth = pRegion->LFO1InternalDepth;
335 pLFO1->ExtController = 1; // MIDI controller 1
336 bLFO1Enabled = (lfo1_internal_depth > 0 || pRegion->LFO1ControlDepth > 0);
337 break;
338 case ::gig::lfo1_ctrl_internal_breath:
339 lfo1_internal_depth = pRegion->LFO1InternalDepth;
340 pLFO1->ExtController = 2; // MIDI controller 2
341 bLFO1Enabled = (lfo1_internal_depth > 0 || pRegion->LFO1ControlDepth > 0);
342 break;
343 default:
344 lfo1_internal_depth = 0;
345 pLFO1->ExtController = 0; // no external controller
346 bLFO1Enabled = false;
347 }
348 if (bLFO1Enabled) {
349 pLFO1->trigger(pRegion->LFO1Frequency,
350 start_level_min,
351 lfo1_internal_depth,
352 pRegion->LFO1ControlDepth,
353 pRegion->LFO1FlipPhase,
354 pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
355 pLFO1->update(pLFO1->ExtController ? GetSfzEngineChannel()->ControllerTable[pLFO1->ExtController] : 0);
356 }*/ // TODO: ^^^
357 bLFO1Enabled = false;
358 }
359
360 void Voice::InitLFO2() {
361 /*uint16_t lfo2_internal_depth;
362 switch (pRegion->LFO2Controller) {
363 case ::gig::lfo2_ctrl_internal:
364 lfo2_internal_depth = pRegion->LFO2InternalDepth;
365 pLFO2->ExtController = 0; // no external controller
366 bLFO2Enabled = (lfo2_internal_depth > 0);
367 break;
368 case ::gig::lfo2_ctrl_modwheel:
369 lfo2_internal_depth = 0;
370 pLFO2->ExtController = 1; // MIDI controller 1
371 bLFO2Enabled = (pRegion->LFO2ControlDepth > 0);
372 break;
373 case ::gig::lfo2_ctrl_foot:
374 lfo2_internal_depth = 0;
375 pLFO2->ExtController = 4; // MIDI controller 4
376 bLFO2Enabled = (pRegion->LFO2ControlDepth > 0);
377 break;
378 case ::gig::lfo2_ctrl_internal_modwheel:
379 lfo2_internal_depth = pRegion->LFO2InternalDepth;
380 pLFO2->ExtController = 1; // MIDI controller 1
381 bLFO2Enabled = (lfo2_internal_depth > 0 || pRegion->LFO2ControlDepth > 0);
382 break;
383 case ::gig::lfo2_ctrl_internal_foot:
384 lfo2_internal_depth = pRegion->LFO2InternalDepth;
385 pLFO2->ExtController = 4; // MIDI controller 4
386 bLFO2Enabled = (lfo2_internal_depth > 0 || pRegion->LFO2ControlDepth > 0);
387 break;
388 default:
389 lfo2_internal_depth = 0;
390 pLFO2->ExtController = 0; // no external controller
391 bLFO2Enabled = false;
392 }
393 if (bLFO2Enabled) {
394 pLFO2->trigger(pRegion->LFO2Frequency,
395 start_level_max,
396 lfo2_internal_depth,
397 pRegion->LFO2ControlDepth,
398 pRegion->LFO2FlipPhase,
399 pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
400 pLFO2->update(pLFO2->ExtController ? GetSfzEngineChannel()->ControllerTable[pLFO2->ExtController] : 0);
401 }*/ // TODO: ^^^
402 bLFO2Enabled = false;
403 }
404
405 void Voice::InitLFO3() {
406 /*uint16_t lfo3_internal_depth;
407 switch (pRegion->LFO3Controller) {
408 case ::gig::lfo3_ctrl_internal:
409 lfo3_internal_depth = pRegion->LFO3InternalDepth;
410 pLFO3->ExtController = 0; // no external controller
411 bLFO3Enabled = (lfo3_internal_depth > 0);
412 break;
413 case ::gig::lfo3_ctrl_modwheel:
414 lfo3_internal_depth = 0;
415 pLFO3->ExtController = 1; // MIDI controller 1
416 bLFO3Enabled = (pRegion->LFO3ControlDepth > 0);
417 break;
418 case ::gig::lfo3_ctrl_aftertouch:
419 lfo3_internal_depth = 0;
420 pLFO3->ExtController = 128;
421 bLFO3Enabled = true;
422 break;
423 case ::gig::lfo3_ctrl_internal_modwheel:
424 lfo3_internal_depth = pRegion->LFO3InternalDepth;
425 pLFO3->ExtController = 1; // MIDI controller 1
426 bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0);
427 break;
428 case ::gig::lfo3_ctrl_internal_aftertouch:
429 lfo3_internal_depth = pRegion->LFO3InternalDepth;
430 pLFO1->ExtController = 128;
431 bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0);
432 break;
433 default:
434 lfo3_internal_depth = 0;
435 pLFO3->ExtController = 0; // no external controller
436 bLFO3Enabled = false;
437 }
438 if (bLFO3Enabled) {
439 pLFO3->trigger(pRegion->LFO3Frequency,
440 start_level_mid,
441 lfo3_internal_depth,
442 pRegion->LFO3ControlDepth,
443 false,
444 pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
445 pLFO3->update(pLFO3->ExtController ? GetSfzEngineChannel()->ControllerTable[pLFO3->ExtController] : 0);
446 }*/ // TODO: ^^^
447 bLFO3Enabled = false;
448 }
449
450 float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) {
451 float cutoff = *pRegion->cutoff;
452 cutoff *= RTMath::CentsToFreqRatioUnlimited(
453 MIDIKeyVelocity / 127.0f * pRegion->fil_veltrack +
454 (MIDIKey - pRegion->fil_keycenter) * pRegion->fil_keytrack);
455 return cutoff;
456 }
457
458 float Voice::CalculateFinalCutoff(float cutoffBase) {
459 float cutoff;
460 if (VCFCutoffCtrl.controller) {
461 int ccvalue = GetSfzEngineChannel()->ControllerTable[VCFCutoffCtrl.controller];
462 cutoff = CutoffBase * RTMath::CentsToFreqRatioUnlimited(
463 ccvalue / 127.0f * pRegion->cutoff_oncc[VCFCutoffCtrl.controller]);
464 } else {
465 cutoff = cutoffBase;
466 }
467 if (cutoff > 0.49 * pEngine->SampleRate) cutoff = 0.49 * pEngine->SampleRate;
468 return cutoff;
469 }
470
471 uint8_t Voice::GetVCFCutoffCtrl() {
472 // TODO: the sfz format allows several CC for the same
473 // modulation destination. The Voice interface needs to be
474 // changed to support that.
475 if (pRegion->cutoff_cc) return pRegion->cutoff_cc;
476 else if (pRegion->cutoff_chanaft) return 128;
477 return 0;
478 }
479
480 uint8_t Voice::GetVCFResonanceCtrl() {
481 /*uint8_t ctrl;
482 switch (pRegion->VCFResonanceController) {
483 case ::gig::vcf_res_ctrl_genpurpose3:
484 ctrl = 18;
485 break;
486 case ::gig::vcf_res_ctrl_genpurpose4:
487 ctrl = 19;
488 break;
489 case ::gig::vcf_res_ctrl_genpurpose5:
490 ctrl = 80;
491 break;
492 case ::gig::vcf_res_ctrl_genpurpose6:
493 ctrl = 81;
494 break;
495 case ::gig::vcf_res_ctrl_none:
496 default:
497 ctrl = 0;
498 }
499
500 return ctrl;*/ // TODO: ^^^
501 return 0;
502 }
503
504 float Voice::GetReleaseTriggerAttenuation(float noteLength) {
505 // pow(10, -rt_decay * noteLength / 20):
506 return expf(RgnInfo.ReleaseTriggerDecay * noteLength);
507 }
508
509 void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) {
510 dmsg(4,("Voice %x processGroupEvents event type=%d", this, itEvent->Type));
511 if (itEvent->Type == Event::type_control_change ||
512 (Type & Voice::type_controller_triggered) ||
513 itEvent->Param.Note.Key != MIDIKey) {
514 dmsg(4,("Voice %x - kill", this));
515 if (pRegion->off_mode == ::sfz::OFF_NORMAL) {
516 // turn off the voice by entering release envelope stage
517 EnterReleaseStage();
518 } else {
519 // kill the voice fast
520 pEG1->enterFadeOutStage();
521 }
522 }
523 }
524
525 }} // namespace LinuxSampler::sfz

  ViewVC Help
Powered by ViewVC