99 |
|
|
100 |
Type = VoiceType; |
Type = VoiceType; |
101 |
MIDIKey = itNoteOnEvent->Param.Note.Key; |
MIDIKey = itNoteOnEvent->Param.Note.Key; |
102 |
|
MIDIVelocity = itNoteOnEvent->Param.Note.Velocity; |
103 |
|
MIDIPan = pEngineChannel->ControllerTable[10]; |
104 |
|
if (MIDIPan == 0 && pEngineChannel->GlobalPanRight == 1) MIDIPan = 64; // workaround used to determine whether the MIDI pan has not been set |
105 |
PlaybackState = playback_state_init; // mark voice as triggered, but no audio rendered yet |
PlaybackState = playback_state_init; // mark voice as triggered, but no audio rendered yet |
106 |
Delay = itNoteOnEvent->FragmentPos(); |
Delay = itNoteOnEvent->FragmentPos(); |
107 |
itTriggerEvent = itNoteOnEvent; |
itTriggerEvent = itNoteOnEvent; |
318 |
const bool bVoiceRequiresDedicatedRouting = |
const bool bVoiceRequiresDedicatedRouting = |
319 |
pEngineChannel->GetFxSendCount() > 0 && |
pEngineChannel->GetFxSendCount() > 0 && |
320 |
(pMidiKeyInfo->ReverbSend || pMidiKeyInfo->ChorusSend); |
(pMidiKeyInfo->ReverbSend || pMidiKeyInfo->ChorusSend); |
321 |
|
|
322 |
|
const bool bEq = |
323 |
|
pSignalUnitRack != NULL && pSignalUnitRack->HasEq() && GetEngine()->pEq->HasSupport(); |
324 |
|
|
325 |
if (bVoiceRequiresDedicatedRouting) { |
if (bEq) { |
326 |
|
GetEngine()->pEq->GetInChannelLeft()->Clear(); |
327 |
|
GetEngine()->pEq->GetInChannelRight()->Clear(); |
328 |
|
finalSynthesisParameters.pOutLeft = &GetEngine()->pEq->GetInChannelLeft()->Buffer()[Skip]; |
329 |
|
finalSynthesisParameters.pOutRight = &GetEngine()->pEq->GetInChannelRight()->Buffer()[Skip]; |
330 |
|
pSignalUnitRack->UpdateEqSettings(GetEngine()->pEq); |
331 |
|
} else if (bVoiceRequiresDedicatedRouting) { |
332 |
finalSynthesisParameters.pOutLeft = &GetEngine()->pDedicatedVoiceChannelLeft->Buffer()[Skip]; |
finalSynthesisParameters.pOutLeft = &GetEngine()->pDedicatedVoiceChannelLeft->Buffer()[Skip]; |
333 |
finalSynthesisParameters.pOutRight = &GetEngine()->pDedicatedVoiceChannelRight->Buffer()[Skip]; |
finalSynthesisParameters.pOutRight = &GetEngine()->pDedicatedVoiceChannelRight->Buffer()[Skip]; |
334 |
} else { |
} else { |
389 |
|
|
390 |
// process MIDI control change and pitchbend events for this subfragment |
// process MIDI control change and pitchbend events for this subfragment |
391 |
processCCEvents(itCCEvent, iSubFragmentEnd); |
processCCEvents(itCCEvent, iSubFragmentEnd); |
392 |
|
uint8_t pan = MIDIPan; |
393 |
|
if (pSignalUnitRack != NULL) pan = pSignalUnitRack->GetEndpointUnit()->CaluclatePan(pan); |
394 |
|
|
395 |
|
PanLeftSmoother.update(AbstractEngine::PanCurve[128 - pan]); |
396 |
|
PanRightSmoother.update(AbstractEngine::PanCurve[pan]); |
397 |
|
|
398 |
finalSynthesisParameters.fFinalPitch = Pitch.PitchBase * Pitch.PitchBend; |
finalSynthesisParameters.fFinalPitch = Pitch.PitchBase * Pitch.PitchBend; |
399 |
float fFinalVolume = VolumeSmoother.render() * CrossfadeSmoother.render(); |
float fFinalVolume = VolumeSmoother.render() * CrossfadeSmoother.render(); |
547 |
} |
} |
548 |
|
|
549 |
if (bVoiceRequiresDedicatedRouting) { |
if (bVoiceRequiresDedicatedRouting) { |
550 |
|
if (bEq) { |
551 |
|
GetEngine()->pEq->RenderAudio(Samples); |
552 |
|
GetEngine()->pEq->GetOutChannelLeft()->CopyTo(GetEngine()->pDedicatedVoiceChannelLeft, Samples); |
553 |
|
GetEngine()->pEq->GetOutChannelRight()->CopyTo(GetEngine()->pDedicatedVoiceChannelRight, Samples); |
554 |
|
} |
555 |
optional<float> effectSendLevels[2] = { |
optional<float> effectSendLevels[2] = { |
556 |
pMidiKeyInfo->ReverbSend, |
pMidiKeyInfo->ReverbSend, |
557 |
pMidiKeyInfo->ChorusSend |
pMidiKeyInfo->ChorusSend |
558 |
}; |
}; |
559 |
GetEngine()->RouteDedicatedVoiceChannels(pEngineChannel, effectSendLevels, Samples); |
GetEngine()->RouteDedicatedVoiceChannels(pEngineChannel, effectSendLevels, Samples); |
560 |
|
} else if (bEq) { |
561 |
|
GetEngine()->pEq->RenderAudio(Samples); |
562 |
|
GetEngine()->pEq->GetOutChannelLeft()->CopyTo(pChannel->pChannelLeft, Samples); |
563 |
|
GetEngine()->pEq->GetOutChannelRight()->CopyTo(pChannel->pChannelRight, Samples); |
564 |
} |
} |
565 |
} |
} |
566 |
|
|
594 |
if (itEvent->Param.CC.Controller == 7) { // volume |
if (itEvent->Param.CC.Controller == 7) { // volume |
595 |
VolumeSmoother.update(AbstractEngine::VolumeCurve[itEvent->Param.CC.Value]); |
VolumeSmoother.update(AbstractEngine::VolumeCurve[itEvent->Param.CC.Value]); |
596 |
} else if (itEvent->Param.CC.Controller == 10) { // panpot |
} else if (itEvent->Param.CC.Controller == 10) { // panpot |
597 |
PanLeftSmoother.update(AbstractEngine::PanCurve[128 - itEvent->Param.CC.Value]); |
MIDIPan = itEvent->Param.CC.Value; |
|
PanRightSmoother.update(AbstractEngine::PanCurve[itEvent->Param.CC.Value]); |
|
598 |
} |
} |
599 |
} else if (itEvent->Type == Event::type_pitchbend) { // if pitch bend event |
} else if (itEvent->Type == Event::type_pitchbend) { // if pitch bend event |
600 |
processPitchEvent(itEvent); |
processPitchEvent(itEvent); |