Merged
This commit is contained in:
commit
3887359114
1 changed files with 6 additions and 5 deletions
|
|
@ -749,12 +749,13 @@ float sfz::Region::velocityCurve(uint8_t velocity) const noexcept
|
||||||
float segmentEndpoints { after->second - before->second };
|
float segmentEndpoints { after->second - before->second };
|
||||||
gain *= relativePositionInSegment * segmentEndpoints;
|
gain *= relativePositionInSegment * segmentEndpoints;
|
||||||
} else { // Standard velocity curve
|
} else { // Standard velocity curve
|
||||||
const float floatVelocity { static_cast<float>(velocity) / 127 };
|
const float floatVelocity { static_cast<float>(velocity) / 127.0f };
|
||||||
|
// FIXME: Maybe there's a prettier way to check the boundaries?
|
||||||
const float gaindB = [&]() {
|
const float gaindB = [&]() {
|
||||||
if (ampVeltrack > 0)
|
if (ampVeltrack >= 0)
|
||||||
return 40 * std::log(floatVelocity) / std::log(10.0f);
|
return floatVelocity == 0.0f ? -90.0f : 40 * std::log(floatVelocity) / std::log(10.0f);
|
||||||
else
|
else
|
||||||
return 40 * std::log(1 - floatVelocity) / std::log(10.0f);
|
return floatVelocity == 1.0f ? -90.0f : 40 * std::log(1 - floatVelocity) / std::log(10.0f);
|
||||||
}();
|
}();
|
||||||
gain *= db2mag( gaindB * std::abs(ampVeltrack) / sfz::Default::ampVeltrackRange.getEnd());
|
gain *= db2mag( gaindB * std::abs(ampVeltrack) / sfz::Default::ampVeltrackRange.getEnd());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue