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); |
524 |
pSignalUnitRack->GetEndpointUnit()->CalculatePitch(finalSynthesisParameters.fFinalPitch); |
pSignalUnitRack->GetEndpointUnit()->CalculatePitch(finalSynthesisParameters.fFinalPitch); |
525 |
|
|
526 |
} |
} |
527 |
|
|
528 |
|
fFinalCutoff *= NoteCutoff; |
529 |
|
fFinalResonance *= NoteResonance; |
530 |
|
|
531 |
// limit the pitch so we don't read outside the buffer |
// limit the pitch so we don't read outside the buffer |
532 |
finalSynthesisParameters.fFinalPitch = RTMath::Min(finalSynthesisParameters.fFinalPitch, float(1 << CONFIG_MAX_PITCH)); |
finalSynthesisParameters.fFinalPitch = RTMath::Min(finalSynthesisParameters.fFinalPitch, float(1 << CONFIG_MAX_PITCH)); |
533 |
|
|
696 |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
for (; itEvent && itEvent->FragmentPos() <= End; ++itEvent) { |
697 |
// some voice types ignore note off |
// some voice types ignore note off |
698 |
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))) { |
699 |
if (itEvent->Type == Event::type_release) { |
if (itEvent->Type == Event::type_release_key) { |
700 |
EnterReleaseStage(); |
EnterReleaseStage(); |
701 |
} else if (itEvent->Type == Event::type_cancel_release) { |
} else if (itEvent->Type == Event::type_cancel_release_key) { |
702 |
if (pSignalUnitRack == NULL) { |
if (pSignalUnitRack == NULL) { |
703 |
pEG1->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEG1->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
704 |
pEG2->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEG2->update(EG::event_cancel_release, GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
707 |
} |
} |
708 |
} |
} |
709 |
} |
} |
710 |
|
// process stop-note events (caused by built-in instrument script function note_off()) |
711 |
|
if (itEvent->Type == Event::type_release_note && pNote && |
712 |
|
pEngineChannel->pEngine->NoteByID( itEvent->Param.Note.ID ) == pNote) |
713 |
|
{ |
714 |
|
EnterReleaseStage(); |
715 |
|
} |
716 |
// 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) |
717 |
if (itEvent->Type == Event::type_note_synth_param && pNote && |
if (itEvent->Type == Event::type_note_synth_param && pNote && |
718 |
pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote) |
pEngineChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ) == pNote) |
728 |
NotePanLeft = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/); |
NotePanLeft = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 0 /*left*/); |
729 |
NotePanRight = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 1 /*right*/); |
NotePanRight = AbstractEngine::PanCurveValueNorm(itEvent->Param.NoteSynthParam.AbsValue, 1 /*right*/); |
730 |
break; |
break; |
731 |
|
case Event::synth_param_cutoff: |
732 |
|
NoteCutoff = itEvent->Param.NoteSynthParam.AbsValue; |
733 |
|
break; |
734 |
|
case Event::synth_param_resonance: |
735 |
|
NoteResonance = itEvent->Param.NoteSynthParam.AbsValue; |
736 |
|
break; |
737 |
} |
} |
738 |
} |
} |
739 |
} |
} |