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 - 2012 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009 - 2013 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 * |
124 |
} |
} |
125 |
} |
} |
126 |
|
|
127 |
|
void Voice::ProcessChannelPressureEvent(RTList<Event>::Iterator& itEvent) { |
128 |
|
if (itEvent->Type == Event::type_channel_pressure) { // if (valid) MIDI channel pressure (aftertouch) event |
129 |
|
if (pRegion->AttenuationController.type == ::gig::attenuation_ctrl_t::type_channelaftertouch) { |
130 |
|
CrossfadeSmoother.update(AbstractEngine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.ChannelPressure.Value)]); |
131 |
|
} |
132 |
|
} |
133 |
|
} |
134 |
|
|
135 |
|
void Voice::ProcessPolyphonicKeyPressureEvent(RTList<Event>::Iterator& itEvent) { |
136 |
|
// Not used so far |
137 |
|
} |
138 |
|
|
139 |
void Voice::ProcessCutoffEvent(RTList<Event>::Iterator& itEvent) { |
void Voice::ProcessCutoffEvent(RTList<Event>::Iterator& itEvent) { |
140 |
int ccvalue = itEvent->Param.CC.Value; |
int ccvalue = itEvent->Param.CC.Value; |
141 |
if (VCFCutoffCtrl.value == ccvalue) return; |
if (VCFCutoffCtrl.value == ccvalue) return; |
193 |
Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) { |
Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) { |
194 |
EGInfo eg; |
EGInfo eg; |
195 |
// (eg1attack is different from the others) |
// (eg1attack is different from the others) |
196 |
eg.Attack = (pRegion->EG1ControllerAttackInfluence) ? |
if (pRegion->EG1Attack < 1e-8 && // attack in gig == 0 |
197 |
1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ? |
(pRegion->EG1ControllerAttackInfluence == 0 || |
198 |
1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0; |
eg1ControllerValue <= 10)) { // strange GSt special case |
199 |
|
eg.Attack = 0; // this will force the attack to be 0 in the call to EG1.trigger |
200 |
|
} else { |
201 |
|
eg.Attack = (pRegion->EG1ControllerAttackInfluence) ? |
202 |
|
1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ? |
203 |
|
1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0; |
204 |
|
} |
205 |
eg.Decay = (pRegion->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence) * eg1ControllerValue : 1.0; |
eg.Decay = (pRegion->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence) * eg1ControllerValue : 1.0; |
206 |
eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0; |
eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0; |
207 |
|
|
462 |
|
|
463 |
void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
464 |
EG1.trigger(pRegion->EG1PreAttack, |
EG1.trigger(pRegion->EG1PreAttack, |
465 |
pRegion->EG1Attack * egInfo.Attack, |
RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, |
466 |
pRegion->EG1Hold, |
pRegion->EG1Hold, |
467 |
pRegion->EG1Decay1 * egInfo.Decay * velrelease, |
pRegion->EG1Decay1 * egInfo.Decay * velrelease, |
468 |
pRegion->EG1Decay2 * egInfo.Decay * velrelease, |
pRegion->EG1Decay2 * egInfo.Decay * velrelease, |
469 |
pRegion->EG1InfiniteSustain, |
pRegion->EG1InfiniteSustain, |
470 |
pRegion->EG1Sustain, |
pRegion->EG1Sustain, |
471 |
pRegion->EG1Release * egInfo.Release * velrelease, |
RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, |
472 |
velocityAttenuation, |
velocityAttenuation, |
473 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
474 |
} |
} |