242 |
|
|
243 |
float sustain = pRegion->ampeg_sustain + pRegion->ampeg_vel2sustain * velrelease; |
float sustain = pRegion->ampeg_sustain + pRegion->ampeg_vel2sustain * velrelease; |
244 |
sustain = 10 * (sustain + GetInfluence(pRegion->ampeg_sustaincc)); |
sustain = 10 * (sustain + GetInfluence(pRegion->ampeg_sustaincc)); |
245 |
|
if (pVoice->pNote) { |
246 |
|
pVoice->pNote->Override.Sustain.applyTo(sustain); |
247 |
|
} |
248 |
|
|
249 |
float release = pRegion->ampeg_release + pRegion->ampeg_vel2release * velrelease; |
float release = pRegion->ampeg_release + pRegion->ampeg_vel2release * velrelease; |
250 |
release = std::max(0.0f, release + GetInfluence(pRegion->ampeg_releasecc)); |
release = std::max(0.0f, release + GetInfluence(pRegion->ampeg_releasecc)); |
251 |
|
|
258 |
|
|
259 |
LFOUnit::LFOUnit(SfzSignalUnitRack* rack) |
LFOUnit::LFOUnit(SfzSignalUnitRack* rack) |
260 |
: SfzSignalUnit(rack), pLfoInfo(NULL), pLFO(NULL), |
: SfzSignalUnit(rack), pLfoInfo(NULL), pLFO(NULL), |
261 |
suFadeEG(rack), suFreqOnCC(rack, this), suDepthOnCC(rack) |
suFadeEG(rack), suDepthOnCC(rack), suFreqOnCC(rack, this) |
262 |
{ } |
{ } |
263 |
|
|
264 |
LFOUnit::LFOUnit(const LFOUnit& Unit) |
LFOUnit::LFOUnit(const LFOUnit& Unit) |
265 |
: SfzSignalUnit(Unit), suFadeEG(static_cast<SfzSignalUnitRack*>(Unit.pRack)), |
: SfzSignalUnit(Unit), suFadeEG(static_cast<SfzSignalUnitRack*>(Unit.pRack)), |
266 |
suFreqOnCC(static_cast<SfzSignalUnitRack*>(Unit.pRack), this), |
suDepthOnCC(static_cast<SfzSignalUnitRack*>(Unit.pRack)), |
267 |
suDepthOnCC(static_cast<SfzSignalUnitRack*>(Unit.pRack)) |
suFreqOnCC(static_cast<SfzSignalUnitRack*>(Unit.pRack), this) |
268 |
{ |
{ |
269 |
Copy(Unit); |
Copy(Unit); |
270 |
} |
} |
309 |
start_level_mid, |
start_level_mid, |
310 |
1, 0, false, GetSampleRate() |
1, 0, false, GetSampleRate() |
311 |
); |
); |
312 |
lfo.update(0); |
lfo.updateByMIDICtrlValue(0); |
313 |
} |
} |
314 |
|
|
315 |
|
|
331 |
void LFOv2Unit::Trigger() { |
void LFOv2Unit::Trigger() { |
332 |
LFOUnit::Trigger(); |
LFOUnit::Trigger(); |
333 |
|
|
334 |
if (pLfoInfo->wave < 0 || pLfoInfo->wave >= lfos.size()) pLFO = &lfo0; |
if (/*pLfoInfo->wave < 0 ||*/ pLfoInfo->wave >= lfos.size()) pLFO = &lfo0; |
335 |
else pLFO = lfos[pLfoInfo->wave]; |
else pLFO = lfos[pLfoInfo->wave]; |
336 |
|
|
337 |
pLFO->Trigger ( |
pLFO->Trigger ( |
486 |
|
|
487 |
|
|
488 |
EndpointUnit::EndpointUnit(SfzSignalUnitRack* rack) |
EndpointUnit::EndpointUnit(SfzSignalUnitRack* rack) |
489 |
: EndpointSignalUnit(rack), suXFInCC(rack), suXFOutCC(rack), suPanOnCC(rack), pitchVeltrackRatio(0) |
: EndpointSignalUnit(rack), pitchVeltrackRatio(0), suXFInCC(rack), suXFOutCC(rack), suPanOnCC(rack) |
490 |
{ |
{ |
491 |
|
|
492 |
} |
} |
493 |
|
|
494 |
float EndpointUnit::GetInfluence(::sfz::Array< ::sfz::optional<float> >& cc) { |
float EndpointUnit::GetInfluence(::sfz::Array< optional<float> >& cc) { |
495 |
float f = 0; |
float f = 0; |
496 |
for (int i = 0; i < 128; i++) { |
for (int i = 0; i < 128; i++) { |
497 |
if (cc[i]) { |
if (cc[i]) { |
501 |
return f; |
return f; |
502 |
} |
} |
503 |
|
|
504 |
float EndpointUnit::GetInfluence(::sfz::Array< ::sfz::optional<int> >& cc) { |
float EndpointUnit::GetInfluence(::sfz::Array< optional<int> >& cc) { |
505 |
float f = 0; |
float f = 0; |
506 |
for (int i = 0; i < 128; i++) { |
for (int i = 0; i < 128; i++) { |
507 |
if (cc[i]) { |
if (cc[i]) { |
779 |
|
|
780 |
|
|
781 |
SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice) |
SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice) |
782 |
: SignalUnitRack(MaxUnitCount), EqUnitSupport(this, voice), pVoice(voice), |
: SignalUnitRack(MaxUnitCount), EqUnitSupport(this, voice), |
783 |
suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this), |
suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this), |
784 |
|
suAmpLFO(this), suPitchLFO(this), suFilLFO(this), |
785 |
|
suVolOnCC(this), suPitchOnCC(this), suCutoffOnCC(this), suResOnCC(this), |
786 |
EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), filEGs(maxEgCount), |
EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), filEGs(maxEgCount), |
787 |
resEGs(maxEgCount), panEGs(maxEgCount), eqEGs(maxEgCount), |
resEGs(maxEgCount), panEGs(maxEgCount), eqEGs(maxEgCount), |
|
suVolOnCC(this), suPitchOnCC(this), suCutoffOnCC(this), suResOnCC(this), |
|
|
suAmpLFO(this), suPitchLFO(this), suFilLFO(this), |
|
788 |
LFOs(maxLfoCount), volLFOs(maxLfoCount), pitchLFOs(maxLfoCount), |
LFOs(maxLfoCount), volLFOs(maxLfoCount), pitchLFOs(maxLfoCount), |
789 |
filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount), eqLFOs(maxLfoCount) |
filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount), eqLFOs(maxLfoCount), |
790 |
|
pVoice(voice) |
791 |
{ |
{ |
792 |
suEndpoint.pVoice = suEndpoint.suXFInCC.pVoice = suEndpoint.suXFOutCC.pVoice = suEndpoint.suPanOnCC.pVoice = voice; |
suEndpoint.pVoice = suEndpoint.suXFInCC.pVoice = suEndpoint.suXFOutCC.pVoice = suEndpoint.suPanOnCC.pVoice = voice; |
793 |
suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice; |
suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice; |