S11: waveform view with draggable start/loop markers + zero-crossing snap

Pure waveform_view module (frame<->pixel markers, zero-crossing snap); per-zone
loop/start overrides on PerformanceZone with self-versioning zone payload; core
start-point read offset; editor waveform surface with drag machine.
This commit is contained in:
2026-07-26 21:26:23 -04:00
parent ee82b50fb7
commit 9743547dff
12 changed files with 1052 additions and 36 deletions
+8 -1
View File
@@ -151,7 +151,14 @@ void Voice::start(int note, int velocity, const SampleData& sample, int rootNote
if (v > 127) v = 127;
velocityGain_ = static_cast<double>(v) / 127.0;
ratio_ = pitchRatio(note, rootNote);
readPos_ = 0.0;
// Initial read position honors the sample's start-point offset (S11). Clamp into
// [0, frames): a start at or past the end degrades to 0 (play from the top) rather
// than starting a voice already off the end. A negative start (shouldn't occur —
// the map clamps) is likewise pinned to 0.
const std::int64_t frameCount = static_cast<std::int64_t>(sample.frames.size());
std::int64_t start = sample.startFrame;
if (start < 0 || start >= frameCount) start = 0;
readPos_ = static_cast<double>(start);
sample_ = &sample;
env_.configure(adsr);
env_.noteOn();