256 |
void CCUnit::Trigger() { |
void CCUnit::Trigger() { |
257 |
for (int i = 0; i < Ctrls.size(); i++) { |
for (int i = 0; i < Ctrls.size(); i++) { |
258 |
Ctrls[i].Value = pVoice->GetControllerValue(Ctrls[i].Controller); |
Ctrls[i].Value = pVoice->GetControllerValue(Ctrls[i].Controller); |
259 |
|
if (Ctrls[i].pSmoother != NULL) Ctrls[i].pSmoother->setValue(Ctrls[i].Value); |
260 |
} |
} |
261 |
CCSignalUnit::Trigger(); |
CCSignalUnit::Trigger(); |
262 |
} |
} |
271 |
void CCUnit::SetCCs(ArrayList< ::sfz::CC>& cc) { |
void CCUnit::SetCCs(ArrayList< ::sfz::CC>& cc) { |
272 |
RemoveAllCCs(); |
RemoveAllCCs(); |
273 |
for (int i = 0; i < cc.size(); i++) { |
for (int i = 0; i < cc.size(); i++) { |
274 |
if (cc[i].Influence != 0) AddCC(cc[i].Controller, cc[i].Influence); |
if (cc[i].Influence != 0) { |
275 |
|
short int curve = cc[i].Curve; |
276 |
|
if (curve >= GetCurveCount()) curve = -1; |
277 |
|
AddSmoothCC(cc[i].Controller, cc[i].Influence, curve, cc[i].Smooth); |
278 |
|
} |
279 |
|
} |
280 |
|
} |
281 |
|
|
282 |
|
void CCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) { |
283 |
|
AddCC(Controller, Influence, Curve); |
284 |
|
} |
285 |
|
|
286 |
|
int CCUnit::GetCurveCount() { |
287 |
|
return pVoice->pRegion->GetInstrument()->curves.size(); |
288 |
|
} |
289 |
|
|
290 |
|
::sfz::Curve* CCUnit::GetCurve(int idx) { |
291 |
|
return &pVoice->pRegion->GetInstrument()->curves[idx]; |
292 |
|
} |
293 |
|
|
294 |
|
double CCUnit::GetSampleRate() { |
295 |
|
return pVoice->GetSampleRate() / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; |
296 |
|
} |
297 |
|
|
298 |
|
void SmoothCCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) { |
299 |
|
if (Smooth > 0) { |
300 |
|
Smoothers[Controller].trigger(Smooth / 1000.0f, GetSampleRate()); |
301 |
|
AddCC(Controller, Influence, Curve, &Smoothers[Controller]); |
302 |
|
} else { |
303 |
|
AddCC(Controller, Influence, Curve); |
304 |
} |
} |
305 |
} |
} |
306 |
|
|
341 |
AmpLFOUnit* u = &(GetRack()->suAmpLFO); |
AmpLFOUnit* u = &(GetRack()->suAmpLFO); |
342 |
vol *= u->Active() ? ::sf2::ToRatio((u->GetLevel() * u->pLfoInfo->volume) * 10.0) : 1; |
vol *= u->Active() ? ::sf2::ToRatio((u->GetLevel() * u->pLfoInfo->volume) * 10.0) : 1; |
343 |
|
|
344 |
|
vol *= ::sf2::ToRatio(GetRack()->suVolOnCC.GetLevel() * 10.0); |
345 |
|
|
346 |
return vol; |
return vol; |
347 |
} |
} |
348 |
|
|
419 |
|
|
420 |
SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice) |
SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice) |
421 |
: SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this), |
: SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this), |
422 |
EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), |
EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), suVolOnCC(this), |
423 |
suAmpLFO(this), suPitchLFO(this), suFilLFO(this), |
suAmpLFO(this), suPitchLFO(this), suFilLFO(this), |
424 |
LFOs(maxLfoCount), pitchLFOs(maxLfoCount), filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount) |
LFOs(maxLfoCount), pitchLFOs(maxLfoCount), filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount) |
425 |
{ |
{ |
426 |
suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice; |
suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice; |
427 |
suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice; |
suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = suVolOnCC.pVoice = voice; |
428 |
suPitchLFO.suDepthCC.pVoice = suPitchLFO.suFadeEG.pVoice = suPitchLFO.suFreqOnCC.pVoice = voice; |
suPitchLFO.suDepthCC.pVoice = suPitchLFO.suFadeEG.pVoice = suPitchLFO.suFreqOnCC.pVoice = voice; |
429 |
suFilLFO.suFadeEG.pVoice = suFilLFO.suFreqOnCC.pVoice = voice; |
suFilLFO.suFadeEG.pVoice = suFilLFO.suFreqOnCC.pVoice = voice; |
430 |
suAmpLFO.suFadeEG.pVoice = suAmpLFO.suFreqOnCC.pVoice = voice; |
suAmpLFO.suFadeEG.pVoice = suAmpLFO.suFreqOnCC.pVoice = voice; |
466 |
|
|
467 |
::sfz::Region* const pRegion = pVoice->pRegion; |
::sfz::Region* const pRegion = pVoice->pRegion; |
468 |
|
|
469 |
|
suVolOnCC.SetCCs(pRegion->volume_oncc); |
470 |
|
|
471 |
for (int i = 0; i < pRegion->eg.size(); i++) { |
for (int i = 0; i < pRegion->eg.size(); i++) { |
472 |
if (pRegion->eg[i].node.size() == 0) continue; |
if (pRegion->eg[i].node.size() == 0) continue; |
473 |
|
|
530 |
|
|
531 |
Units.clear(); |
Units.clear(); |
532 |
|
|
533 |
|
Units.add(&suVolOnCC); |
534 |
|
|
535 |
Units.add(&suVolEG); |
Units.add(&suVolEG); |
536 |
Units.add(&suFilEG); |
Units.add(&suFilEG); |
537 |
Units.add(&suPitchEG); |
Units.add(&suPitchEG); |