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) Aurora envelope boxes: knobs, drag, and double-click to type (#411)
Chris Laupama38acfb85d88b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 366e92e3..ffefb3d6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -103,6 +103,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.the same way.### Changed+- **Aurora envelope boxes have knobs and drag** — the A, D, S and R boxes under each Env+ graph now each carry a small knob, and the box itself is a drag value: drag it up or down+ (Shift for fine steps), or double-click anywhere on it to type an exact value. The graph+ handles still edit the envelope as before.- **Smoother, clearer waveforms on audio clips** (#267): clips in the Arrangement and theaudio clip editor now draw an anti-aliased peak outline around a denser body that followsthe loudness (RMS) of the audio. Every zoom level reads cleanly — zoomed out, no peak slips@@ -129,6 +133,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.returns, then the master.### Fixed+- **"Reset to default" on an instrument's graph handles reset to zero** — right-clicking an+ envelope or filter handle on a built-in instrument (Aurora's Sustain, for one) and choosing+ Reset to default set the value to 0 instead of the instrument's default. It now matches+ what a knob's double-click resets to.- **Session clips open in the Clip editor** (#334): a click on a slot that holds a clip showsthat clip in the Clip tab instead of the track's devices, the **Clip** button opens theselected slot, and with the editor open, clicking another clip — on the same track ordiff --git a/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs b/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.csindex 4d916132..f582af08 100644--- a/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs+++ b/src/managed/Nota.App/DeviceCards/Instruments/AuroraInstrumentCard.cs@@ -12,7 +12,8 @@// Filter — the selected filter's response as a drag pad, with its type,// slope, cutoff, resonance, env / LFO / key amounts and where each// source (Osc 1 / Osc 2 / Sub) is sent.-// Env — Env 1 (amp) and Env 2 (free) drawn and draggable.+// Env — Env 1 (amp) and Env 2 (free) drawn and draggable; each stage box+// under a graph has a knob, drags, and types on double-click.// LFO — both LFOs as a table, each naming where it lands, over a window// that draws the selected LFO's own shape.// Mod — the 8 × 7 matrix: drag a cell up for +, down for −.@@ -644,6 +645,56 @@ internal sealed class AuroraInstrumentCard : IInstrumentCardvar filtBody = new Border { Padding = new Thickness(7, 5), Child = filtGrid };// ---- Env tab --------------------------------------------------------------+ // Each stage box under a graph carries a small knob and a read-out. The knob turns+ // and double-click resets like any knob; the rest of the box is a drag value too+ // (vertical drag, Shift for fine), and a double-click anywhere on it types the value.+ Knob EnvKnob(string id, int pi, string name, Func<float, string> fmt, IBrush? arc)+ {+ var knob = new Knob(G(id), 1.0)+ {+ Accent = true, Inline = true, ArcColor = arc, Default = engine.InstrumentParamDefault(track, pi),+ VerticalAlignment = VerticalAlignment.Center, Format = v => fmt((float)v),+ };+ knob.ValueChanged += v => { engine.PluginParamSet(track, -1, pi, (float)v); Touch(); };+ knob.GestureBegin += () => Begin(id);+ knob.GestureEnd += () => End(id);+ readouts.Add(() => { if (!knob.Dragging) knob.Value = G(id); ToolTip.SetTip(knob, name + " · " + fmt(G(id))); });+ return knob;+ }+ void EnvBox(Border cell, string id, TextBlock readout, ValueField stageField)+ {+ // The box keeps its double-click for typing: no reset there (the knob and the+ // right-click menu still reset).+ var field = stageField with { ResetOnDoubleClick = false };+ ValueEntry.Attach(cell, field, readout);+ // The automation gesture opens on the first real change, not on the press: a+ // press alone (the first click of a double-click) must not override automation.+ bool drag = false, began = false; double lastY = 0, at = 0;+ cell.PointerPressed += (_, e) =>+ {+ if (e.Handled || !e.GetCurrentPoint(cell).Properties.IsLeftButtonPressed) return;+ e.Handled = true;+ if (e.ClickCount == 2) { ValueEntry.Open(cell, field); return; }+ drag = true; began = false; lastY = e.GetPosition(cell).Y; at = G(id);+ e.Pointer.Capture(cell);+ };+ cell.PointerMoved += (_, e) =>+ {+ if (!drag) return;+ // Step by step, so Shift (fine) can come and go mid-drag without a jump.+ double y = e.GetPosition(cell).Y;+ at = Math.Clamp(at + (lastY - y) / ((e.KeyModifiers & KeyModifiers.Shift) != 0 ? 600.0 : 120.0), 0, 1);+ lastY = y;+ if ((float)at == G(id)) return;+ if (!began) { began = true; Begin(id); }+ SetP(id, (float)at); Touch();+ };+ void Stop() { drag = false; if (began) { began = false; End(id); } }+ cell.PointerReleased += (_, e) => { if (!drag) return; Stop(); e.Pointer.Capture(null); };+ cell.PointerCaptureLost += (_, _) => { if (drag) Stop(); };+ ToolTip.SetTip(cell, field.Name + " · drag or turn to change, double-click to type");+ }+Control EnvPanel(string title, Func<string> route, VoltEnv view, string[] ids, Func<string> summary){view.Target(title, P(ids[0]), P(ids[1]), P(ids[2]), P(ids[3]));@@ -655,18 +706,30 @@ internal sealed class AuroraInstrumentCard : IInstrumentCard{string id = ids[k];var fk = fmt[k];+ string name = title + " · " + stage[k];var v = Mono(fk(G(id)), TextPrimary, NotaType.RowLabel);- v.HorizontalAlignment = HorizontalAlignment.Center;readouts.Add(() => v.Text = fk(G(id)));- if (view.Field(k) is { } vf) ValueEntry.Attach(v, vf); // double-click the read-out to type- var cap = Cap(stage[k]); cap.HorizontalAlignment = HorizontalAlignment.Center;+ // The knob on top, the stage letter and its value on one line under it: a box+ // is too narrow to hold a knob beside a full value like "180 ms".+ v.HorizontalAlignment = HorizontalAlignment.Right;+ var cap = Cap(stage[k]); cap.HorizontalAlignment = HorizontalAlignment.Left;+ var box = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), RowDefinitions = new RowDefinitions("Auto,Auto"), ColumnSpacing = 2 };var cell = new Border{Background = NotaPalette.SurfaceRaised, BorderBrush = BorderDef, BorderThickness = new Thickness(1),- CornerRadius = NotaRadius.Badge, Padding = new Thickness(2, 1),- Child = new StackPanel { Children = { cap, v } },+ CornerRadius = NotaRadius.Badge, Padding = new Thickness(3, 2, 3, 1),+ Cursor = new Cursor(StandardCursorType.SizeNorthSouth), Child = box,};- if (I(id) is var pi and >= 0) MidiLearn.Bind(cell, MidiTarget.PluginParam(track, -1, pi), title + " · " + stage[k]);+ if (I(id) is var pi and >= 0)+ {+ var knob = EnvKnob(id, pi, name, fk, ReferenceEquals(view, env2) ? Teal : null);+ knob.HorizontalAlignment = HorizontalAlignment.Center;+ Grid.SetColumnSpan(knob, 2); box.Children.Add(knob);+ MidiLearn.Bind(cell, MidiTarget.PluginParam(track, -1, pi), name);+ }+ Grid.SetRow(cap, 1); box.Children.Add(cap);+ Grid.SetRow(v, 1); Grid.SetColumn(v, 1); box.Children.Add(v);+ if (view.Field(k) is { } vf) EnvBox(cell, id, v, vf);Grid.SetColumn(cell, k); cells.Children.Add(cell);}var sum = Mono("", TextSecondary, NotaType.Axis);diff --git a/src/native/nota.engine/src/engine/Engine_Automation.cpp b/src/native/nota.engine/src/engine/Engine_Automation.cppindex 2b2b202c..504c7831 100644--- a/src/native/nota.engine/src/engine/Engine_Automation.cpp+++ b/src/native/nota.engine/src/engine/Engine_Automation.cpp@@ -136,7 +136,13 @@ std::string Engine::pluginParamText(int32_t trackId, int32_t deviceIndex, int32_float Engine::pluginParamDefault(int32_t trackId, int32_t deviceIndex, int32_t paramIndex) const {auto t = findTrackAuthoring(trackId);if (!t) return 0.0f;- if (deviceIndex < 0) return t->instrument ? t->instrument->pluginParamDefault(paramIndex) : 0.0f;+ if (deviceIndex < 0) {+ if (!t->instrument) return 0.0f;+ // A built-in instrument has no plugin default of its own (the base returns 0, which+ // sent a graph's "Reset to default" to 0); its default is a fresh instance's value.+ if (t->instrument->kind() >= 0) return instrumentParamDefault(trackId, paramIndex);+ return t->instrument->pluginParamDefault(paramIndex);+ }if (deviceIndex >= static_cast<int32_t>(t->devices.size())) return 0.0f;auto& d = t->devices[deviceIndex];return d ? d->pluginParamDefault(paramIndex) : 0.0f;diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 12e2ca60..233e8127 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -8281,6 +8281,12 @@ Console.WriteLine("-- Param defaults (knob reset) --");de.PluginParamSet(t, -1, pos, Math.Clamp(idef + 0.4f, 0f, 1f));Check(Math.Abs(de.InstrumentParamDefault(t, pos) - idef) < 1e-4f, "instrument param default is stable after a change");Check(Math.Abs(de.PluginParamGet(t, -1, pos) - idef) > 0.1f, "changed instrument value differs from its default");+ // A graph handle's "Reset to default" asks through PluginParamDefault(track, -1, …): a+ // built-in instrument must answer with its own default there too (Aurora Sustain read 0).+ int sus = -1; for (int i = 0; i < de.PluginParamCount(t, -1); i++) if (de.PluginParamId(t, -1, i) == "sustain") sus = i;+ Check(sus >= 0 && de.InstrumentParamDefault(t, sus) > 0.1f+ && Math.Abs(de.PluginParamDefault(t, -1, sus) - de.InstrumentParamDefault(t, sus)) < 1e-6f,+ "a built-in instrument's plugin-param default is its own default (Aurora Sustain, not 0)");int cmp = de.AddBuiltinDevice(t, 1); // Compressorfloat ddef = de.DeviceParamDefault(t, cmp, 0);