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 |
} |
} |
274 |
if (cc[i].Influence != 0) { |
if (cc[i].Influence != 0) { |
275 |
short int curve = cc[i].Curve; |
short int curve = cc[i].Curve; |
276 |
if (curve >= GetCurveCount()) curve = -1; |
if (curve >= GetCurveCount()) curve = -1; |
277 |
AddCC(cc[i].Controller, cc[i].Influence, curve); |
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() { |
int CCUnit::GetCurveCount() { |
287 |
return pVoice->pRegion->GetInstrument()->curves.size(); |
return pVoice->pRegion->GetInstrument()->curves.size(); |
288 |
} |
} |
290 |
::sfz::Curve* CCUnit::GetCurve(int idx) { |
::sfz::Curve* CCUnit::GetCurve(int idx) { |
291 |
return &pVoice->pRegion->GetInstrument()->curves[idx]; |
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 |
|
|
307 |
|
|
308 |
EndpointUnit::EndpointUnit(SfzSignalUnitRack* rack): EndpointSignalUnit(rack) { |
EndpointUnit::EndpointUnit(SfzSignalUnitRack* rack): EndpointSignalUnit(rack) { |