4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 - 2010 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009 - 2011 Christian Schoenebeck and Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
32 |
Voice::Voice() { |
Voice::Voice() { |
33 |
pEngine = NULL; |
pEngine = NULL; |
34 |
pEG1 = &EG1; |
pEG1 = &EG1; |
35 |
|
pEG2 = &EG2; |
36 |
} |
} |
37 |
|
|
38 |
Voice::~Voice() { |
Voice::~Voice() { |
107 |
ri.EG3Attack = 0; // TODO: |
ri.EG3Attack = 0; // TODO: |
108 |
ri.EG3Depth = 0; // TODO: |
ri.EG3Depth = 0; // TODO: |
109 |
ri.VCFEnabled = false; // TODO: |
ri.VCFEnabled = false; // TODO: |
110 |
ri.VCFType = ::gig::vcf_type_lowpass; // TODO: |
ri.VCFType = Filter::vcf_type_2p_lowpass; // TODO: |
111 |
ri.VCFResonance = 0; // TODO: |
ri.VCFResonance = 0; // TODO: |
112 |
|
|
113 |
ri.ReleaseTriggerDecay = 0; // TODO: |
ri.ReleaseTriggerDecay = 0; // TODO: |
266 |
return eg; |
return eg; |
267 |
} |
} |
268 |
|
|
269 |
|
void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
270 |
|
EG2.trigger(uint(RgnInfo.EG2PreAttack), |
271 |
|
RgnInfo.EG2Attack * egInfo.Attack, |
272 |
|
false, |
273 |
|
RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, |
274 |
|
RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, |
275 |
|
RgnInfo.EG2InfiniteSustain, |
276 |
|
uint(RgnInfo.EG2Sustain), |
277 |
|
RgnInfo.EG2Release * egInfo.Release * velrelease, |
278 |
|
velocityAttenuation, |
279 |
|
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
280 |
|
} |
281 |
|
|
282 |
void Voice::InitLFO1() { |
void Voice::InitLFO1() { |
283 |
/*uint16_t lfo1_internal_depth; |
/*uint16_t lfo1_internal_depth; |
284 |
switch (pRegion->LFO1Controller) { |
switch (pRegion->LFO1Controller) { |
417 |
float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { |
float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { |
418 |
/*float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); |
/*float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); |
419 |
if (pRegion->VCFKeyboardTracking) { |
if (pRegion->VCFKeyboardTracking) { |
420 |
cutoff *= exp((MIDIKeyVelocity - pRegion->VCFKeyboardTrackingBreakpoint) * 0.057762265f); // (ln(2) / 12) |
cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey - pRegion->VCFKeyboardTrackingBreakpoint) * 100); |
421 |
} |
} |
422 |
return cutoff;*/ // TODO: ^^^ |
return cutoff;*/ // TODO: ^^^ |
423 |
return 1.0f; |
return 1.0f; |
508 |
return 0; |
return 0; |
509 |
} |
} |
510 |
|
|
511 |
|
void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) { |
512 |
|
if (itEvent->Param.Note.Key != MIDIKey) { |
513 |
|
// kill the voice fast |
514 |
|
pEG1->enterFadeOutStage(); |
515 |
|
} |
516 |
|
} |
517 |
|
|
518 |
}} // namespace LinuxSampler::sf2 |
}} // namespace LinuxSampler::sf2 |