103 |
Delay = itNoteOnEvent->FragmentPos(); |
Delay = itNoteOnEvent->FragmentPos(); |
104 |
itTriggerEvent = itNoteOnEvent; |
itTriggerEvent = itNoteOnEvent; |
105 |
itKillEvent = Pool<Event>::Iterator(); |
itKillEvent = Pool<Event>::Iterator(); |
106 |
|
MidiKeyBase* pKeyInfo = GetMidiKeyInfo(MIDIKey); |
107 |
|
|
108 |
pGroupEvents = iKeyGroup ? pEngineChannel->ActiveKeyGroups[iKeyGroup] : 0; |
pGroupEvents = iKeyGroup ? pEngineChannel->ActiveKeyGroups[iKeyGroup] : 0; |
109 |
|
|
113 |
|
|
114 |
// calculate volume |
// calculate volume |
115 |
const double velocityAttenuation = GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity); |
const double velocityAttenuation = GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity); |
116 |
float volume = CalculateVolume(velocityAttenuation); |
float volume = CalculateVolume(velocityAttenuation) * pKeyInfo->Volume; |
117 |
if (volume <= 0) return -1; |
if (volume <= 0) return -1; |
118 |
|
|
119 |
// select channel mode (mono or stereo) |
// select channel mode (mono or stereo) |
124 |
// get starting crossfade volume level |
// get starting crossfade volume level |
125 |
float crossfadeVolume = CalculateCrossfadeVolume(itNoteOnEvent->Param.Note.Velocity); |
float crossfadeVolume = CalculateCrossfadeVolume(itNoteOnEvent->Param.Note.Velocity); |
126 |
|
|
127 |
VolumeLeft = volume * AbstractEngine::PanCurve[64 - RgnInfo.Pan]; |
VolumeLeft = volume * pKeyInfo->PanLeft * AbstractEngine::PanCurve[64 - RgnInfo.Pan]; |
128 |
VolumeRight = volume * AbstractEngine::PanCurve[64 + RgnInfo.Pan]; |
VolumeRight = volume * pKeyInfo->PanRight * AbstractEngine::PanCurve[64 + RgnInfo.Pan]; |
129 |
|
|
130 |
float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; |
float subfragmentRate = GetEngine()->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; |
131 |
CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); |
CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); |
307 |
*/ |
*/ |
308 |
void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) { |
void AbstractVoice::Synthesize(uint Samples, sample_t* pSrc, uint Skip) { |
309 |
AbstractEngineChannel* pChannel = pEngineChannel; |
AbstractEngineChannel* pChannel = pEngineChannel; |
310 |
finalSynthesisParameters.pOutLeft = &pChannel->pChannelLeft->Buffer()[Skip]; |
MidiKeyBase* pMidiKeyInfo = GetMidiKeyInfo(MIDIKey); |
311 |
finalSynthesisParameters.pOutRight = &pChannel->pChannelRight->Buffer()[Skip]; |
|
312 |
finalSynthesisParameters.pSrc = pSrc; |
const bool bVoiceRequiresDedicatedRouting = |
313 |
|
pEngineChannel->GetFxSendCount() > 0 && |
314 |
|
(pMidiKeyInfo->ReverbSend || pMidiKeyInfo->ChorusSend); |
315 |
|
|
316 |
|
if (bVoiceRequiresDedicatedRouting) { |
317 |
|
finalSynthesisParameters.pOutLeft = &GetEngine()->pDedicatedVoiceChannelLeft->Buffer()[Skip]; |
318 |
|
finalSynthesisParameters.pOutRight = &GetEngine()->pDedicatedVoiceChannelRight->Buffer()[Skip]; |
319 |
|
} else { |
320 |
|
finalSynthesisParameters.pOutLeft = &pChannel->pChannelLeft->Buffer()[Skip]; |
321 |
|
finalSynthesisParameters.pOutRight = &pChannel->pChannelRight->Buffer()[Skip]; |
322 |
|
} |
323 |
|
finalSynthesisParameters.pSrc = pSrc; |
324 |
|
|
325 |
RTList<Event>::Iterator itCCEvent = pChannel->pEvents->first(); |
RTList<Event>::Iterator itCCEvent = pChannel->pEvents->first(); |
326 |
RTList<Event>::Iterator itNoteEvent; |
RTList<Event>::Iterator itNoteEvent; |
483 |
Pos = newPos; |
Pos = newPos; |
484 |
i = iSubFragmentEnd; |
i = iSubFragmentEnd; |
485 |
} |
} |
486 |
|
|
487 |
|
if (bVoiceRequiresDedicatedRouting) { |
488 |
|
optional<float> effectSendLevels[2] = { |
489 |
|
pMidiKeyInfo->ReverbSend, |
490 |
|
pMidiKeyInfo->ChorusSend |
491 |
|
}; |
492 |
|
GetEngine()->RouteDedicatedVoiceChannels(pEngineChannel, effectSendLevels, Samples); |
493 |
|
} |
494 |
} |
} |
495 |
|
|
496 |
/** |
/** |