187 |
|
|
188 |
Pitch = CalculatePitchInfo(PitchBend); |
Pitch = CalculatePitchInfo(PitchBend); |
189 |
NotePitch = (pNote) ? pNote->Override.Pitch : 1.0f; |
NotePitch = (pNote) ? pNote->Override.Pitch : 1.0f; |
190 |
|
NoteCutoff = (pNote) ? pNote->Override.Cutoff : 1.0f; |
191 |
|
NoteResonance = (pNote) ? pNote->Override.Resonance : 1.0f; |
192 |
|
|
193 |
// the length of the decay and release curves are dependent on the velocity |
// the length of the decay and release curves are dependent on the velocity |
194 |
const double velrelease = 1 / GetVelocityRelease(itNoteOnEvent->Param.Note.Velocity); |
const double velrelease = 1 / GetVelocityRelease(itNoteOnEvent->Param.Note.Velocity); |
200 |
// calculate influence of EG1 controller on EG1's parameters |
// calculate influence of EG1 controller on EG1's parameters |
201 |
EGInfo egInfo = CalculateEG1ControllerInfluence(eg1controllervalue); |
EGInfo egInfo = CalculateEG1ControllerInfluence(eg1controllervalue); |
202 |
|
|
203 |
|
if (pNote) { |
204 |
|
egInfo.Attack *= pNote->Override.Attack; |
205 |
|
egInfo.Decay *= pNote->Override.Decay; |
206 |
|
egInfo.Release *= pNote->Override.Release; |
207 |
|
} |
208 |
|
|
209 |
TriggerEG1(egInfo, velrelease, velocityAttenuation, GetEngine()->SampleRate, itNoteOnEvent->Param.Note.Velocity); |
TriggerEG1(egInfo, velrelease, velocityAttenuation, GetEngine()->SampleRate, itNoteOnEvent->Param.Note.Velocity); |
210 |
} else { |
} else { |
211 |
pSignalUnitRack->Trigger(); |
pSignalUnitRack->Trigger(); |
530 |
pSignalUnitRack->GetEndpointUnit()->CalculatePitch(finalSynthesisParameters.fFinalPitch); |
pSignalUnitRack->GetEndpointUnit()->CalculatePitch(finalSynthesisParameters.fFinalPitch); |
531 |
|
|
532 |
} |
} |
533 |
|
|
534 |
|
fFinalCutoff *= NoteCutoff; |
535 |
|
fFinalResonance *= NoteResonance; |
536 |
|
|
537 |
// limit the pitch so we don't read outside the buffer |
// limit the pitch so we don't read outside the buffer |
538 |
finalSynthesisParameters.fFinalPitch = RTMath::Min(finalSynthesisParameters.fFinalPitch, float(1 << CONFIG_MAX_PITCH)); |
finalSynthesisParameters.fFinalPitch = RTMath::Min(finalSynthesisParameters.fFinalPitch, float(1 << CONFIG_MAX_PITCH)); |
539 |
|
|
702 |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
703 |
// some voice types ignore note off |
// some voice types ignore note off |
704 |
if (!(Type & (Voice::type_one_shot | Voice::type_release_trigger | Voice::type_controller_triggered))) { |
if (!(Type & (Voice::type_one_shot | Voice::type_release_trigger | Voice::type_controller_triggered))) { |
705 |
if (itEvent->Type == Event::type_release) { |
if (itEvent->Type == Event::type_release_key) { |
706 |
EnterReleaseStage(); |
EnterReleaseStage(); |
707 |
} else if (itEvent->Type == Event::type_cancel_release) { |
} else if (itEvent->Type == Event::type_cancel_release_key) { |
708 |
if (pSignalUnitRack == NULL) { |
if (pSignalUnitRack == NULL) { |
709 |
pEG1->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEG1->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
710 |
pEG2->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEG2->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
713 |
} |
} |
714 |
} |
} |
715 |
} |
} |
716 |
|
// process stop-note events (caused by built-in instrument script function note_off()) |
717 |
|
if (itEvent->Type == Event::type_release_note && pNote && |
718 |
|
pEngineChannel->pEngine->NoteByID( itEvent->Param.Note.ID ) == pNote) |
719 |
|
{ |
720 |
|
EnterReleaseStage(); |
721 |
|
} |
722 |
// process synthesis parameter events (caused by built-in realt-time instrument script functions) |
// process synthesis parameter events (caused by built-in realt-time instrument script functions) |
723 |
if (itEvent->Type == Event::type_note_synth_param && pNote && |
if (itEvent->Type == Event::type_note_synth_param && pNote && |
724 |
pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote) |
pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote) |
734 |
NotePanLeft = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/); |
NotePanLeft = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/); |
735 |
NotePanRight = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 1 /*right*/); |
NotePanRight = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 1 /*right*/); |
736 |
break; |
break; |
737 |
|
case Event::synth_param_cutoff: |
738 |
|
NoteCutoff = itEvent->Param.NoteSynthParam.AbsValue; |
739 |
|
break; |
740 |
|
case Event::synth_param_resonance: |
741 |
|
NoteResonance = itEvent->Param.NoteSynthParam.AbsValue; |
742 |
|
break; |
743 |
} |
} |
744 |
} |
} |
745 |
} |
} |