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
(feat) Piano-roll ruler seeks, new notes reuse last length and velocity, sliders drag sideways (#180)
Chris Laupama1644ffb77858
diff --git a/.agents/skills/nota-design/SKILL.md b/.agents/skills/nota-design/SKILL.mdindex 0348b8d9..75dd1800 100644--- a/.agents/skills/nota-design/SKILL.md+++ b/.agents/skills/nota-design/SKILL.md@@ -135,7 +135,8 @@ Reuse before writing: `Knob` (sizes snap to 34/36/44), `DeviceCardKit.KnobCell`A new value control **must** match the interaction contract:- Vertical drag, up increases, full range over ~140 px; Shift/Ctrl/⌘ for fine steps;- `ns-resize`; a click never jumps the value; no horizontal drag+ `ns-resize`; a click never jumps the value; no horizontal drag (except a horizontal+ slider along its own axis, `SliderTrack`)- Double-click restores the default- Left button only — right-click must bubble to the CV-modulate / MIDI Learn menu- `GestureBegin` / `GestureEnd` bracket `BeginAutomationWrite` / `EndAutomationWrite`diff --git a/.claude/skills/nota-design/SKILL.md b/.claude/skills/nota-design/SKILL.mdindex 2e4037db..0b931c2f 100644--- a/.claude/skills/nota-design/SKILL.md+++ b/.claude/skills/nota-design/SKILL.md@@ -134,7 +134,8 @@ Reuse before writing: `Knob` (sizes snap to 34/36/44), `DeviceCardKit.KnobCell`A new value control **must** match the interaction contract:- Vertical drag, up increases, full range over ~140 px; Shift/Ctrl/⌘ for fine steps;- `ns-resize`; a click never jumps the value; no horizontal drag+ `ns-resize`; a click never jumps the value; no horizontal drag (except a horizontal+ slider along its own axis, `SliderTrack`)- Double-click restores the default- Left button only — right-click must bubble to the CV-modulate / MIDI Learn menu- `GestureBegin` / `GestureEnd` bracket `BeginAutomationWrite` / `EndAutomationWrite`diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 80ff75eb..e952963b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,14 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.chains) until the pedal comes up; striking a held key again restarts it. It works for akeyboard's pedal and for a pedal recorded or drawn in a clip. Keys, Mosaic and plug-ins keeptheir own pedal handling, and drums (Drum Rack, Rhythm) ignore it.+- **Move the playhead from the clip editor** (nota-daw/nota#50): click the piano roll's ruler+ to put the playhead there, or drag along it to scrub (snapped to the grid); while playing,+ playback carries on from the new spot. The piano roll now shows the playhead when stopped+ too, where playback will start.+- **New notes take the last note's length and velocity** (nota-daw/nota#44): a note drawn in+ the piano roll gets the length and velocity of the note you last clicked, moved, resized or+ changed the velocity of, so a run of quarter notes on a 1/16 grid is one length change and+ then double-clicks. Before you touch a note it is one grid step at velocity 0.8, as before.- **Release notes from the status bar** (nota-daw/nota#127): the version number at thebottom right of the main window, next to the sample rate, is now a button: click it toopen What's New for the installed version (it never starts an update). Escape closes What's@@ -93,6 +101,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.use-after-free in the rack's render (seen on macOS). A rack keeps every replaced chainlayout alive until the audio thread has finished two more blocks, instead of only the last16 edits; the Instrument Rack, Audio Effect Rack and Rhythm's voice effects get the same fix.+- **Horizontal sliders drag sideways** (nota-daw/nota#115): every horizontal slider on the+ devices (ADSR, mix, depth…) now follows a left/right drag, with the handle under the+ pointer, instead of only responding to an up/down drag. Vertical dragging still works,+ Shift is still fine, and a click still never jumps the value.- **Session recording counts in** (nota-daw/nota#158): recording into a Session slot (or ascene) with the transport stopped now plays the metronome count-in first, with the slotblinking "Rec in…", and the take starts when it ends. A note you start during the count-indiff --git a/DESIGN.md b/DESIGN.mdindex cc1cc883..c9a84e91 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -448,7 +448,9 @@ Builders live in `DeviceCardKit`; controls in `Controls/`. Reuse before writing### Interaction contract- **Vertical drag**, up increases, full range over ~140 px; Shift (or Ctrl/⌘) is fine.- Cursor `ns-resize`. A click never jumps the value. No horizontal drag anywhere.+ Cursor `ns-resize`. A click never jumps the value. The one horizontal drag is a horizontal+ slider (`SliderTrack`) along its own axis: right increases, the handle follows the pointer,+ cursor `ew-resize`; a vertical drag still works on it as on a knob.- **Double-click** restores the default where one is supplied.- **Left button only** — right-click bubbles to the CV-modulate / MIDI Learn menu.- **`GestureBegin` / `GestureEnd`** bracket `BeginAutomationWrite` / `EndAutomationWrite`.diff --git a/src/managed/Nota.App/Controls/SliderTrack.cs b/src/managed/Nota.App/Controls/SliderTrack.csindex 44007ff4..82ea84f5 100644--- a/src/managed/Nota.App/Controls/SliderTrack.cs+++ b/src/managed/Nota.App/Controls/SliderTrack.cs@@ -9,10 +9,12 @@// arc of a modulation knob.//// It works in normalised 0..1; the caller maps to the parameter (linear, log, stepped).-// Interaction follows the almanac (§ States · cursors): ns-resize, a vertical drag — up-// increases, full range over ~140px, Shift (or Ctrl/⌘) for fine steps — so a slider and a-// knob handle the same; a click never jumps the value. Double-click resets when a reset is-// supplied; right-click bubbles to the CV-modulate / MIDI Learn menu.+// Interaction follows the almanac (§ Interaction contract), with the one exception it allows:+// a slider drags along its own axis (#115) — right increases and the handle follows the+// pointer — and a vertical drag still works as on a knob (up increases, full range over+// ~140px). Shift (or Ctrl/⌘) is fine on both; ew-resize; a click never jumps the value.+// Double-click resets when a reset is supplied; right-click bubbles to the CV-modulate /+// MIDI Learn menu.// GestureBegin / GestureEnd bracket the drag so automation writes are recorded, and the// row's live-follow refresher should skip while Dragging.@@ -41,7 +43,7 @@ internal sealed class SliderTrack : Controlprivate double _norm;private bool _dim, _drag;- private double _lastY;+ private double _lastX, _lastY;public bool Bipolar { get; init; }@@ -73,7 +75,7 @@ internal sealed class SliderTrack : Control{Height = Height0;MinWidth = 24;- Cursor = new Cursor(StandardCursorType.SizeNorthSouth);+ Cursor = new Cursor(StandardCursorType.SizeWestEast);VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center;}@@ -88,7 +90,9 @@ internal sealed class SliderTrack : Controlreturn;}_drag = true;- _lastY = e.GetPosition(this).Y;+ var p = e.GetPosition(this);+ _lastX = p.X;+ _lastY = p.Y;e.Pointer.Capture(this);GestureBegin?.Invoke();e.Handled = true;@@ -97,11 +101,14 @@ internal sealed class SliderTrack : Controlprotected override void OnPointerMoved(PointerEventArgs e){if (!_drag) return;- double y = e.GetPosition(this).Y, dy = _lastY - y; // up = increase- _lastY = y;- if (dy == 0) return;+ var p = e.GetPosition(this);+ double dx = p.X - _lastX, dy = _lastY - p.Y; // right = increase, up = increase+ _lastX = p.X;+ _lastY = p.Y;+ if (dx == 0 && dy == 0) return;bool fine = (e.KeyModifiers & (KeyModifiers.Shift | KeyModifiers.Control | KeyModifiers.Meta)) != 0;- Nudge(dy / (fine ? 1400.0 : 140.0));+ double span = Math.Max(Bounds.Width, 24); // along the slider the handle tracks the pointer+ Nudge((dx / span + dy / 140.0) / (fine ? 10.0 : 1.0));}// Under the pointer (or in the hand) the control is live and takes the accent; at restdiff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.csindex acb4d5e6..2df2f8e3 100644--- a/src/managed/Nota.App/MainWindow.Detail.cs+++ b/src/managed/Nota.App/MainWindow.Detail.cs@@ -434,6 +434,14 @@ public partial class MainWindowPollHeldNotes = buf => Engine.LiveHeldNotes(buf),ExpressionOf = id => Engine.GetNoteExpression(id),CreateExpression = pts => Engine.CreateNoteExpression(pts),+ // The ruler moves the transport (#50): clip-local beat → arrangement beat.+ Seek = local =>+ {+ if (!Engine.TryGetClipInfo(trackId, clipIndex, out var live) || !live.IsMidi) return;+ double beat = Math.Max(0, live.StartBeat + local);+ Engine.Seek(beat);+ Timeline.SetPlayhead(beat);+ },};double length = Engine.TryGetClipInfo(trackId, clipIndex, out var ci) && ci.LengthBeats > 0 ? ci.LengthBeats : 4;double start = ci.StartBeat;diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex 3bffc439..d2925753 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -296,14 +296,14 @@ public partial class MainWindow : Windowif (_audioEditor is { IsEffectivelyVisible: true })_audioEditor.OnPlayhead(beats, vm.Engine.IsPlaying); // live clip playback cursor// Piano-roll playback cursor: map the global beat to clip-local time for the- // open arrangement MIDI clip; a session slot runs its own loop clock, so follow- // the slot's position instead (#137).+ // open arrangement MIDI clip, shown stopped too, where play will start (#50); a+ // session slot runs its own loop clock, so follow the slot's position instead (#137).if (_clipEditor is { IsEffectivelyVisible: true } && _editorRoll is not null){if (_editorTrackId > 0){if (Engine.TryGetClipInfo(_editorTrackId, _editorClipIndex, out var pci) && pci.IsMidi)- _editorRoll.SetPlayhead(beats - pci.StartBeat, vm.Engine.IsPlaying);+ _editorRoll.SetPlayhead(beats - pci.StartBeat, true);}else if (_sessionSlotTrack > 0 && _sessionSlotScene >= 0)_editorRoll.SetPlayhead(SessionSlotPlayhead(_sessionSlotTrack, _sessionSlotScene), true);diff --git a/src/managed/Nota.App/PianoRollView.cs b/src/managed/Nota.App/PianoRollView.csindex f3b6a115..6324d109 100644--- a/src/managed/Nota.App/PianoRollView.cs+++ b/src/managed/Nota.App/PianoRollView.cs@@ -37,6 +37,9 @@ public sealed partial class PianoRollView : UserControl/// <summary>Polls the engine for currently-pressed live-input pitches (keyboard + MIDI) into/// the buffer, returning the count — used to light up the played key. Set by the host.</summary>public Func<int[], int>? PollHeldNotes { get; set; }+ /// <summary>Moves the transport to a clip-local beat (#50): a click or drag on the ruler.+ /// Null (a session slot, which runs its own clock) leaves the ruler inert.</summary>+ public Action<double>? Seek { get; set; }// The recording take shown in this roll (#56): its held notes grow on the grid and new// notes settle in. Null when the roll shows any other clip.@@ -143,6 +146,23 @@ public sealed partial class PianoRollView : UserControlprivate static readonly List<NotaNote> s_clipboard = new();private static double s_clipAnchor;+ // The last note touched — clicked, moved, resized or its velocity drawn — in any clip (#44):+ // a new note takes its length and velocity. Before any is touched, a new note is one grid+ // step at 0.8.+ private static double s_lastLen = double.NaN;+ private static float s_lastVel = 0.8f;+ private void Remember(int i)+ {+ if (i < 0 || i >= _notes.Count) return;+ s_lastLen = _notes[i].LengthBeats;+ s_lastVel = _notes[i].Velocity;+ }+ private double NewNoteLen(double start)+ {+ double len = double.IsNaN(s_lastLen) ? MinNoteLen : Math.Max(MinNoteLen, s_lastLen);+ return Math.Max(MinNoteLen, Math.Min(len, _lengthBeats - start));+ }+private readonly RulerLane _ruler;private readonly KeysColumn _keys;private readonly NoteGrid _gridControl;@@ -1018,7 +1038,49 @@ public sealed partial class PianoRollView : UserControlprivate sealed class RulerLane : Control{private readonly PianoRollView _o;+ private bool _scrub;public RulerLane(PianoRollView o) { _o = o; }++ // Click places the playhead, a drag scrubs it (snapped to the grid), as on the+ // arrangement ruler (#50).+ protected override void OnPointerEntered(PointerEventArgs e)+ {+ base.OnPointerEntered(e);+ Cursor = _o.Seek is null ? Cursor.Default : new Cursor(StandardCursorType.Hand);+ }+ protected override void OnPointerPressed(PointerPressedEventArgs e)+ {+ base.OnPointerPressed(e);+ if (_o.Seek is null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;+ _scrub = true;+ e.Pointer.Capture(this);+ SeekAt(e.GetPosition(this).X);+ e.Handled = true;+ }+ protected override void OnPointerMoved(PointerEventArgs e)+ {+ base.OnPointerMoved(e);+ if (_scrub) SeekAt(e.GetPosition(this).X);+ }+ protected override void OnPointerReleased(PointerReleasedEventArgs e)+ {+ base.OnPointerReleased(e);+ if (!_scrub) return;+ _scrub = false;+ e.Pointer.Capture(null);+ }+ protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)+ {+ _scrub = false;+ base.OnPointerCaptureLost(e);+ }+ private void SeekAt(double x)+ {+ double b = Math.Clamp(_o.SnapBeat(_o.XToBeat(x)), 0, _o._lengthBeats);+ if (Math.Abs(b - _o._playheadBeat) < 1e-9) return;+ _o.Seek?.Invoke(b);+ _o.SetPlayhead(b, true); // immediate feedback; the transport tick keeps it in sync+ }// Beats only: a bar reads "3" in Ink 2, a beat "3.2" in Ink 5, set on the baseline in// mono 9 just right of its tick. The loop is a 3px brass strip along the top.public override void Render(DrawingContext ctx)@@ -1440,7 +1502,8 @@ public sealed partial class PianoRollView : UserControlif (hit >= 0) { _o._notes.RemoveAt(hit); _o._selection.Clear(); }else{- var nt = new NotaNote(YToPitch(p.Y), Math.Max(0, Snap(XToBeat(p.X))), _o.MinNoteLen, 0.8f);+ double at = Math.Max(0, Snap(XToBeat(p.X)));+ var nt = new NotaNote(YToPitch(p.Y), at, _o.NewNoteLen(at), s_lastVel);_o._notes.Add(nt);_o._selection.Clear(); _o._selection.Add(_o._notes.Count - 1);_o._placementPending = true; // a drawn note overwrites what it lands on@@ -1462,6 +1525,7 @@ public sealed partial class PianoRollView : UserControlif (!_o._selection.Contains(hit)) { _o._selection.Clear(); _o._selection.Add(hit); }e.Pointer.Capture(this);_primary = hit;+ _o.Remember(hit);_dragMoved = false;_orig.Clear();foreach (int i in _o._selection)@@ -1617,6 +1681,7 @@ public sealed partial class PianoRollView : UserControl_drag = Mode.None;e.Pointer.Capture(null);_orig.Clear();+ if ((was == Mode.Resize || was == Mode.ResizeLeft) && _dragMoved) _o.Remember(_primary);if (was != Mode.Marquee && _dragMoved){_o._placementPending = true; // overwrites once the selection is let go@@ -1870,6 +1935,7 @@ public sealed partial class PianoRollView : UserControl{if (!_drag) return;_drag = false; _grabbed.Clear(); e.Pointer.Capture(null);+ _o.Remember(_velNote);_o.CommitNotes(); _o.Changed?.Invoke();}diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.csindex 68e5071d..b01fe089 100644--- a/src/managed/Nota.App/PreferencesWindow.cs+++ b/src/managed/Nota.App/PreferencesWindow.cs@@ -1166,7 +1166,9 @@ public sealed partial class PreferencesWindow : NotaWindow("⌘C ⌘X ⌘V", "Copy / cut / paste notes · paste lands on the originals"),("Esc", "Deselect · moved or pasted notes replace the notes under them"),("Delete", "Delete the selected notes"),+ ("Double-click empty grid", "Add a note with the length and velocity of the last note touched · on a note, delete it"),("Drag note edge", "Change the note's start or end"),+ ("Click · drag the ruler", "Move the playhead there · drag to scrub, snapped to the grid"),("Drag velocity stem", "Set velocity · selected notes move together · ⇧ adds a note"),("Drag in the Bend / Pres / Slide lane", "Draw the selected note's MPE curve · ⌥ draws a straight line · drag a point to move it"),("Double-click in an MPE lane", "Add a point · on a point, delete it · right-click to clear the curve"),@@ -1227,6 +1229,7 @@ public sealed partial class PreferencesWindow : NotaWindow("Drag an audio clip out of the Arrangement", "Take it as a sample: drop on a pad, a Grain, a Rhythm voice, a Session slot — the clip stays put"),("Drag clip + ⌥", "Position freely, ignoring the grid for this drag (the magnet in the transport latches the same thing)"),("Drag knob", "Change a device value · hold ⌘ or ⇧ for fine steps"),+ ("Drag slider", "Left / right (or up / down) changes the value · hold ⌘ or ⇧ for fine steps"),("Double-click knob", "Reset the value to its default"),("Double-click a slider's value", "Type a value (units like k, ms, dB, L / R work) · Return sets it, Esc cancels"),("Drag jack → jack", "Patch a cable in Nota Consort · ⌥-click a jack to pull its cables"),