Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
(fix) Drum Rack pads play as one-shots, pad clicks play only their rack, warp off keeps the markers (#321)
Chris Laupama80ef770db62a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e20c7241..490e3134 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -37,6 +37,14 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.at full detail instead of in blocks.### Fixed+- **Drum Rack pads play their whole hit** (nota-daw/nota#312): a pad with a sample that isn't+ looped plays as a one-shot, however short the MIDI note, instead of cutting off at note-off.+ A looped sample, a mono Sampler or a synth on a pad still stops with the note.+- **Clicking a Drum Rack pad plays only the rack** (nota-daw/nota#307): an armed track no+ longer sounds along when you click pads in the pad grid or the Pattern tab.+- **Warp off keeps the markers** (nota-daw/nota#310): turning Warp off and on again gives the+ clip back its markers instead of a fresh straight warp, through undo, save and reload too. A+ clip split or trimmed while warp is off starts over with new markers for its new region.- **⌘G on a device, follow-ups** (nota-daw/nota#257): grouping a playing effect no longerresets it (a Reverb kept ringing cut off), an effect an Arp's CC lane drives stays out of arack instead of losing that link, and ⌘⇧G or undo gives the device back its A/B snapshotsdiff --git a/src/managed/Nota.App/DeviceCards/Rack/RackCardView.Drum.cs b/src/managed/Nota.App/DeviceCards/Rack/RackCardView.Drum.csindex b3ed3d78..9dac05c6 100644--- a/src/managed/Nota.App/DeviceCards/Rack/RackCardView.Drum.cs+++ b/src/managed/Nota.App/DeviceCards/Rack/RackCardView.Drum.cs@@ -60,7 +60,6 @@ internal sealed partial class RackCardViewpublic Control BuildDrumRackBody(out int padCount){var a = new InstrumentRackAccess(E, T);- E.SetAuditionTrack(T); // so clicking a pad plays it without arming the track_irTick.Clear();var pads = LoadedPads(a);padCount = pads.Count;@@ -260,12 +259,12 @@ internal sealed partial class RackCardViewvar pt = e.GetCurrentPoint(pad).Properties;if (pt.IsRightButtonPressed) { e.Handled = true; ShowPadMenu(a, pad, chain); return; }if (!pt.IsLeftButtonPressed) return;- e.Handled = true; e.Pointer.Capture(pad); E.NoteOn(note, 1.0f);+ e.Handled = true; e.Pointer.Capture(pad); E.TrackNoteOn(T, note, 1.0f); // this rack only, not the armed tracks (#307)};pad.PointerReleased += (_, e) =>{if (e.InitialPressMouseButton != MouseButton.Left) return;- E.NoteOff(note); e.Pointer.Capture(null); SelectPad(chain);+ E.TrackNoteOff(T, note); e.Pointer.Capture(null); SelectPad(chain);};}elsediff --git a/src/managed/Nota.App/DeviceChainView.cs b/src/managed/Nota.App/DeviceChainView.csindex 2e15dd2e..a8416a46 100644--- a/src/managed/Nota.App/DeviceChainView.cs+++ b/src/managed/Nota.App/DeviceChainView.cs@@ -183,7 +183,6 @@ public sealed partial class DeviceChainView : UserControl_instLiveViz = null; _instFaders.Clear(); // rebuilt only when a built-in instrument card is shown_deviceLiveRefreshers.Clear(); // compressor GR meter/curve_rackParamRefreshers.Clear(); // rack chain param faders (macro live-follow)- _engine.SetAuditionTrack(-1); // re-armed by the Drum Rack card if shown (pad audition)if (_trackId <= 0) { _row.Children.Add(Hint("Select a track")); return; }// MIDI effects sit before the instrument (they shape the note stream).diff --git a/src/managed/Nota.App/DrumPatternView.cs b/src/managed/Nota.App/DrumPatternView.csindex 8a95f581..f10b5629 100644--- a/src/managed/Nota.App/DrumPatternView.cs+++ b/src/managed/Nota.App/DrumPatternView.cs@@ -412,11 +412,10 @@ public sealed class DrumPatternView : UserControl{e.Handled = true;SelectRow(r);- _e.SetAuditionTrack(TrackId); // audition without arming, as the pad grid does- _e.NoteOn(pad.Note, 1.0f);+ _e.TrackNoteOn(TrackId, pad.Note, 1.0f); // audition this rack only, as the pad grid does (#307)e.Pointer.Capture(cell);};- cell.PointerReleased += (_, e) => { _e.NoteOff(pad.Note); e.Pointer.Capture(null); };+ cell.PointerReleased += (_, e) => { _e.TrackNoteOff(TrackId, pad.Note); e.Pointer.Capture(null); };_nameCells[r] = cell;_nameLabels[r] = name;return cell;diff --git a/src/managed/Nota.Infrastructure/Persistence/AudioClipState.cs b/src/managed/Nota.Infrastructure/Persistence/AudioClipState.csindex 2d0639f5..91a59a8a 100644--- a/src/managed/Nota.Infrastructure/Persistence/AudioClipState.cs+++ b/src/managed/Nota.Infrastructure/Persistence/AudioClipState.cs@@ -29,7 +29,8 @@ internal static class AudioClipStateWarpPlayEnd = ac.WarpPlayEnd,Reversed = ac.Reversed != 0,};- if (ac.WarpEnabled != 0)+ // Warp off keeps its markers for a later re-enable (#310), so they're saved either way.+ if (ac.WarpEnabled != 0 || ac.WarpBeats > 0){var ms = new double[128]; var mb = new double[128];int nm = Math.Min(engine.GetClipWarpMarkers(trackId, clipIndex, ms, mb), 128);@@ -66,19 +67,24 @@ internal static class AudioClipState{if (ac.PitchSemitones != 0) engine.SetClipPitch(trackId, ci, ac.PitchSemitones);if (ac.Reversed) engine.SetClipReverse(trackId, ci, true); // reverse (v19)+ // Markers go on first: warp then switches on with them as they were (no tempo+ // detection), and a warp-off clip keeps them for a later re-enable (#310).+ bool markers = ac.WarpMarkers is { Count: >= 2 };+ if (markers)+ {+ var wm = ac.WarpMarkers!;+ var ms = new double[wm.Count]; var mb = new double[wm.Count];+ for (int k = 0; k < wm.Count; k++) { ms[k] = wm[k].Src; mb[k] = wm[k].Beat; }+ engine.SetClipWarpMarkers(trackId, ci, ms, mb); // also sets warpBeats from the last marker+ }if (ac.WarpEnabled != 0){engine.SetClipWarp(trackId, ci, true, ac.WarpMode);- if (ac.WarpMarkers is { Count: >= 2 } wm)- {- var ms = new double[wm.Count]; var mb = new double[wm.Count];- for (int k = 0; k < wm.Count; k++) { ms[k] = wm[k].Src; mb[k] = wm[k].Beat; }- engine.SetClipWarpMarkers(trackId, ci, ms, mb); // also sets warpBeats from the last marker- }- else if (ac.WarpBeats > 0) engine.SetClipWarpLength(trackId, ci, ac.WarpBeats);- if (ac.WarpPlayEnd > 0) // restore the trim window (v11); 0 = whole warp- engine.SetClipWarpTrim(trackId, ci, ac.WarpPlayStart, ac.WarpPlayEnd);+ if (!markers && ac.WarpBeats > 0) engine.SetClipWarpLength(trackId, ci, ac.WarpBeats);}+ else if (markers) engine.SetClipWarp(trackId, ci, false, ac.WarpMode); // keep the mode for re-enable+ if ((ac.WarpEnabled != 0 || markers) && ac.WarpPlayEnd > 0) // restore the trim window (v11); 0 = whole warp+ engine.SetClipWarpTrim(trackId, ci, ac.WarpPlayStart, ac.WarpPlayEnd);if (ac.VolumeEnvelope is { Length: > 0 } venv) // clip volume envelope (v8)engine.SetClipVolumeEnvelope(trackId, ci, Array.ConvertAll(venv, p => p.ToPoint()));if (ac.PanEnvelope is { Length: > 0 } penv) // clip pan envelope (v9)diff --git a/src/native/nota.engine/src/devices/Instrument.h b/src/native/nota.engine/src/devices/Instrument.hindex fba6b077..4d288da1 100644--- a/src/native/nota.engine/src/devices/Instrument.h+++ b/src/native/nota.engine/src/devices/Instrument.h@@ -66,6 +66,15 @@ class Instrument {// playEvents / deliverExpr). An instrument that models the pedal itself (Keys, Mosaic, a// hosted plug-in) or ignores it on purpose (drums) returns true and is left alone.virtual bool handlesSustain() const { return false; }+ // True while every note it plays ends on its own (a sample that isn't looped), so a+ // note-off would only cut the sound short. A Drum Rack pad then plays its hit as a+ // one-shot, however short the MIDI note (#312); anything that would ring forever+ // without a note-off (a looped sample, a synth) still gets it.+ virtual bool playsOneShot() const { return false; }+ // The note-off a one-shot pad held back. The note still plays through, but if the+ // instrument stops playing one-shots mid-note (its loop turned on), it releases then+ // instead of ringing on.+ virtual void noteOffHeldBack(int32_t /*pitch*/) {}// The engine's damper state for this instrument. Written on the audio thread only; relaxed// atomics because a rack edit forks the rack on the message thread and carries them over.std::atomic<bool> pedalDown{false};diff --git a/src/native/nota.engine/src/devices/instruments/Sampler.cpp b/src/native/nota.engine/src/devices/instruments/Sampler.cppindex 2b0f961d..78534e35 100644--- a/src/native/nota.engine/src/devices/instruments/Sampler.cpp+++ b/src/native/nota.engine/src/devices/instruments/Sampler.cpp@@ -98,6 +98,7 @@ void Sampler::noteOn(int32_t pitch, float velocity) {if (v.active && v.stage != Stage::Release) {v.pitch = pitch;v.velocity = velocity;+ v.keyUp = false; // a new, held key now owns itreturn;}}@@ -112,6 +113,7 @@ void Sampler::noteOn(int32_t pitch, float velocity) {const bool rev = pn_[Reverse].load(std::memory_order_relaxed) > 0.5f;v->active = true;v->stage = Stage::Attack;+ v->keyUp = false;v->env = 0.0f;v->pitch = pitch;v->velocity = velocity;@@ -141,6 +143,11 @@ void Sampler::noteOff(int32_t pitch) {if (v.active && v.pitch == pitch && v.stage != Stage::Release) v.stage = Stage::Release;}+void Sampler::noteOffHeldBack(int32_t pitch) {+ for (auto& v : voices_)+ if (v.active && v.pitch == pitch) v.keyUp = true;+}+void Sampler::allNotesOff() {wake();for (auto& v : voices_) v.active = false;@@ -203,10 +210,13 @@ void Sampler::render(float* out, int32_t frames) {const bool envOn = pn_[EnvCutoff].load(std::memory_order_relaxed) > 0.5f;const double envOct = envOn ? envOctaves(pn_[EnvAmount].load(std::memory_order_relaxed)) : 0.0;+ const bool oneShot = playsOneShot();int nActive = 0;float peak = 0.0f, ownPeak = 0.0f;for (auto& v : voices_) {if (!v.active) continue;+ // A pad's one-shot whose key is already up releases once it would loop.+ if (v.keyUp && !oneShot && v.stage != Stage::Release) v.stage = Stage::Release;++nActive;double inc = 0.0, a1 = 0.0, a2 = 0.0, a3 = 0.0;for (int32_t i = 0; i < frames; ++i) {diff --git a/src/native/nota.engine/src/devices/instruments/Sampler.h b/src/native/nota.engine/src/devices/instruments/Sampler.hindex 578d6348..88c4bec5 100644--- a/src/native/nota.engine/src/devices/instruments/Sampler.h+++ b/src/native/nota.engine/src/devices/instruments/Sampler.h@@ -92,6 +92,9 @@ class Sampler final : public Instrument {int32_t rootNote() const { return rootNote_.load(std::memory_order_relaxed); }void setRoot(int32_t r) { rootNote_.store(std::clamp(r, 0, 127), std::memory_order_relaxed); }bool loopEnabled() const { return loopModeOf() > 0; }+ // Unlooped poly playback ends at the sample's End. Mono / legato keeps a held-note+ // stack that note-offs unwind, so it stays gated.+ bool playsOneShot() const override { return !loopEnabled() && voiceModeOf() != 1; }void setSample(std::shared_ptr<SampleBuffer> s, int32_t rootNote, bool loop);void setSampleRate(double sr) override {@@ -127,6 +130,7 @@ class Sampler final : public Instrument {void noteOn(int32_t pitch, float velocity) override;void noteOff(int32_t pitch) override;+ void noteOffHeldBack(int32_t pitch) override;void allNotesOff() override;void render(float* out, int32_t frames) override;@@ -152,6 +156,7 @@ class Sampler final : public Instrument {float velocity = 0.0f, env = 0.0f;double ic1L = 0, ic2L = 0, ic1R = 0, ic2R = 0;Stage stage = Stage::Attack;+ bool keyUp = false; // its note-off came while it played as a one-shot};Voice* findFreeVoice();// Linear-interpolated stereo read at a fractional sample position. Kept verbatim:diff --git a/src/native/nota.engine/src/devices/racks/DrumRack.cpp b/src/native/nota.engine/src/devices/racks/DrumRack.cppindex e97809ec..0c478055 100644--- a/src/native/nota.engine/src/devices/racks/DrumRack.cpp+++ b/src/native/nota.engine/src/devices/racks/DrumRack.cpp@@ -32,8 +32,12 @@ void DrumRack::noteOff(int32_t pitch) {RackState* st = live();if (!st) return;for (auto& c : st->chains)- if (c.instrument && c.ctl->triggerNote.load(std::memory_order_relaxed) == pitch)- c.instrument->noteOff(tunedNote(*c.ctl, pitch));+ // A pad plays its sample through (#312): the note's length doesn't cut it, only a+ // choke or a retrigger does. A pad that can't end on its own stays gated.+ if (c.instrument && c.ctl->triggerNote.load(std::memory_order_relaxed) == pitch) {+ if (c.instrument->playsOneShot()) c.instrument->noteOffHeldBack(tunedNote(*c.ctl, pitch));+ else c.instrument->noteOff(tunedNote(*c.ctl, pitch));+ }}void DrumRack::allNotesOff() {diff --git a/src/native/nota.engine/src/engine/Engine_Tracks.cpp b/src/native/nota.engine/src/engine/Engine_Tracks.cppindex 10020449..c73d653e 100644--- a/src/native/nota.engine/src/engine/Engine_Tracks.cpp+++ b/src/native/nota.engine/src/engine/Engine_Tracks.cpp@@ -277,6 +277,19 @@ double seedAutoWarp(AudioClip& c, double spb, double devSR, double knownBpm = 0.return bpm;}+// Remember which unwarped region a warp-off clip's markers belong to (see AudioClip).+void stampWarpOffRegion(AudioClip& c) {+ c.warpOffRegionOffset = c.sourceOffsetFrames;+ c.warpOffRegionLength = c.effectiveLength();+}++// A warp-off clip's markers can come back on re-enable only while the region is the one+// they were stamped with — a split or trim made with warp off has moved it since.+bool warpMarkersRestorable(const AudioClip& c) {+ return c.warpMarkers.size() >= 2 && c.warpBeats > 0.0 && c.warpOffRegionLength >= 0 &&+ c.warpOffRegionOffset == c.sourceOffsetFrames && c.warpOffRegionLength == c.effectiveLength();+}+// Keep the trim window valid after warpBeats changes (marker/length edits). Preserves// the window (clamped); an explicit end past the new length snaps back to full.void clampWarpPlay(AudioClip& c) {@@ -577,10 +590,14 @@ bool Engine::setClipWarp(int32_t trackId, int32_t clipIndex, bool enabled, int32AudioClip& c = (*audioClipRef(*nt, clipIndex));const double spb = transport_.samplesPerBeat();const double devSR = transport_.sampleRate();- // On enable, auto-detect the source tempo and snap the clip's length to the- // beat grid so it conforms to the project BPM. If detection fails, fall back- // to a length-neutral seed (toggling warp then leaves audio where it is).- if (enabled && !c.warpEnabled && c.sample && spb > 0.0 && devSR > 0.0 && c.sample->sourceSampleRate > 0.0) {+ // Off is a bypass (#310): the markers stay on the clip, stamped with the region they+ // belong to, and turning warp back on restores them as they were. Only a first enable+ // (or one after a split / trim moved the region) seeds: auto-detect the source tempo+ // and snap the clip's length to the beat grid so it conforms to the project BPM; if+ // detection fails, a length-neutral seed (toggling warp then leaves audio where it is).+ if (!enabled && c.warpEnabled) stampWarpOffRegion(c);+ if (enabled && !c.warpEnabled && !warpMarkersRestorable(c) && c.sample && spb > 0.0 && devSR > 0.0 &&+ c.sample->sourceSampleRate > 0.0) {if (seedAutoWarp(c, spb, devSR) <= 0.0) seedNeutralWarp(c, spb, devSR);}c.warpEnabled = enabled;@@ -695,6 +712,7 @@ bool Engine::setClipWarpMarkers([](const WarpMarker& a, const WarpMarker& b) { return a.srcFrame < b.srcFrame; });c.warpBeats = c.warpMarkers.back().beat;clampWarpPlay(c); // preserve the trim window across marker edits (clamped to new length)+ if (!c.warpEnabled) stampWarpOffRegion(c); // markers kept for a later re-enable (a project load)configureClipWarp(c, transport_.samplesPerBeat(), transport_.sampleRate());syncSessionAudioSlot(*nt, clipIndex);republishWithTrack(trackId, nt);@@ -709,7 +727,8 @@ bool Engine::setClipWarpTrim(int32_t trackId, int32_t clipIndex, double playStarif (!old || old->type() != TrackType::Audio) return false;if (!audioClipRef(*old, clipIndex)) return false;const AudioClip& oc = (*audioClipRef(*old, clipIndex));- if (!oc.warpEnabled || oc.warpBeats <= 0.0) return false;+ // A warp-off clip still takes the window of the markers it keeps (a project load).+ if ((!oc.warpEnabled && !warpMarkersRestorable(oc)) || oc.warpBeats <= 0.0) return false;constexpr double kMinBeat = 0.05;double ps = std::clamp(playStart, 0.0, std::max(0.0, oc.warpBeats - kMinBeat));double pe = std::clamp(playEnd, ps + kMinBeat, oc.warpBeats);@@ -728,7 +747,11 @@ int32_t Engine::clipWarpMarkers(auto t = findTrackAuthoring(trackId);if (!t || t->type() != TrackType::Audio) return 0;if (!audioClipRef(*t, clipIndex)) return 0;- const auto& m = (*audioClipRef(*t, clipIndex)).warpMarkers;+ const AudioClip& c = (*audioClipRef(*t, clipIndex));+ // A warp-off clip split or trimmed since has markers for a region it no longer+ // plays: they'd be re-seeded on re-enable, so they aren't reported (nor saved).+ if (!c.warpEnabled && !warpMarkersRestorable(c)) return 0;+ const auto& m = c.warpMarkers;const int32_t n = std::min<int32_t>(maxCount, static_cast<int32_t>(m.size()));for (int32_t i = 0; i < n; ++i) {if (outSrc) outSrc[i] = m[i].srcFrame;diff --git a/src/native/nota.engine/src/engine/Track.h b/src/native/nota.engine/src/engine/Track.hindex 6daa93ef..a2063958 100644--- a/src/native/nota.engine/src/engine/Track.h+++ b/src/native/nota.engine/src/engine/Track.h@@ -70,6 +70,11 @@ struct AudioClip {WarpMode warpMode = WarpMode::Complex;double warpBeats = 0.0; // full warped material length (beats) = last marker's beatstd::vector<WarpMarker> warpMarkers; // source↔beat anchors (≥2 when warped)+ // Warp off keeps the markers (#310) so turning it back on restores them. They stay valid+ // only for the unwarped region they were made for: a split or trim with warp off moves+ // the region, and re-enabling then seeds fresh markers instead. -1 = no off-state stamp.+ double warpOffRegionOffset = -1.0;+ int64_t warpOffRegionLength = -1;// Played sub-window of the warp (trim). Beats within [0, warpBeats];// the clip plays [warpPlayStart, warpPlayEndEff()] placed at startBeat. 0/0 => whole// warp (default, back-compat). Trimming leaves warpBeats/markers untouched.diff --git a/tests/Nota.SmokeTest/PadAndWarpTests.cs b/tests/Nota.SmokeTest/PadAndWarpTests.csnew file mode 100644index 00000000..87d81d95--- /dev/null+++ b/tests/Nota.SmokeTest/PadAndWarpTests.cs@@ -0,0 +1,209 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Drum Rack pads and warp on/off.+// - A Sampler pad plays its sample through as a one-shot: a short note doesn't cut it (#312).+// A looped pad still stops on note-off, so it can't ring forever.+// - A pad audition (TrackNoteOn) plays only the rack's own track, never the armed ones (#307).+// - Warp off → on restores the markers as they were, through undo and a save / load; a split+// made with warp off seeds fresh markers for the half instead, after a save / load too (#310).+// - A one-shot pad whose loop turns on after its note-off releases instead of looping on.+// Also runnable alone: `dotnet run --project tests/Nota.SmokeTest -- --pad-warp`.++using Nota.Application;+using Nota.Infrastructure;++namespace Nota.SmokeTest;++internal static class PadAndWarpTests+{+ private const int Sr = 44100, Block = 512;++ public static IEnumerable<(bool ok, string label)> Run()+ {+ string wav = Path.Combine(Path.GetTempPath(), "nota_smoke_pad_warp.wav");+ WavWriter.WriteSine(wav, seconds: 2.0, freq: 220, sampleRate: Sr);+ foreach (var r in OneShotPads(wav)) yield return r;+ foreach (var r in PadAudition(wav)) yield return r;+ foreach (var r in WarpToggle(wav)) yield return r;+ }++ private static double Rms(NotaEngine e, int blocks)+ {+ var buf = new float[Block * 2];+ double sum = 0;+ for (int b = 0; b < blocks; b++)+ {+ e.RenderOffline(buf, Block, Sr);+ foreach (var v in buf) sum += v * v;+ }+ return Math.Sqrt(sum / (blocks * Block * 2));+ }++ // A 2 s sample on a pad, struck with a ~20 ms note: still sounding half a second later.+ private static IEnumerable<(bool, string)> OneShotPads(string wav)+ {+ foreach (bool loop in new[] { false, true })+ {+ using var e = new NotaEngine();+ int t = e.AddDrumRackTrack();+ int p = e.RackAddSamplerChain(t, wav, 60, loop);+ e.RackSetChainTriggerNote(t, p, 60);+ e.TrackNoteOn(t, 60, 1f);+ Rms(e, 2);+ e.TrackNoteOff(t, 60);+ Rms(e, 40); // ~0.46 s on: well inside the sample, past any release+ double later = Rms(e, 4);+ if (!loop)+ yield return (later > 0.05, $"one-shot pad: a short note plays the sample through (rms {later:F3} after note-off)");+ else+ yield return (later < 1e-3, $"looped pad: note-off still stops it (rms {later:F5})");+ }++ // The loop switched on while a released one-shot still sounds: it releases rather+ // than looping on with nothing left to stop it.+ {+ using var e = new NotaEngine();+ int t = e.AddDrumRackTrack();+ int p = e.RackAddSamplerChain(t, wav, 60, false);+ e.RackSetChainTriggerNote(t, p, 60);+ int loopParam = -1;+ for (int i = 0; i < e.RackChainInstrumentParamCount(t, p); i++)+ if (e.RackChainInstrumentParamId(t, p, i) == "loopmode") loopParam = i;+ e.TrackNoteOn(t, 60, 1f);+ Rms(e, 2);+ e.TrackNoteOff(t, 60);+ Rms(e, 4);+ if (loopParam >= 0) e.RackChainInstrumentParamSet(t, p, loopParam, 0.5f);+ Rms(e, 350); // ~4 s: past the 2 s sample, so only a loop still sounds+ double later = Rms(e, 4);+ yield return (loopParam >= 0 && later < 1e-3, $"a released one-shot whose loop turns on fades out (rms {later:F5})");+ }++ // Switched to Mono with Glide while a released one-shot still sounds, the next note+ // glides on that voice and is held: it doesn't inherit the old note's key-up.+ {+ using var e = new NotaEngine();+ int t = e.AddDrumRackTrack();+ int p = e.RackAddSamplerChain(t, wav, 60, true); // looped, so only a release ends it+ e.RackSetChainTriggerNote(t, p, 60);+ int ParamOf(string id)+ {+ for (int i = 0; i < e.RackChainInstrumentParamCount(t, p); i++)+ if (e.RackChainInstrumentParamId(t, p, i) == id) return i;+ return -1;+ }+ int loopP = ParamOf("loopmode"), voiceP = ParamOf("voicemode"), glideP = ParamOf("glide");+ e.RackChainInstrumentParamSet(t, p, loopP, 0f); // a one-shot for this first note+ e.TrackNoteOn(t, 60, 1f);+ Rms(e, 2);+ e.TrackNoteOff(t, 60); // held back: it plays through+ Rms(e, 1);+ e.RackChainInstrumentParamSet(t, p, voiceP, 0.5f); // Mono …+ e.RackChainInstrumentParamSet(t, p, glideP, 0.3f); // … with Glide+ e.RackChainInstrumentParamSet(t, p, loopP, 0.5f); // looped again+ e.TrackNoteOn(t, 60, 1f); // legato onto the sounding voice+ Rms(e, 350); // ~4 s, past the sample: only a held loop sounds+ double held = Rms(e, 4);+ yield return (loopP >= 0 && voiceP >= 0 && glideP >= 0 && held > 0.05,+ $"a note gliding onto a released one-shot's voice stays held (rms {held:F3})");+ }+ }++ private static IEnumerable<(bool, string)> PadAudition(string wav)+ {+ using var e = new NotaEngine();+ int synth = e.AddInstrumentTrack();+ e.SetTrackArmed(synth, true);+ int t = e.AddDrumRackTrack();+ int p = e.RackAddSamplerChain(t, wav, 60, false);+ e.RackSetChainTriggerNote(t, p, 72); // the armed synth would sound on this note too+ e.SetTrackMute(t, true); // hear only what reaches the armed track+ e.TrackNoteOn(t, 72, 1f);+ double armed = Rms(e, 8);+ e.TrackNoteOff(t, 72);+ yield return (armed < 1e-4, $"pad audition reaches only the rack's track, not an armed one (armed track rms {armed:F5})");+ }++ private static (double[] src, double[] beat) Markers(NotaEngine e, int t, int c)+ {+ var s = new double[16]; var b = new double[16];+ int n = e.GetClipWarpMarkers(t, c, s, b);+ return (s[..Math.Max(0, n)], b[..Math.Max(0, n)]);+ }++ private static bool Same((double[] src, double[] beat) a, (double[] src, double[] beat) b)+ => a.src.Length == b.src.Length && a.src.Zip(b.src).All(z => Math.Abs(z.First - z.Second) < 1e-6)+ && a.beat.Zip(b.beat).All(z => Math.Abs(z.First - z.Second) < 1e-6);++ private static IEnumerable<(bool, string)> WarpToggle(string wav)+ {+ using var e = new NotaEngine();+ e.SetBpm(120);+ int t = e.AddAudioTrack();+ int c = e.AddAudioClip(t, wav, 0.0);+ e.SetClipWarp(t, c, true, 3);+ // A hand-placed middle marker, the kind of work a re-seed would throw away.+ e.SetClipWarpMarkers(t, c, new[] { 0.0, Sr * 0.5, Sr * 2.0 }, new[] { 0.0, 1.5, 4.0 });+ var placed = Markers(e, t, c);++ e.SetClipWarp(t, c, false, 3);+ e.SetClipWarp(t, c, true, 3);+ yield return (placed.src.Length == 3 && Same(Markers(e, t, c), placed),+ $"warp off → on restores the markers ({Markers(e, t, c).src.Length} markers)");+ e.Undo(); // back to off …+ bool offAgain = e.TryGetAudioClipInfo(t, c, out var ui) && ui.WarpEnabled == 0;+ e.Redo(); // … and on again+ yield return (offAgain && e.TryGetAudioClipInfo(t, c, out var ai) && ai.WarpEnabled != 0 && Same(Markers(e, t, c), placed),+ "warp toggle undo / redo keeps the markers");++ // Save with warp off, reload, switch it back on: the markers come back too.+ e.SetClipWarp(t, c, false, 3);+ string dir = Path.Combine(Path.GetTempPath(), "nota-smoke-warp-off-" + Guid.NewGuid().ToString("N") + ".nota");+ var transport = new TransportState(120.0, 1.0, false, false);+ try+ {+ ProjectService.Save(ProjectService.Capture(e, transport, new List<string>()), dir, e);+ using var d = new NotaEngine();+ ProjectService.Apply(ProjectService.Load(dir), d, dir);+ int dt = -1;+ for (int i = 0; i < d.TrackCount; i++)+ if (d.TryGetTrackInfo(i, out var ti) && !ti.IsInstrument && ti.ClipCount == 1) dt = ti.Id;+ bool offAfterLoad = d.TryGetAudioClipInfo(dt, 0, out var li) && li.WarpEnabled == 0;+ d.SetClipWarp(dt, 0, true, 3);+ yield return (offAfterLoad && Same(Markers(d, dt, 0), placed), "warp-off markers survive a save / load and come back on re-enable");+ }+ finally { try { Directory.Delete(dir, true); } catch { } }++ // Split with warp off: the right half's region moved, so re-enabling seeds markers for it.+ int right = e.SplitClip(t, c, 2.0);+ e.SetClipWarp(t, right, true, 3);+ var rm = Markers(e, t, right);+ bool inside = e.TryGetAudioClipInfo(t, right, out var ri) && rm.src.Length >= 2+ && rm.src[0] >= ri.SourceOffsetFrames - 1 && rm.src[^1] <= ri.SourceOffsetFrames + ri.LengthFrames + 1;+ yield return (inside, $"a half split off with warp off gets markers for its own audio ({string.Join(", ", rm.src.Select(s => s.ToString("F0")))})");++ // The left half is still off with the whole clip's markers: saved and reloaded, they+ // mustn't come back on re-enable and play audio the split cut away.+ string dir2 = Path.Combine(Path.GetTempPath(), "nota-smoke-warp-split-" + Guid.NewGuid().ToString("N") + ".nota");+ try+ {+ ProjectService.Save(ProjectService.Capture(e, transport, new List<string>()), dir2, e);+ using var d = new NotaEngine();+ ProjectService.Apply(ProjectService.Load(dir2), d, dir2);+ int dt = -1;+ for (int i = 0; i < d.TrackCount; i++)+ if (d.TryGetTrackInfo(i, out var ti) && !ti.IsInstrument && ti.ClipCount == 2) dt = ti.Id;+ int left = -1;+ for (int k = 0; k < 2; k++)+ if (d.TryGetAudioClipInfo(dt, k, out var ki) && ki.WarpEnabled == 0) left = k;+ d.SetClipWarp(dt, left, true, 3);+ var lm = Markers(d, dt, left);+ bool within = d.TryGetAudioClipInfo(dt, left, out var lj) && lm.src.Length >= 2+ && lm.src[^1] <= lj.SourceOffsetFrames + lj.LengthFrames + 1;+ yield return (left >= 0 && within,+ $"a half split with warp off, saved and reloaded, re-seeds on re-enable ({string.Join(", ", lm.src.Select(s => s.ToString("F0")))})");+ }+ finally { try { Directory.Delete(dir2, true); } catch { } }+ }+}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex db13c0f1..cf893e0b 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -401,6 +401,14 @@ if (args.Length >= 1 && args[0] == "--device-copy")Console.WriteLine(failures == 0 ? "DEVICE COPY PASSED" : $"DEVICE COPY FAILED ({failures})");return failures == 0 ? 0 : 1;}+// Drum Rack one-shot pads, pad audition, warp off/on alone: `--pad-warp`. Also part of the full run.+if (args.Length >= 1 && args[0] == "--pad-warp")+{+ Console.WriteLine("-- pads + warp toggle --");+ foreach (var (ok, label) in PadAndWarpTests.Run()) Check(ok, label);+ Console.WriteLine(failures == 0 ? "PAD WARP PASSED" : $"PAD WARP FAILED ({failures})");+ return failures == 0 ? 0 : 1;+}// Device fold alone: `--fold`. Also part of the full run.if (args.Length >= 1 && args[0] == "--fold"){@@ -15088,6 +15096,8 @@ Console.WriteLine("-- device remove undo --");foreach (var (ok, label) in DeviceRemoveUndoTests.Run()) Check(ok, label);Console.WriteLine("-- device copy + rack undo --");foreach (var (ok, label) in DeviceCopyTests.Run()) Check(ok, label);+Console.WriteLine("-- pads + warp toggle --");+foreach (var (ok, label) in PadAndWarpTests.Run()) Check(ok, label);Console.WriteLine("-- stereo map --");foreach (var (ok, label) in StereoMeasureTests.Run()) Check(ok, label);