0.40.0 (75): Sampler One-shot (Android and iOS)

- Sampler parameter oneShot (Off/On): note-offs don't release its pads; they
  play their whole slice. Transport stop/pause still releases (SampleVoice::
  release), panic kills
- Engine in core/ and the Kotlin reference both implement it; the golden
  Sampler "high" scenario covers it; oneshot_test checks MIDI, song, stop, panic
- ONE-SHOT toggle in both apps' Sampler editors; specs and layouts regenerated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-16 16:53:13 +01:00
co-authored by Claude Opus 5.5
parent 5240019b47
commit 7041f762e5
17 changed files with 182 additions and 16 deletions
+4 -1
View File
@@ -855,6 +855,7 @@ void Engine::Impl::playNote(Project &proj, int bus, int note, int velocity, int
v.ownerTrack = ownerTrack;
v.noteOn(*vs.sample, note, velocity, vs.root, vs.sliceStart, vs.sliceEnd, vs.volume,
vs.attack, vs.decay, vs.sustain, vs.release, vs.loop, vs.crossfadeMs);
v.oneShot = vs.oneShot;
} else if (!hasType(slot) || is(slot, "SAMPLER")) {
// Empty bus or a Sampler with an empty pad: silent.
} else if (is(slot, "GRAIN_CLOUD")) {
@@ -926,6 +927,7 @@ void Engine::Impl::auditionSlotOn(int slotIndex, int midi) {
if (!v) { v = auditionSampleVoices[0].get(); v->kill(); }
v->noteOn(*vs.sample, midi, 110, vs.root, vs.sliceStart, vs.sliceEnd, vs.volume,
vs.attack, vs.decay, vs.sustain, vs.release, vs.loop, vs.crossfadeMs);
v->oneShot = vs.oneShot;
return;
}
if (is(slot, "SAMPLER")) return;
@@ -972,6 +974,7 @@ void Engine::Impl::busNoteOn(int midiChannel, int midi, int velocity) {
if (!v) { v = busSampleVoices[base].get(); v->kill(); }
v->noteOn(*vs.sample, midi, velocity, vs.root, vs.sliceStart, vs.sliceEnd, vs.volume,
vs.attack, vs.decay, vs.sustain, vs.release, vs.loop, vs.crossfadeMs);
v->oneShot = vs.oneShot;
} else if (is(slot, "SAMPLER")) {
} else if (is(slot, "GRAIN_CLOUD")) {
clouds[ch]->noteOn(midi, velocity, GrainCloud::OWNER_LIVE);
@@ -1146,7 +1149,7 @@ void Engine::Impl::refreshSynthPatches(Project &proj) {
void Engine::Impl::allSeqVoicesOff() {
for (auto &c : clouds) c->releaseSequenced();
for (auto &v : seqVoices) v->noteOff();
for (auto &v : sampleVoices) v->noteOff();
for (auto &v : sampleVoices) v->release(); // a stopped song stops One-shot pads too
for (auto &a : arps) a.stop();
allMidiNotesOff();
}