143 |
VolumeLeft = volume * pKeyInfo->PanLeft; |
VolumeLeft = volume * pKeyInfo->PanLeft; |
144 |
VolumeRight = volume * pKeyInfo->PanRight; |
VolumeRight = volume * pKeyInfo->PanRight; |
145 |
|
|
146 |
float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; |
// this rate is used for rather mellow volume fades |
147 |
|
const float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; |
148 |
|
// this rate is used for very fast volume fades |
149 |
|
const float quickRampRate = RTMath::Min(subfragmentRate, GetEngine()->SampleRate * 0.001f /* 1ms */); |
150 |
CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); |
CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); |
151 |
|
|
152 |
VolumeSmoother.trigger(pEngineChannel->MidiVolume, subfragmentRate); |
VolumeSmoother.trigger(pEngineChannel->MidiVolume, subfragmentRate); |
153 |
NoteVolumeSmoother.trigger(pNote ? pNote->Override.Volume : 1.f, subfragmentRate); |
NoteVolumeSmoother.trigger(pNote ? pNote->Override.Volume : 1.f, quickRampRate); |
154 |
|
|
155 |
// Check if the sample needs disk streaming or is too short for that |
// Check if the sample needs disk streaming or is too short for that |
156 |
long cachedsamples = GetSampleCacheSize() / SmplInfo.FrameSize; |
long cachedsamples = GetSampleCacheSize() / SmplInfo.FrameSize; |
220 |
NotePanRight = (pNote) ? AbstractEngine::PanCurveValueNorm(pNote->Override.Pan, 1 /*right*/) : 1.f; |
NotePanRight = (pNote) ? AbstractEngine::PanCurveValueNorm(pNote->Override.Pan, 1 /*right*/) : 1.f; |
221 |
PanLeftSmoother.trigger( |
PanLeftSmoother.trigger( |
222 |
AbstractEngine::PanCurve[128 - pan] * NotePanLeft, |
AbstractEngine::PanCurve[128 - pan] * NotePanLeft, |
223 |
subfragmentRate |
quickRampRate //NOTE: maybe we should have 2 separate pan smoothers, one for MIDI CC10 (with slow rate) and one for instrument script change_pan() calls (with fast rate) |
224 |
); |
); |
225 |
PanRightSmoother.trigger( |
PanRightSmoother.trigger( |
226 |
AbstractEngine::PanCurve[pan] * NotePanRight, |
AbstractEngine::PanCurve[pan] * NotePanRight, |
227 |
subfragmentRate |
quickRampRate //NOTE: maybe we should have 2 separate pan smoothers, one for MIDI CC10 (with slow rate) and one for instrument script change_pan() calls (with fast rate) |
228 |
); |
); |
229 |
|
|
230 |
#ifdef CONFIG_INTERPOLATE_VOLUME |
#ifdef CONFIG_INTERPOLATE_VOLUME |
643 |
*/ |
*/ |
644 |
void AbstractVoice::processCCEvents(RTList<Event>::Iterator& itEvent, uint End) { |
void AbstractVoice::processCCEvents(RTList<Event>::Iterator& itEvent, uint End) { |
645 |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
646 |
if (itEvent->Type == Event::type_control_change && itEvent->Param.CC.Controller) { // if (valid) MIDI control change event |
if ((itEvent->Type == Event::type_control_change || itEvent->Type == Event::type_channel_pressure) |
647 |
|
&& itEvent->Param.CC.Controller) // if (valid) MIDI control change event |
648 |
|
{ |
649 |
if (itEvent->Param.CC.Controller == VCFCutoffCtrl.controller) { |
if (itEvent->Param.CC.Controller == VCFCutoffCtrl.controller) { |
650 |
ProcessCutoffEvent(itEvent); |
ProcessCutoffEvent(itEvent); |
651 |
} |
} |
652 |
if (itEvent->Param.CC.Controller == VCFResonanceCtrl.controller) { |
if (itEvent->Param.CC.Controller == VCFResonanceCtrl.controller) { |
653 |
processResonanceEvent(itEvent); |
processResonanceEvent(itEvent); |
654 |
} |
} |
655 |
|
if (itEvent->Param.CC.Controller == CTRL_TABLE_IDX_AFTERTOUCH || |
656 |
|
itEvent->Type == Event::type_channel_pressure) |
657 |
|
{ |
658 |
|
ProcessChannelPressureEvent(itEvent); |
659 |
|
} |
660 |
if (pSignalUnitRack == NULL) { |
if (pSignalUnitRack == NULL) { |
661 |
if (itEvent->Param.CC.Controller == pLFO1->ExtController) { |
if (itEvent->Param.CC.Controller == pLFO1->ExtController) { |
662 |
pLFO1->update(itEvent->Param.CC.Value); |
pLFO1->update(itEvent->Param.CC.Value); |
675 |
} |
} |
676 |
} else if (itEvent->Type == Event::type_pitchbend) { // if pitch bend event |
} else if (itEvent->Type == Event::type_pitchbend) { // if pitch bend event |
677 |
processPitchEvent(itEvent); |
processPitchEvent(itEvent); |
|
} else if (itEvent->Type == Event::type_channel_pressure) { |
|
|
ProcessChannelPressureEvent(itEvent); |
|
678 |
} else if (itEvent->Type == Event::type_note_pressure) { |
} else if (itEvent->Type == Event::type_note_pressure) { |
679 |
ProcessPolyphonicKeyPressureEvent(itEvent); |
ProcessPolyphonicKeyPressureEvent(itEvent); |
680 |
} |
} |
749 |
case Event::synth_param_resonance: |
case Event::synth_param_resonance: |
750 |
NoteResonance = itEvent->Param.NoteSynthParam.AbsValue; |
NoteResonance = itEvent->Param.NoteSynthParam.AbsValue; |
751 |
break; |
break; |
752 |
|
|
753 |
|
case Event::synth_param_attack: |
754 |
|
case Event::synth_param_decay: |
755 |
|
case Event::synth_param_release: |
756 |
|
break; // noop |
757 |
} |
} |
758 |
} |
} |
759 |
} |
} |