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; |
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 |
} |
} |
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(); |