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) History first save, Session Return/Master select, File → Exit (#323)
Chris Laupama68e50a74c0f6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7e2d64d0..44cd01a1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,9 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.## [Unreleased]### Added+- **File → Exit** (nota-daw/nota#316): Windows and Linux can quit from the menu or with+ Ctrl+Q, the same way as the window's close button, so unsaved changes still ask first. On+ macOS Quit Nota (⌘Q) stays in the app menu.- **Wrap a device in a rack with ⌘G** (nota-daw/nota#257): with a device selected in the chain,⌘G puts it in an Audio Effect Rack in its place, settings and all, and ⌘⇧G takes the devicesof a one-chain rack back out. Also in the device's right-click menu (**Group into rack** /@@ -37,6 +40,12 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.at full detail instead of in blocks.### Fixed+- **History tab shows the first save** (nota-daw/nota#317): with the History tab open, the first+ save of a new project (and Save as…) now lists its version straight away instead of after a+ tab switch.+- **Select Return and Master in the Session view** (nota-daw/nota#314): clicking a Return or+ the Master column header selects that track like in the Arrangement: the header lights up,+ the Devices panel shows its chain and the inspector says what it is.- **Drum Rack pads play their whole hit** (nota-daw/nota#312): a pad with a sample that isn'tlooped 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.diff --git a/src/managed/Nota.App/MainWindow.Commands.cs b/src/managed/Nota.App/MainWindow.Commands.csindex 7b089a87..e4963b55 100644--- a/src/managed/Nota.App/MainWindow.Commands.cs+++ b/src/managed/Nota.App/MainWindow.Commands.cs@@ -43,6 +43,7 @@ public partial class MainWindowB("file.saveVersion", () => OnMenuSaveVersion(this, e));B("file.import", () => OnMenuImport(this, e));B("file.export", () => OnMenuExport(this, e));+ B("file.exit", Close); // the close button's path: unsaved changes still ask first (#316)// ---- EditB("edit.undo", () => OnMenuUndo(this, e), _ => Need(_vm?.Engine.CanUndo == true, "Nothing to undo"));diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.csindex 20a5f096..9fbafee5 100644--- a/src/managed/Nota.App/MainWindow.Files.cs+++ b/src/managed/Nota.App/MainWindow.Files.cs@@ -349,8 +349,10 @@ public partial class MainWindowTimeline.SaveTrackView(dir); // track heights + track-list width (sidecar)SaveFreezeLinks(dir); // live-freeze links (v1.1) ride in the bundle sidecar_analysis.AdoptInto(dir); // analysis cached while unsaved moves into the bundle- string? historyNote = RecordVersion(dir, previousPath, note); // after every sidecar is written+ // The bundle is written, so it's the open project now: set the path before the+ // version is recorded, since the History tab refreshes against it (#317)._projectPath = dir;+ string? historyNote = RecordVersion(dir, previousPath, note); // after every sidecar is writtenRecordRecentProject(dir); // surface it on the welcome screen next launchUpdateWindowTitle();MarkProjectClean();diff --git a/src/managed/Nota.App/MainWindow.MenuKeys.cs b/src/managed/Nota.App/MainWindow.MenuKeys.csindex 084e596e..504ee7e1 100644--- a/src/managed/Nota.App/MainWindow.MenuKeys.cs+++ b/src/managed/Nota.App/MainWindow.MenuKeys.cs@@ -30,6 +30,8 @@ public partial class MainWindowforeach (var c in new Control[] { RecordBtn, LoopRecordCell, MetronomeBtn })if (ToolTip.GetTip(c) is string tip) ToolTip.SetTip(c, MenuKit.Keys(tip));if (NativeMenu.GetMenu(this) is not { } menu) return;+ // macOS quits from the app menu (Quit Nota, ⌘Q); File → Exit is for Windows / Linux (#316).+ if (OperatingSystem.IsMacOS()) RemoveWithSeparatorAbove(menu, "file.exit");Collect(menu);void Collect(NativeMenu m)@@ -53,6 +55,23 @@ public partial class MainWindow}}+ // Drops the item bound to commandId (searching submenus) and the separator just above it.+ private static bool RemoveWithSeparatorAbove(NativeMenu m, string commandId)+ {+ for (int i = 0; i < m.Items.Count; i++)+ {+ if (m.Items[i] is not NativeMenuItem item) continue;+ if (Commands.GetId(item) == commandId)+ {+ m.Items.RemoveAt(i);+ if (i > 0 && m.Items[i - 1] is NativeMenuItemSeparator) m.Items.RemoveAt(i - 1);+ return true;+ }+ if (item.Menu is { } sub && RemoveWithSeparatorAbove(sub, commandId)) return true;+ }+ return false;+ }+private NativeMenuItem? MenuItemFor(string commandId) => _menuItems.GetValueOrDefault(commandId);/// <summary>Runs the menu command whose gesture the key matches (Windows / Linux only).</summary>diff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axamlindex 15141f48..295a9683 100644--- a/src/managed/Nota.App/MainWindow.axaml+++ b/src/managed/Nota.App/MainWindow.axaml@@ -31,6 +31,8 @@<NativeMenuItem Header="Export audio…" app:Commands.Id="file.export"/><NativeMenuItemSeparator/><NativeMenuItem Header="Settings…" app:Commands.Id="prefs.open"/>+ <NativeMenuItemSeparator/>+ <NativeMenuItem Header="Exit" app:Commands.Id="file.exit"/></NativeMenu></NativeMenuItem.Menu></NativeMenuItem>diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.csindex e5e879f2..2efd7c19 100644--- a/src/managed/Nota.App/PreferencesWindow.cs+++ b/src/managed/Nota.App/PreferencesWindow.cs@@ -1125,6 +1125,7 @@ public sealed partial class PreferencesWindow : NotaWindow("⌥⌘S", "Save a version with a note"),("⌘⇧E", "Export audio"),("⌘,", "Settings"),+ ("⌘Q", "Quit Nota · asks about unsaved changes first"),}),("Window", new[]{diff --git a/src/managed/Nota.App/SessionView.Grid.cs b/src/managed/Nota.App/SessionView.Grid.csindex 027ce260..876182ac 100644--- a/src/managed/Nota.App/SessionView.Grid.cs+++ b/src/managed/Nota.App/SessionView.Grid.cs@@ -277,7 +277,9 @@ public sealed partial class SessionView{var pp = e.GetCurrentPoint(this).Properties;if (pp.IsRightButtonPressed) { e.Handled = true; o.ShowHeaderMenu(this, c); return; }- if (!pp.IsLeftButtonPressed || c.Kind is not (ColKind.Track or ColKind.Group)) return;+ if (!pp.IsLeftButtonPressed) return;+ // A Return / Master column selects that track (Devices follow); it has no slots (#314).+ if (c.Kind is ColKind.Return or ColKind.Master) { o.Select(new Selection(SelKind.Bus, o.BusId(c), o._sel.Scene)); return; }if (e.ClickCount == 2) { o.PromptRenameTrack(this, c.TrackId); return; }o.Select(new Selection(SelKind.Slot, c.TrackId, o._sel.Scene));};@@ -286,7 +288,9 @@ public sealed partial class SessionViewpublic void Sync(){- bool sel = _o._sel.Kind == SelKind.Slot && _o._sel.TrackId == _c.TrackId && _c.Kind is ColKind.Track or ColKind.Group;+ bool sel = _c.Kind is ColKind.Track or ColKind.Group+ ? _o._sel.Kind == SelKind.Slot && _o._sel.TrackId == _c.TrackId+ : _o._sel.Kind == SelKind.Bus && _o._sel.TrackId == _o.BusId(_c);Background = sel ? NotaPalette.SelHeaderBg : _c.Kind is ColKind.Return or ColKind.Master ? NotaPalette.Panel : NotaPalette.SurfaceCard;BorderBrush = sel ? NotaPalette.AccentDim : Brushes.Transparent;if (_arr is not null) _arr.IsVisible = _o._engine.SessionPlayingSlot(_c.TrackId) >= 0;diff --git a/src/managed/Nota.App/SessionView.Inspector.cs b/src/managed/Nota.App/SessionView.Inspector.csindex c5b471b4..596f0f00 100644--- a/src/managed/Nota.App/SessionView.Inspector.cs+++ b/src/managed/Nota.App/SessionView.Inspector.cs@@ -52,6 +52,7 @@ public sealed partial class SessionViewelse if (SlotFilled(c.TrackId, _sel.Scene) && !(_recTrack == c.TrackId && _recScene == _sel.Scene)) BuildClipInspector(stack, c, _sel.Scene);else BuildEmptyInspector(stack, c, _sel.Scene);}+ else if (_sel.Kind == SelKind.Bus && BusColumn(_sel.TrackId) is { } bus) BuildBusInspector(stack, bus);var hint = new TextBlock{@@ -428,6 +429,19 @@ public sealed partial class SessionViews.Children.Add(Actions(actions.ToArray()));}+ // A Return / Master column (#314): no slots to launch; its devices are in the panel below.+ private void BuildBusInspector(StackPanel s, Column c)+ {+ s.Children.Add(Title(c.Kind == ColKind.Master ? NotaPalette.Master : c.Brush, c.Name, c.Kind == ColKind.Master ? "MASTER" : "RETURN"));+ s.Children.Add(new TextBlock+ {+ Text = c.Kind == ColKind.Master+ ? "Every track ends up here. Its devices are in the Devices panel."+ : "Tracks reach it through their sends. It has no clip slots; its devices are in the Devices panel.",+ FontSize = 11, LineHeight = 16, Foreground = NotaPalette.TextTertiary, TextWrapping = TextWrapping.Wrap,+ });+ }+private void BuildGroupInspector(StackPanel s, Column g, int scene){s.Children.Add(Title(g.Brush, $"{g.Name} · {SceneName(scene)}", $"GROUP SLOT · {g.Children.Count} TRACKS"));diff --git a/src/managed/Nota.App/SessionView.cs b/src/managed/Nota.App/SessionView.csindex 33fba7d1..024e4c2c 100644--- a/src/managed/Nota.App/SessionView.cs+++ b/src/managed/Nota.App/SessionView.cs@@ -68,7 +68,7 @@ public sealed partial class SessionView : UserControlprivate int _sceneCount;// UI-only state: which group columns are folded, which mixer sections show, and the- // selection (a slot on a track or group column, or a scene row).+ // selection (a slot on a track or group column, a scene row, or a Return / Master column).private readonly HashSet<int> _collapsed = new();private bool _showIO, _showSends = true, _showMixer = true;private bool _selectNextOnLaunch;@@ -78,12 +78,13 @@ public sealed partial class SessionView : UserControlprivate bool _blinkOn = true;private bool _sessionActive;- internal enum SelKind { Slot, Scene }+ internal enum SelKind { Slot, Scene, Bus } // Bus: a Return / Master column, which has no slots (#314)internal readonly record struct Selection(SelKind Kind, int TrackId, int Scene);/// <summary>Raised to edit a filled slot's notes / audio (trackId, scene).</summary>public event Action<int, int>? SlotEditRequested;- /// <summary>Raised when the selection lands on a track's slot (trackId, scene).</summary>+ /// <summary>Raised when the selection lands on a track's slot, or on a Return / Master column+ /// (trackId, scene).</summary>public event Action<int, int>? SlotSelected;/// <summary>Raised after slots are copied / moved into the arrangement (M5-6) or a track is renamed.</summary>public event Action? ArrangementChanged;@@ -177,6 +178,9 @@ public sealed partial class SessionView : UserControlprivate Column? ColumnFor(int trackId) => _cols.FirstOrDefault(c => c.TrackId == trackId && c.Kind is ColKind.Track or ColKind.Group);private IEnumerable<Column> LaunchCols => _cols.Where(c => c.Kind == ColKind.Track);private List<Column> NavCols => _cols.Where(c => c.Kind is ColKind.Track or ColKind.Group).ToList();+ // A Return / Master column's track id (the Master column itself is built with id 0).+ private int BusId(Column c) => c.Kind == ColKind.Master ? _engine.MasterTrackId : c.TrackId;+ private Column? BusColumn(int trackId) => _cols.FirstOrDefault(c => c.Kind is ColKind.Return or ColKind.Master && BusId(c) == trackId);public void Refresh(){@@ -193,6 +197,7 @@ public sealed partial class SessionView : UserControl// Keep the selection on something that still exists.if (_sel.Scene >= _sceneCount) _sel = _sel with { Scene = Math.Max(0, _sceneCount - 1) };+ if (_sel.Kind == SelKind.Bus && BusColumn(_sel.TrackId) is null) _sel = new Selection(SelKind.Slot, 0, _sel.Scene);if (_sel.Kind == SelKind.Slot && ColumnFor(_sel.TrackId) is null)_sel = NavCols.FirstOrDefault() is { } first ? _sel with { TrackId = first.TrackId } : new Selection(SelKind.Scene, 0, _sel.Scene);@@ -309,7 +314,8 @@ public sealed partial class SessionView : UserControl_sel = sel;InvalidateAll();RebuildInspector();- if (sel.Kind == SelKind.Slot && (prev.Kind != SelKind.Slot || prev.TrackId != sel.TrackId) && ColumnFor(sel.TrackId) is not null)+ bool selectable = sel.Kind == SelKind.Slot ? ColumnFor(sel.TrackId) is not null : sel.Kind == SelKind.Bus && BusColumn(sel.TrackId) is not null;+ if (selectable && (prev.Kind != sel.Kind || prev.TrackId != sel.TrackId))SlotSelected?.Invoke(sel.TrackId, sel.Scene);}@@ -403,6 +409,7 @@ public sealed partial class SessionView : UserControl/// <summary>⌘C on the selected slot.</summary>public bool CopySelection(){+ if (_sel.Kind == SelKind.Bus) return true; // a Return / Master has no clip to act on; keep it from reaching the Arrangementif (_sel.Kind != SelKind.Slot || !SlotFilled(_sel.TrackId, _sel.Scene)) return false;ClipTransfer.TookSlot(_sel.TrackId, _sel.Scene, cut: false);Say("Copied clip");@@ -412,6 +419,7 @@ public sealed partial class SessionView : UserControl/// <summary>⌘X: the clip moves to where it is pasted next.</summary>public bool CutSelection(){+ if (_sel.Kind == SelKind.Bus) return true; // a Return / Master has no clip to act on; keep it from reaching the Arrangementif (_sel.Kind != SelKind.Slot || !SlotFilled(_sel.TrackId, _sel.Scene)) return false;ClipTransfer.TookSlot(_sel.TrackId, _sel.Scene, cut: true);Say("Cut clip — paste to move it");@@ -424,6 +432,7 @@ public sealed partial class SessionView : UserControl/// <summary>⌘V onto the selected slot (clips copied in the arrangement: also onto a scene row).</summary>public bool PasteSelection(){+ if (_sel.Kind == SelKind.Bus) return true; // a Return / Master has no clip to act on; keep it from reaching the Arrangementif (ClipTransfer.FromArrangement(_engine)) return PasteFromArrangement();if (_sel.Kind != SelKind.Slot || ClipTransfer.Slot is not { } src) return false;if (ColumnFor(_sel.TrackId) is not { Kind: ColKind.Track }) return false;@@ -492,6 +501,7 @@ public sealed partial class SessionView : UserControl/// <summary>⌘D: a scene duplicates below itself; a clip copies into the empty slot below.</summary>public bool DuplicateSelection(){+ if (_sel.Kind == SelKind.Bus) return true; // a Return / Master has no clip to act on; keep it from reaching the Arrangementif (_sel.Kind == SelKind.Scene){int s = _engine.DuplicateScene(_sel.Scene);@@ -502,7 +512,7 @@ public sealed partial class SessionView : UserControlreturn true;}int below = _sel.Scene + 1;- if (!SlotFilled(_sel.TrackId, _sel.Scene)) return false;+ if (_sel.Kind != SelKind.Slot || !SlotFilled(_sel.TrackId, _sel.Scene)) return false;if (below >= _sceneCount || SlotFilled(_sel.TrackId, below)) { Say("The slot below is taken."); return true; }MoveOrCopySlot(_sel.TrackId, _sel.Scene, _sel.TrackId, below, move: false);Select(_sel with { Scene = below });@@ -513,6 +523,7 @@ public sealed partial class SessionView : UserControl/// <summary>⌫: delete the selected clip or scene.</summary>public bool DeleteSelection(){+ if (_sel.Kind == SelKind.Bus) return true; // a Return / Master has no clip to act on; keep it from reaching the Arrangementif (_sel.Kind == SelKind.Scene){if (!_engine.RemoveScene(_sel.Scene)) return false;@@ -520,7 +531,7 @@ public sealed partial class SessionView : UserControlSay("Deleted scene");return true;}- if (!_engine.ClearSessionSlot(_sel.TrackId, _sel.Scene)) return false;+ if (_sel.Kind != SelKind.Slot || !_engine.ClearSessionSlot(_sel.TrackId, _sel.Scene)) return false;RefreshSlot(_sel.TrackId, _sel.Scene);Say("Deleted clip");return true;@@ -620,7 +631,23 @@ public sealed partial class SessionView : UserControlelse if (key == Key.Right && nav.Count > 0) Select(new Selection(SelKind.Slot, nav[0].TrackId, s));return;}+ // Return / Master columns (#314) have no slots: ← / → walk them in column order, back+ // into the last track column on the left; ↑ / ↓ have nowhere to go.+ var buses = _cols.Where(c => c.Kind is ColKind.Return or ColKind.Master).ToList();+ if (_sel.Kind == SelKind.Bus)+ {+ int b = buses.FindIndex(c => BusId(c) == _sel.TrackId);+ if (key == Key.Left)+ {+ if (b > 0) Select(new Selection(SelKind.Bus, BusId(buses[b - 1]), s));+ else if (nav.Count > 0) Select(new Selection(SelKind.Slot, nav[^1].TrackId, s));+ else Select(new Selection(SelKind.Scene, 0, s));+ }+ else if (key == Key.Right && b >= 0 && b < buses.Count - 1) Select(new Selection(SelKind.Bus, BusId(buses[b + 1]), s));+ return;+ }int i = Math.Max(0, nav.FindIndex(c => c.TrackId == _sel.TrackId));+ if (key == Key.Right && i == nav.Count - 1 && buses.Count > 0) { Select(new Selection(SelKind.Bus, BusId(buses[0]), s)); return; }if (key == Key.Up) s = Math.Max(0, s - 1);if (key == Key.Down) s = Math.Min(last, s + 1);if (key == Key.Left) { if (i == 0) { Select(new Selection(SelKind.Scene, 0, s)); return; } i--; }diff --git a/src/managed/Nota.Application/Palette/CommandCatalog.cs b/src/managed/Nota.Application/Palette/CommandCatalog.csindex 1374e3b1..1f494960 100644--- a/src/managed/Nota.Application/Palette/CommandCatalog.cs+++ b/src/managed/Nota.Application/Palette/CommandCatalog.cs@@ -28,6 +28,7 @@ public static class CommandCatalogC("file.saveVersion", "Save version with note…", "File", Shortcut.CmdAlt('S'), "snapshot history commit"),C("file.import", "Import audio…", "File", "", "add file wav"),C("file.export", "Export audio…", "File", Shortcut.CmdShift('E'), "render bounce mixdown stems"),+ C("file.exit", "Exit Nota", "File", Shortcut.Cmd('Q'), "quit close leave"),// ---- Edit -------------------------------------------------------------------------C("edit.undo", "Undo", "Edit", Shortcut.Cmd('Z'), "back revert"),