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 |