Files
reasampler/src/core/instrument/map/trigger_seam.cpp
T
daniel 65f6070348 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.
2026-08-01 21:10:38 -04:00

20 lines
759 B
C++

// trigger_seam.cpp — see trigger_seam.h.
#include "core/instrument/map/trigger_seam.h"
#include <algorithm>
namespace reasampler::instrument::map {
std::int64_t triggerPlayLength(double lengthFraction,
std::int64_t frameCount,
std::int64_t startFrame) {
const std::int64_t postStart = (std::max)(std::int64_t{0}, frameCount - startFrame);
if (postStart <= 0 || !(lengthFraction > 0.0)) return 0; // also catches NaN
const double frac = (std::min)(1.0, lengthFraction);
const auto len = static_cast<std::int64_t>(frac * static_cast<double>(postStart) + 0.5);
return (std::min)(postStart, (std::max)(std::int64_t{0}, len));
}
} // namespace reasampler::instrument::map