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 - 2013 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009 - 2015 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; |
341 |
break; |
break; |
342 |
case ::gig::lfo3_ctrl_aftertouch: |
case ::gig::lfo3_ctrl_aftertouch: |
343 |
lfo3_internal_depth = 0; |
lfo3_internal_depth = 0; |
344 |
pLFO3->ExtController = 128; |
pLFO3->ExtController = CTRL_TABLE_IDX_AFTERTOUCH; |
345 |
bLFO3Enabled = true; |
bLFO3Enabled = true; |
346 |
break; |
break; |
347 |
case ::gig::lfo3_ctrl_internal_modwheel: |
case ::gig::lfo3_ctrl_internal_modwheel: |
351 |
break; |
break; |
352 |
case ::gig::lfo3_ctrl_internal_aftertouch: |
case ::gig::lfo3_ctrl_internal_aftertouch: |
353 |
lfo3_internal_depth = pRegion->LFO3InternalDepth; |
lfo3_internal_depth = pRegion->LFO3InternalDepth; |
354 |
pLFO3->ExtController = 128; |
pLFO3->ExtController = CTRL_TABLE_IDX_AFTERTOUCH; |
355 |
bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0); |
bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0); |
356 |
break; |
break; |
357 |
default: |
default: |
373 |
float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { |
float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { |
374 |
float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); |
float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); |
375 |
if (pRegion->VCFKeyboardTracking) { |
if (pRegion->VCFKeyboardTracking) { |
376 |
cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey - pRegion->VCFKeyboardTrackingBreakpoint) * 100); |
cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey() - pRegion->VCFKeyboardTrackingBreakpoint) * 100); |
377 |
} |
} |
378 |
return cutoff; |
return cutoff; |
379 |
} |
} |
426 |
ctrl = 83; |
ctrl = 83; |
427 |
break; |
break; |
428 |
case ::gig::vcf_cutoff_ctrl_aftertouch: |
case ::gig::vcf_cutoff_ctrl_aftertouch: |
429 |
ctrl = 128; |
ctrl = CTRL_TABLE_IDX_AFTERTOUCH; |
430 |
break; |
break; |
431 |
case ::gig::vcf_cutoff_ctrl_none: |
case ::gig::vcf_cutoff_ctrl_none: |
432 |
default: |
default: |
487 |
} |
} |
488 |
|
|
489 |
void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) { |
void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) { |
490 |
dmsg(4,("Voice %x processGroupEvents event type=%d", this, itEvent->Type)); |
dmsg(4,("Voice %p processGroupEvents event type=%d", (void*)this, itEvent->Type)); |
491 |
|
|
492 |
// TODO: The SustainPedal condition could be wrong, maybe the |
// TODO: The SustainPedal condition could be wrong, maybe the |
493 |
// check should be if this Voice is in release stage or is a |
// check should be if this Voice is in release stage or is a |
498 |
// note should be stopped at all, because it doesn't sound naturally |
// note should be stopped at all, because it doesn't sound naturally |
499 |
// with a drumkit. |
// with a drumkit. |
500 |
// -- Christian, 2013-01-08 |
// -- Christian, 2013-01-08 |
501 |
if (itEvent->Param.Note.Key != MIDIKey /*|| |
if (itEvent->Param.Note.Key != HostKey() /*|| |
502 |
!GetGigEngineChannel()->SustainPedal*/) { |
!GetGigEngineChannel()->SustainPedal*/) { |
503 |
dmsg(4,("Voice %x - kill", this)); |
dmsg(4,("Voice %p - kill", (void*)this)); |
504 |
|
|
505 |
// kill the voice fast |
// kill the voice fast |
506 |
pEG1->enterFadeOutStage(); |
pEG1->enterFadeOutStage(); |