Bake window: derived note lengths carry exact durations, not ladder rungs — a long take is no longer cut at 384 beats

Hold keeps its picker. Also: one home for the %-fold, duration-ordered Hold travel, and a corrupt tail degrades to absent rather than fabricating one.
This commit is contained in:
2026-08-01 21:10:38 -04:00
parent 19aeb92775
commit 65f6070348
35 changed files with 772 additions and 226 deletions
+7 -8
View File
@@ -6,8 +6,6 @@
#include <algorithm>
#include "core/instrument/map/trigger_seam.h" // effectiveLengthFraction (the one %-length rule)
namespace reasampler {
void Voice::presizePreserveShifters(std::int64_t windowFrames) {
@@ -103,12 +101,13 @@ void Voice::start(int note, int velocity, const SampleData& sample, bool declick
env_.noteOn();
playEnd_ = 0; // unused in Gate
} else {
// Trigger: play [start, playEnd) where playEnd = start + round(frac*(frames-start)).
// The spline fold lives in effectiveLengthFraction (trigger_seam.h), which the bake's
// window derivation reads too — a second copy of it here is what let a stored-but-inert
// %-knob shorten the bake while the voice played the whole take.
double frac = instrument::map::effectiveLengthFraction(p);
if (frac <= 0.0) frac = 0.0; // %=0 -> zero play length (finishes immediately)
// Trigger: play [start, playEnd) where playEnd = start + round(frac*(frames-start))
// map/trigger_seam.h's formula, evaluated inline because the engine does not depend on
// map/. The spline fold is effectiveLengthFraction (play_params.h); a second copy of it
// here is what let a stored-but-inert %-knob shorten the bake while the voice played
// the whole take.
double frac = effectiveLengthFraction(p);
if (!(frac > 0.0)) frac = 0.0; // %=0 (or a corrupt NaN) -> finishes immediately
if (frac > 1.0) frac = 1.0;
std::int64_t playLen = static_cast<std::int64_t>(
static_cast<double>(postStart) * frac + 0.5); // round