Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Quick wins: Clip panel height, Stop stops Session clips, loop brace double-click, start screen Esc (#150)

Chris Laupama81c7c0ead765
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e5c8337..f901f19f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,13 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Double-click the loop brace to turn the loop off and on** (nota-daw/nota#59): in the
+ arrangement ruler, a double-click on the loop region switches looping off without losing
+ the region. It stays in the ruler in grey, and another double-click turns it back on. A
+ double-click elsewhere on the ruler still moves the playhead.
+- **Close the start screen with Esc or a click outside it** (nota-daw/nota#67): either one
+ closes it like its close button and keeps the current project. While Settings or What's New
+ is open from the start screen, a click outside goes back to that dialog instead.
- **Piano roll vertical zoom** (nota-daw/nota#43): make rows taller to hit notes precisely,
or shorter to see the whole keyboard (6–36 px; at the smallest, all 88 keys fit in about
530 px). Zoom with ⌘⌥ + wheel (Ctrl + Alt on Windows and Linux), by dragging on the keys
@@ -79,6 +86,12 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
- **The browser preview follows Appearance → Waveform** (nota-daw/nota#107): with Solid
chosen, the sample player under the browser draws a continuous waveform too, and
switching the setting redraws a preview that is already showing.
+- **The Clip editor keeps its height** (nota-daw/nota#53): clicking clips no longer makes
+ the panel at the bottom a little shorter each time at display scaling such as 150 % or
+ 175 %. The height you drag it to is kept.
+- **Stop also stops Session clips** (nota-daw/nota#139): the transport's Stop (Return, or
+ Space while playing) now stops the clips launched in the Session view right away, as Stop
+ all clips does. Before, they stayed launched and started again on the next Play.
### Added
- **Loop recording: Overdub or Replace** (nota-daw/nota#29): when you record MIDI in a loop,
diff --git a/src/managed/Nota.App/ArrangementView.Controls.cs b/src/managed/Nota.App/ArrangementView.Controls.cs
index 45ef6054..ca32797d 100644
--- a/src/managed/Nota.App/ArrangementView.Controls.cs
+++ b/src/managed/Nota.App/ArrangementView.Controls.cs
@@ -27,6 +27,7 @@ public sealed partial class ArrangementView
private double _pressBeat;
private bool _dragging; // a click scrubs the playhead; a drag defines a loop region
+ private bool _toggled; // this press double-clicked the loop brace: no seek, no drag
private double BeatAt(PointerEventArgs e) => _o._scrollBeats + e.GetPosition(this).X / _o._pixelsPerBeat;
@@ -35,20 +36,23 @@ public sealed partial class ArrangementView
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
_pressBeat = BeatAt(e);
_dragging = false;
+ // Double-click on the loop brace turns the loop off / on; the region stays (#59).
+ _toggled = e.ClickCount == 2 && _o.ToggleLoopAt(_pressBeat);
e.Pointer.Capture(this); e.Handled = true;
}
protected override void OnPointerMoved(PointerEventArgs e)
{
- if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
+ if (_toggled || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
double cur = BeatAt(e);
if (!_dragging && Math.Abs(cur - _pressBeat) * _o._pixelsPerBeat > 4) _dragging = true;
if (_dragging) _o.SetLoopPreview(_pressBeat, cur);
}
protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
- if (_dragging) _o.CommitLoopPreview(); // drag → loop region
+ if (_toggled) { } // the double-click already toggled the loop
+ else if (_dragging) _o.CommitLoopPreview(); // drag → loop region
else _o.SeekTo(_pressBeat); // plain click → scrub playhead
- _dragging = false;
+ _dragging = false; _toggled = false;
e.Pointer.Capture(null);
}
@@ -57,16 +61,18 @@ public sealed partial class ArrangementView
double w = Bounds.Width, h = Bounds.Height;
ctx.FillRectangle(ChromeBg, new Rect(0, 0, w, h));
- // Loop brace across the ruler (drawn under bars/labels/playhead).
- if (_o._loopActive && _o._loopE > _o._loopS)
+ // Loop brace across the ruler (drawn under bars/labels/playhead). A switched-off
+ // loop keeps its region, drawn in grey, so a double-click can bring it back.
+ if (_o._loopE > _o._loopS)
{
double lx0 = _o.BeatToX(_o._loopS), lx1 = _o.BeatToX(_o._loopE);
if (lx1 > 0 && lx0 < w)
{
+ var (fill, edge) = _o._loopActive ? (LoopBrace, LoopEdge) : (LoopBraceOff, LoopEdgeOff);
double cx0 = Math.Max(0, lx0), cx1 = Math.Min(w, lx1);
- ctx.FillRectangle(LoopBrace, new Rect(cx0, 0, cx1 - cx0, h));
- if (lx0 >= 0) ctx.DrawLine(LoopEdge, new Point(lx0, 0), new Point(lx0, h));
- if (lx1 <= w) ctx.DrawLine(LoopEdge, new Point(lx1, 0), new Point(lx1, h));
+ ctx.FillRectangle(fill, new Rect(cx0, 0, cx1 - cx0, h));
+ if (lx0 >= 0) ctx.DrawLine(edge, new Point(lx0, 0), new Point(lx0, h));
+ if (lx1 <= w) ctx.DrawLine(edge, new Point(lx1, 0), new Point(lx1, h));
}
}
diff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.cs
index 7eeda67e..de075fec 100644
--- a/src/managed/Nota.App/ArrangementView.cs
+++ b/src/managed/Nota.App/ArrangementView.cs
@@ -644,6 +644,18 @@ public sealed partial class ArrangementView : UserControl
LoopChanged?.Invoke();
}
+ /// <summary>Turn the loop off / on when <paramref name="beat"/> is on the loop brace,
+ /// keeping its region (double-click on the ruler, #59). False when it isn't.</summary>
+ internal bool ToggleLoopAt(double beat)
+ {
+ if (_engine is null || _loopDragging || !(_loopE > _loopS) || beat < _loopS || beat > _loopE) return false;
+ _loopActive = !_loopActive;
+ _engine.SetLoop(_loopActive, _loopS, _loopE);
+ Redraw();
+ LoopChanged?.Invoke();
+ return true;
+ }
+
private (double Start, double End) SnapLoopRange(double a, double b)
{
double s = Math.Max(0, Snap(Math.Min(a, b)));
@@ -2727,6 +2739,9 @@ public sealed partial class ArrangementView : UserControl
private static readonly IBrush LoopBrace = NotaPalette.Wash(NotaPalette.AccentBright, 0x66);
private static readonly IBrush LoopBand = NotaPalette.Wash(NotaPalette.AccentBright, 0x14);
private static readonly IPen LoopEdge = new Pen(NotaPalette.Wash(NotaPalette.AccentBright, 0xA0), 1);
+ // A switched-off loop keeps its brace on the ruler, in neutral grey (the accent is for what's live).
+ private static readonly IBrush LoopBraceOff = NotaPalette.Wash(NotaPalette.TextTertiary, 0x38);
+ private static readonly IPen LoopEdgeOff = new Pen(NotaPalette.Wash(NotaPalette.TextTertiary, 0x80), 1);
// Automation overlay (M9-A3): a scrim mutes the clip content, a dashed line marks
// the flat baseline of an empty lane.
private static readonly IBrush AutoScrim = NotaPalette.Wash(NotaPalette.BgSunken, 0xC0);
diff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.cs
index 3133d721..6a63a3d4 100644
--- a/src/managed/Nota.App/MainWindow.Detail.cs
+++ b/src/managed/Nota.App/MainWindow.Detail.cs
@@ -130,7 +130,6 @@ public partial class MainWindow
var row = BodyGrid.RowDefinitions[2];
row.MinHeight = 120;
double h = honorPersist && _detailHeight > 120 ? _detailHeight : height;
- _lastSetDetailHeight = h;
row.Height = new GridLength(h);
DetailSplitter.IsVisible = true;
DetailPanel.IsVisible = true;
diff --git a/src/managed/Nota.App/MainWindow.Welcome.cs b/src/managed/Nota.App/MainWindow.Welcome.cs
index d92e9583..80c94ace 100644
--- a/src/managed/Nota.App/MainWindow.Welcome.cs
+++ b/src/managed/Nota.App/MainWindow.Welcome.cs
@@ -9,6 +9,8 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
+using Avalonia.Input;
+using Avalonia.Interactivity;
using Microsoft.Extensions.DependencyInjection;
using Nota.Application;
using Nota.Presentation;
@@ -19,7 +21,7 @@ public partial class MainWindow
{
private const int MaxRecentProjects = 10;
- /// <summary>Show the welcome launcher as a modal over the (empty) main window.</summary>
+ /// <summary>Show the welcome launcher over the (empty) main window; completes when it closes.</summary>
private async Task ShowWelcomeAsync()
{
var settings = App.Services.GetRequiredService<ISettingsService>();
@@ -62,7 +64,20 @@ public partial class MainWindow
});
}, TaskScheduler.Default);
- await win.ShowDialog(this);
+ // Shown owned rather than modal, so a click on the main window behind it can close it
+ // like the close button does (#67) — not while the launcher has its own dialog open
+ // (Settings, What's New), which that click is meant to come back to.
+ var closed = new TaskCompletionSource();
+ void OutsidePress(object? s, PointerPressedEventArgs e)
+ {
+ if (win.OwnedWindows.Count > 0) return;
+ win.Close();
+ e.Handled = true; // the click only dismisses; it doesn't also act on the main window
+ }
+ AddHandler(PointerPressedEvent, OutsidePress, RoutingStrategies.Tunnel);
+ win.Closed += (_, _) => { RemoveHandler(PointerPressedEvent, OutsidePress); closed.TrySetResult(); };
+ win.Show(this);
+ await closed.Task;
}
// Turn the persisted path list into displayable rows, dropping folders that no longer
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index d3610b5a..2a8f67de 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -74,7 +74,6 @@ public partial class MainWindow : Window
// Remembered detail-panel height once the user drags the splitter, so reopening the
// panel keeps their size instead of snapping back to the per-mode default. 0 = unset.
private double _detailHeight;
- private double _lastSetDetailHeight;
// True while the detail panel (Devices/Clip) was the last area the user interacted
// with — Tab then toggles between the two tabs.
private bool _detailWasLastFocused;
@@ -454,14 +453,15 @@ public partial class MainWindow : Window
// Remember the detail panel's height once the user drags the splitter — but only
// on the Clip tab. The Devices tab keeps its natural card-fitting height, so its
- // drags aren't persisted (a programmatic set matches _lastSetDetailHeight and is
- // ignored; only a real drag differs).
- DetailPanel.SizeChanged += (_, e) =>
+ // drags aren't persisted. Only a finished splitter drag counts, and it stores the
+ // row's height (what ShowDetail sets), not the panel's: the panel sits 1px inside its
+ // row, and at fractional display scaling every re-show used to be recorded as a
+ // slightly shorter "drag", so the Clip tab shrank on each clip click (#53).
+ DetailSplitter.DragCompleted += (_, _) =>
{
bool clipActive = DetailBody.Content is ClipEditorView or AudioClipEditorView or DrumPatternView;
- if (clipActive && DetailPanel.IsVisible && e.NewSize.Height > 120
- && Math.Abs(e.NewSize.Height - _lastSetDetailHeight) > 1.0)
- _detailHeight = e.NewSize.Height;
+ double h = BodyGrid.RowDefinitions[2].ActualHeight;
+ if (clipActive && DetailPanel.IsVisible && h > 120) _detailHeight = h;
};
// Track whether the detail panel was the last area the user clicked into, so Tab
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index ad4557d6..15a2bfb4 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -1100,6 +1100,7 @@ public sealed partial class PreferencesWindow : NotaWindow
("⌘R", "Record"),
("⌘M", "Metronome"),
("⌘L", "Loop on / off · loop the selected clips or time range"),
+ ("Double-click loop brace", "Loop on / off in the ruler · the region stays, greyed out while off"),
("⌘⇧R", "Loop recording: Overdub (every pass adds) / Replace (keep the latest pass)"),
}),
("Arrangement & editing", new[]
diff --git a/src/managed/Nota.App/WelcomeWindow.cs b/src/managed/Nota.App/WelcomeWindow.cs
index 3b4d0b86..f71c7bde 100644
--- a/src/managed/Nota.App/WelcomeWindow.cs
+++ b/src/managed/Nota.App/WelcomeWindow.cs
@@ -267,10 +267,12 @@ public sealed class WelcomeWindow : NotaWindow
private int _selected = -1;
private bool _opening;
- // ↑ / ↓ move the selection through the recent list, Return opens it.
+ // ↑ / ↓ move the selection through the recent list, Return opens it. Esc closes the
+ // launcher like its close button: the current project stays (#67).
protected override void OnKeyDown(KeyEventArgs e)
{
- if (_rows.Count > 0 && !_opening)
+ if (e.Key == Key.Escape && !_opening) { Close(); e.Handled = true; }
+ else if (_rows.Count > 0 && !_opening)
{
switch (e.Key)
{
diff --git a/src/native/nota.engine/src/Engine.cpp b/src/native/nota.engine/src/Engine.cpp
index 894a8c37..0014e842 100644
--- a/src/native/nota.engine/src/Engine.cpp
+++ b/src/native/nota.engine/src/Engine.cpp
@@ -413,6 +413,18 @@ void Engine::transportPlayCountIn() {
void Engine::transportStop() {
arrangementActive_.store(false, std::memory_order_relaxed);
finalizeSessionRecord(false); // don't lose an in-progress session take on a global stop
+ // Stop means everything stops, Session clips included (#139). Immediately, not on the
+ // next launch boundary: the clock halts with this command, so a quantized stop would
+ // never land and the clips would stay launched (and resume on the next Play).
+ // Only tracks with a clip launched or queued: applying a stop flushes the track's notes
+ // and MIDI effects, which must not touch a track that plays the Arrangement.
+ if (authoring_)
+ for (auto& t : authoring_->tracks)
+ if (auto& sp = t->sessionPlayer;
+ sp && (sp->playing.load(std::memory_order_relaxed) >= 0
+ || sp->pending.load(std::memory_order_relaxed) != SessionPlayer::kNone))
+ sp->requestStopNow();
+ sceneFollowScene_ = -1;
Command c; c.type = CommandType::TransportStop; commands_.push(c);
}
// Hand every track back to the Arrangement: stop all session clips + re-activate the timeline.
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index b9254946..5e6ee509 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -8047,6 +8047,26 @@ engine.StopTransport();
engine.StopTransport();
}
+// -- Transport Stop also stops Session clips, at once (#139) --
+{
+ using var e = new NotaEngine();
+ e.SetBpm(120); e.SetLaunchQuant(1.0); // a quantized stop would wait for a bar line
+ int st = e.AddInstrumentTrack();
+ e.AddSessionMidiClip(st, 0, 4.0);
+ e.SetSessionNotes(st, 0, new[] { new NotaNote(60, 0.0, 4.0, 1.0f) });
+ e.LaunchSlot(st, 0);
+ e.RenderOffline(buf, 2048);
+ Check(e.SessionSlotState(st, 0) == 3, "a launched session clip plays");
+ e.StopTransport();
+ e.RenderOffline(buf, 64); // the stop lands on the next block
+ Check(e.SessionSlotState(st, 0) == 1, "transport Stop stops the session clip (back to filled)");
+ e.Play();
+ e.RenderOffline(buf, frames);
+ Check(e.SessionSlotState(st, 0) == 1 && Rms(buf, frames) < 1e-5f,
+ $"…and Play afterwards doesn't bring it back (rms={Rms(buf, frames):F5})");
+ e.StopTransport();
+}
+
// -- Session vs Arrangement: a session-only jam must NOT roll the Arrangement --
{
using var e = new NotaEngine();