Move the crossfade curve config to the config
This commit is contained in:
parent
cab43b6641
commit
24624abef1
2 changed files with 11 additions and 13 deletions
|
|
@ -126,6 +126,10 @@ namespace config {
|
|||
@brief Ratio to target under which smoothing is considered as completed
|
||||
*/
|
||||
static constexpr float smoothingShortcutThreshold = 5e-3;
|
||||
// loop crossfade settings
|
||||
static constexpr int loopXfadeCurve = 2; // 0: linear
|
||||
// 1: use curves 5 & 6
|
||||
// 2: use S-shaped curve
|
||||
} // namespace config
|
||||
|
||||
} // namespace sfz
|
||||
|
|
|
|||
|
|
@ -588,8 +588,7 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
partitionStarts = absl::MakeSpan(const_cast<int*>(starts), 1);
|
||||
partitionTypes = absl::MakeSpan(const_cast<int*>(types), 1);
|
||||
numPartitions = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (auto& buf : partitionBuffers) {
|
||||
buf = resources.bufferPool.getIndexBuffer(numSamples);
|
||||
if (!buf)
|
||||
|
|
@ -601,11 +600,6 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
// computed along with index processing below
|
||||
}
|
||||
|
||||
// loop crossfade settings
|
||||
constexpr int loopXfadeUseCurves = 2; // 0: linear
|
||||
// 1: use curves 5 & 6
|
||||
// 2: use S-shaped curve
|
||||
|
||||
// index preprocessing for loops
|
||||
if (isLooping) {
|
||||
int oldIndex {};
|
||||
|
|
@ -699,17 +693,17 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
{
|
||||
// compute out curve
|
||||
absl::Span<float> xfCurve = xfTemp2->first(ptSize);
|
||||
IF_CONSTEXPR (loopXfadeUseCurves == 2) {
|
||||
IF_CONSTEXPR (config::loopXfadeCurve == 2) {
|
||||
const Curve& xfIn = getSCurve();
|
||||
for (unsigned i = 0; i < ptSize; ++i)
|
||||
xfCurve[i] = xfIn.evalNormalized(1.0f - xfCurvePos[i]);
|
||||
}
|
||||
else IF_CONSTEXPR (loopXfadeUseCurves == 1) {
|
||||
else IF_CONSTEXPR (config::loopXfadeCurve == 1) {
|
||||
const Curve& xfOut = resources.curves.getCurve(6);
|
||||
for (unsigned i = 0; i < ptSize; ++i)
|
||||
xfCurve[i] = xfOut.evalNormalized(xfCurvePos[i]);
|
||||
}
|
||||
else IF_CONSTEXPR (loopXfadeUseCurves == 0) {
|
||||
else IF_CONSTEXPR (config::loopXfadeCurve == 0) {
|
||||
// TODO(jpc) vectorize this
|
||||
for (unsigned i = 0; i < ptSize; ++i)
|
||||
xfCurve[i] = clamp(1.0f - xfCurvePos[i], 0.0f, 1.0f);
|
||||
|
|
@ -749,17 +743,17 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
|
||||
// compute in curve
|
||||
absl::Span<float> xfCurve = xfTemp2->first(applySize);
|
||||
IF_CONSTEXPR (loopXfadeUseCurves == 2) {
|
||||
IF_CONSTEXPR (config::loopXfadeCurve == 2) {
|
||||
const Curve& xfIn = getSCurve();
|
||||
for (unsigned i = 0; i < applySize; ++i)
|
||||
xfCurve[i] = xfIn.evalNormalized(xfInCurvePos[i]);
|
||||
}
|
||||
else IF_CONSTEXPR (loopXfadeUseCurves == 1) {
|
||||
else IF_CONSTEXPR (config::loopXfadeCurve == 1) {
|
||||
const Curve& xfIn = resources.curves.getCurve(5);
|
||||
for (unsigned i = 0; i < applySize; ++i)
|
||||
xfCurve[i] = xfIn.evalNormalized(xfInCurvePos[i]);
|
||||
}
|
||||
else IF_CONSTEXPR (loopXfadeUseCurves == 0) {
|
||||
else IF_CONSTEXPR (config::loopXfadeCurve == 0) {
|
||||
// TODO(jpc) vectorize this
|
||||
for (unsigned i = 0; i < applySize; ++i)
|
||||
xfCurve[i] = clamp(xfInCurvePos[i], 0.0f, 1.0f);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue