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) Small UI fixes: Open recent, loop saved, −∞ in the Mixer, DSP meter, plug-in editor button (#465)
Egor Khindikaynenec67c2bcd1df
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3ad47b0d..11bac648 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,9 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.## [Unreleased]### Added+- **File → Open recent** (#443): the recent projects from the start window, newest first, are+ in the File menu too, so another project is two clicks away while you work. Picking one asks+ to save your changes first, as Open… does; hover an entry to see where it lives.- **Pick the Bend lane's range in the piano roll** (#426): the **±2 st** label at the topleft of the Bend lane is now a menu — ±2, 12, 24, 48 or 96 semitones — so a bend wider than2 semitones can be drawn on a note that has none, without recording one from an MPE@@ -198,6 +201,17 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.returns, then the master.### Fixed+- **The loop region is saved with the project** (#455): its start and end, and whether the+ loop is on, come back when you open the project again. A new project starts without one.+- **The Mixer's volume reaches −∞** (#453): a fader pulled all the way down, a dB value dragged+ to the bottom, or `-inf` typed in it now reads **−∞** instead of −60 dB.+- **Open editor follows the plug-in's window** (#458): closing a plug-in's window with its own+ close button turns the card's **Close editor** back into **Open editor** right away, not on+ the next hover.+- **The DSP meter no longer nudges the transport bar** (#442): its readout keeps room for+ "DSP 100%", so going from 9 % to 10 % doesn't shift the master strip beside it.+- **Settings… appears once on macOS** (#444): it is in the Nota menu (⌘,) only; File no+ longer repeats it.- **Plug-in instruments use less CPU on busy MIDI** (#436): a hosted instrument (Kontakt,Serum, any AU or VST3) is now processed once per audio block, with every note and controllerplaced at its exact sample inside the block. Before, the block was cut at every MIDI event anddiff --git a/FEATURES.md b/FEATURES.mdindex 358bfd89..6f32d876 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -71,6 +71,8 @@ on a pool of render threads, export and freeze use every core, and an idle engin- **Start window**: the logo follows the theme, recent projects sit in one compact list withtheir dates — click to select, double-click (or the arrow keys and Return) to open. Escapeor a click outside closes it, keeping the current project.+- **File → Open recent** lists the start window's recent projects, newest first; picking one+ asks to save unsaved changes first.- **File → Exit** (Ctrl+Q) on Windows and Linux; Quit Nota (⌘Q) in the app menu on macOS.- **Quit without saving** dialog names the project and how long its changes have goneunsaved; Return saves (right in the dialog, then quits), Escape cancels.@@ -95,7 +97,7 @@ on a pool of render threads, export and freeze use every core, and an idle engintempo from tapped beats — mean of the last eight gaps, restarts on a pace change or a 3 s pause.- **Loop region** (on/off and range; Cmd/Ctrl+L loops the selection; drag an end of the braceto resize it, the brace to move it; double-click the brace to switch the loop off and on;- right-click the ruler to clear it). Notes held across the+ right-click the ruler to clear it; saved with the project). Notes held across theloop seam keep sounding and release tails ring into the next pass; an arpeggiator keeps itspattern going across the seam.- **Metronome** and **count-in** before recording, Session slot takes from stop included (notes played on the count-in are recorded).diff --git a/src/managed/Nota.App/Controls/DragNumber.cs b/src/managed/Nota.App/Controls/DragNumber.csindex c3b5083b..ec682cc3 100644--- a/src/managed/Nota.App/Controls/DragNumber.cs+++ b/src/managed/Nota.App/Controls/DragNumber.cs@@ -62,7 +62,14 @@ public sealed class DragNumber : UserControlset { _value = Math.Clamp(value, _min, _max); Refresh(); }}- private void Refresh() => _display.Text = _value.ToString(_format, NotaNum.Culture);+ /// <summary>Shown instead of the number when the value sits at the bottom of the range —+ /// "−∞" for a gain whose floor means silence. Typing it ("-inf") lands there too.</summary>+ public string? FloorText { get => _floorText; init { _floorText = value; Refresh(); } }+ private readonly string? _floorText;++ private string Shown => FloorText is { } floor && _value <= _min ? floor : _value.ToString(_format, NotaNum.Culture);++ private void Refresh() => _display.Text = Shown;protected override void OnPointerPressed(PointerPressedEventArgs e){@@ -113,7 +120,7 @@ public sealed class DragNumber : UserControlprivate void BeginEditor(){_editing = true;- _editor.Text = _value.ToString(_format, NotaNum.Culture);+ _editor.Text = Shown;_editor.IsVisible = true;_display.IsVisible = false;_editor.Focus();diff --git a/src/managed/Nota.App/DeviceCards/PluginCard.cs b/src/managed/Nota.App/DeviceCards/PluginCard.csindex a7b15327..0029b2fc 100644--- a/src/managed/Nota.App/DeviceCards/PluginCard.cs+++ b/src/managed/Nota.App/DeviceCards/PluginCard.cs@@ -111,18 +111,29 @@ internal static class PluginCardFact(facts, 1, "Latency", $"{ms.ToString("0.0", NotaNum.Culture)}\u2009ms");// Open editor toggles the plug-in's own window. Its close button only hides the- // window behind our back, so the label re-reads the state whenever the pointer comes- // back to the card instead of trusting the last click.+ // window behind our back (and MCP can open or close it too), so the label re-reads+ // the state a few times a second on the UI tick instead of trusting the last click.var open = ActionButton(Loc.T("Open editor"), GlyphKind.PopOut, primary: true);var openLabel = (TextBlock)((StackPanel)open.Content!).Children[1];+ bool? shownLast = null;void SyncOpen(){bool shown = EditorOpen(e, t, di);- openLabel.Text = shown ? "Close editor" : Loc.T("Open editor");+ if (shown == shownLast) return;+ shownLast = shown;+ openLabel.Text = shown ? Loc.T("Close editor") : Loc.T("Open editor");ToolTip.SetTip(open, shown ? Loc.T("Close the plug-in's own window") : Loc.T("Open the plug-in's own window"));}SyncOpen();- open.PointerEntered += (_, _) => SyncOpen();+ // By elapsed time, not tick count: the tick's rate depends on where the card is shown.+ long nextSync = 0;+ ctx.AddDeviceRefresher(() =>+ {+ long now = Environment.TickCount64;+ if (now < nextSync) return;+ nextSync = now + 250; // 4 times a second+ SyncOpen();+ });open.Click += (_, _) =>{trydiff --git a/src/managed/Nota.App/Languages/fr.json b/src/managed/Nota.App/Languages/fr.jsonindex 794349ad..0b1c58f5 100644--- a/src/managed/Nota.App/Languages/fr.json+++ b/src/managed/Nota.App/Languages/fr.json@@ -1855,6 +1855,7 @@"Clip editor: one clip": "Éditeur de clips : un seul clip","Clock out (patch bay)": "Clock out (patch bay)","Clock — Sync locks the pattern to the song's bars, Free runs it in Hz": "Clock — Sync cale le motif sur les mesures du morceau, Free le fait tourner en Hz",+ "Close editor": "Fermer l’éditeur","Close the plug-in's own window": "Fermer la fenêtre propre au plug-in","Cluster": "Cluster","Code": "Code",@@ -3557,6 +3558,7 @@"Off-beats": "Contretemps","Open chain": "Ouvrir la chaîne","Open editor": "Ouvrir l’éditeur",+ "Open recent": "Ouvrir un projet récent","Remove pad": "Retirer le pad","Replace instrument": "Remplacer l’instrument","Shift left": "Décaler à gauche",diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.csindex ce641819..458ff25d 100644--- a/src/managed/Nota.App/MainWindow.Files.cs+++ b/src/managed/Nota.App/MainWindow.Files.cs@@ -187,6 +187,8 @@ public partial class MainWindow_vm.Transport.MasterVolume = 1.0;_vm.Transport.MetronomeOn = false;_vm.Transport.LoopOn = false;+ Engine.SetLoop(false, 0, 0); // nor the old project's loop region+ _vm.Transport.SyncLoop();_vm.Transport.TimeSigNumerator = 4;_vm.Transport.TimeSigDenominator = 4;_vm.Transport.KeyCode = -1;@@ -271,7 +273,9 @@ public partial class MainWindow_vm.Transport.Bpm = (decimal)result.Transport.Bpm;_vm.Transport.MasterVolume = result.Transport.MasterVolume;_vm.Transport.MetronomeOn = result.Transport.MetronomeOn;- _vm.Transport.LoopOn = result.Transport.LoopOn;+ _vm.Transport.SyncLoop(); // the loop (on/off and its region) came with the project (#455)+ if (result.Transport.LoopOn && !Engine.LoopEnabled)+ _vm.Transport.LoopOn = true; // an older file saved no region: Loop on picks its default_vm.Transport.TimeSigNumerator = result.Transport.TimeSigNumerator;_vm.Transport.TimeSigDenominator = result.Transport.TimeSigDenominator;_vm.Transport.KeyCode = result.Transport.Key;diff --git a/src/managed/Nota.App/MainWindow.MenuKeys.cs b/src/managed/Nota.App/MainWindow.MenuKeys.csindex bf90595c..d4a90771 100644--- a/src/managed/Nota.App/MainWindow.MenuKeys.cs+++ b/src/managed/Nota.App/MainWindow.MenuKeys.cs@@ -32,7 +32,12 @@ public partial class MainWindowif (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");+ // Settings… lives in the app menu there too (Nota → Settings…, ⌘,), so File doesn't repeat it (#444).+ if (OperatingSystem.IsMacOS())+ {+ RemoveWithSeparatorAbove(menu, "file.exit");+ RemoveWithSeparatorAbove(menu, "prefs.open");+ }Collect(menu);void Collect(NativeMenu m)@@ -43,9 +48,7 @@ public partial class MainWindow{_menuItems[id] = item;item.Click += (_, _) => _commands.Run(id);- // Settings… keeps ⌘, on the app menu (App.axaml) on macOS; one key, one item.- bool appMenuOwnsIt = OperatingSystem.IsMacOS() && id == "prefs.open";- if (Commands.CanMenuGesture(cmd.Gesture) && !appMenuOwnsIt && Commands.Parse(cmd.Gesture) is { } g)+ if (Commands.CanMenuGesture(cmd.Gesture) && Commands.Parse(cmd.Gesture) is { } g){item.Gesture = g;if (!OperatingSystem.IsMacOS()) _menuShortcuts.Add(item);diff --git a/src/managed/Nota.App/MainWindow.RecentMenu.cs b/src/managed/Nota.App/MainWindow.RecentMenu.csnew file mode 100644index 00000000..6277992e--- /dev/null+++ b/src/managed/Nota.App/MainWindow.RecentMenu.cs@@ -0,0 +1,55 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// File → Open recent (#443): the welcome screen's recent-project list, reachable while working.+// Rebuilt from the settings whenever the list changes (every open / save records a project), so+// it never needs to be read at menu-open time. Picking one asks about unsaved changes first,+// as Open… does.++using System;+using Avalonia.Controls;+using Microsoft.Extensions.DependencyInjection;+using Nota.Application;+using Nota.Application.Localization;++namespace Nota.App;++public partial class MainWindow+{+ private NativeMenu? _recentMenu;++ private void InitRecentMenu()+ {+ if (NativeMenu.GetMenu(this) is not { } menu) return;+ foreach (var top in menu.Items)+ {+ if (top is not NativeMenuItem { Menu: { } file }) continue;+ for (int i = 0; i < file.Items.Count; i++)+ {+ if (file.Items[i] is not NativeMenuItem item || Commands.GetId(item) != "file.open") continue;+ _recentMenu = new NativeMenu();+ file.Items.Insert(i + 1, new NativeMenuItem(Loc.T("Open recent")) { Menu = _recentMenu });+ RefreshRecentMenu();+ return;+ }+ }+ }++ private void RefreshRecentMenu()+ {+ if (_recentMenu is null) return;+ _recentMenu.Items.Clear();+ var recent = LoadRecentItems(App.Services.GetRequiredService<ISettingsService>());+ foreach (var r in recent)+ {+ string path = r.Path;+ // The in-window menu bar (Windows / Linux) reads "_" as an access key; a name keeps its own.+ string header = OperatingSystem.IsMacOS() ? r.Name : r.Name.Replace("_", "__");+ var item = new NativeMenuItem(header) { ToolTip = path };+ item.Click += (_, _) => _ = OpenProjectConfirmedAsync(path);+ _recentMenu.Items.Add(item);+ }+ if (recent.Count == 0)+ _recentMenu.Items.Add(new NativeMenuItem(Loc.T("No recent projects")) { IsEnabled = false });+ }+}diff --git a/src/managed/Nota.App/MainWindow.TransportFit.cs b/src/managed/Nota.App/MainWindow.TransportFit.csindex 468bce4e..c78fc7fc 100644--- a/src/managed/Nota.App/MainWindow.TransportFit.cs+++ b/src/managed/Nota.App/MainWindow.TransportFit.cs@@ -49,6 +49,21 @@ public partial class MainWindowprivate void InitTransportFit(){TransportBar.SizeChanged += (_, _) => FitTransport();+ CpuText.AttachedToVisualTree += (_, _) => ReserveCpuTextWidth();+ }++ /// <summary>The DSP read-out grows a digit at 10% and 100%; without the bar beside it+ /// (folded first on a narrow bar) that nudged the master well, and could even flip the+ /// fit. Reserve the widest reading — "DSP 100%" in the current language — up front (#442).</summary>+ private void ReserveCpuTextWidth()+ {+ string shown = CpuText.Text ?? "";+ CpuText.MinWidth = 0;+ CpuText.Text = Loc.F("DSP {0}%", 100);+ CpuText.Measure(Avalonia.Size.Infinity);+ double widest = CpuText.DesiredSize.Width;+ CpuText.Text = shown;+ CpuText.MinWidth = Math.Ceiling(widest);}/// <summary>Re-fit after something in the bar changed width (the project name, thediff --git a/src/managed/Nota.App/MainWindow.Welcome.cs b/src/managed/Nota.App/MainWindow.Welcome.csindex 2c8f78d4..1ed69fca 100644--- a/src/managed/Nota.App/MainWindow.Welcome.cs+++ b/src/managed/Nota.App/MainWindow.Welcome.cs@@ -3,7 +3,8 @@//// Welcome screen plumbing: build the launcher, feed it the recent-projects list, and// wire its actions back to the main window. Recent projects are recorded here on every-// successful open/save (see MainWindow.Files.OpenProject / DoSaveAsync).+// successful open/save (see MainWindow.Files.OpenProject / DoSaveAsync); File → Open recent+// shows the same list (MainWindow.RecentMenu).using System;using System.Collections.Generic;@@ -102,6 +103,7 @@ public partial class MainWindowlist.Insert(0, dir);if (list.Count > MaxRecentProjects) list.RemoveRange(MaxRecentProjects, list.Count - MaxRecentProjects);settings.Save();+ RefreshRecentMenu(); // File → Open recent follows the same list}catch { /* recent list is best-effort — never disrupt the open/save */ }}diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex 344a273a..7b813050 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -90,6 +90,7 @@ public partial class MainWindow : WindowInitializeComponent();InitBottomPanels(); // BodyGrid rows for the docked Mixer + Detail panels (specs/054)InitMenuShortcuts(); // Ctrl instead of Win on Windows / Linux, and bound there+ InitRecentMenu(); // File → Open recent (#443)UpdateWindowTitle(); // "Nota — Untitled" until a project is opened/saved// Custom frameless title bar (Phase 2): extend the client area under the// decorations on macOS/Windows (traffic lights / caption buttons overlay it).diff --git a/src/managed/Nota.App/MixerView.Compact.cs b/src/managed/Nota.App/MixerView.Compact.csindex 2b3b78fa..48727a2c 100644--- a/src/managed/Nota.App/MixerView.Compact.cs+++ b/src/managed/Nota.App/MixerView.Compact.cs@@ -161,7 +161,7 @@ public sealed partial class MixerViewprivate Control CompactLevel(int id, float vol, out Control db){var fader = new MeterFader(vol) { HorizontalAlignment = HorizontalAlignment.Center };- var dbNum = new DragNumber(LinToDb(vol), MinDb, MaxDb, 0.3, "+0.0;−0.0;0.0", 8) { Width = 52, HorizontalAlignment = HorizontalAlignment.Center };+ var dbNum = DbField(vol);ToolTip.SetTip(dbNum, Loc.T("Set the gain — drag, or double-click to type"));void SetVolume(double v) { if (id < 0) SetMasterVolume?.Invoke((float)v); else _engine.SetTrackVolume(id, (float)v); }if (id < 0) { _masterMeterFader = fader; _masterDb = dbNum; }diff --git a/src/managed/Nota.App/MixerView.cs b/src/managed/Nota.App/MixerView.csindex f4857fef..40b86470 100644--- a/src/managed/Nota.App/MixerView.cs+++ b/src/managed/Nota.App/MixerView.cs@@ -994,17 +994,20 @@ public sealed partial class MixerView : UserControl// two-way sync with the fader.private const double MaxLin = 1.5;private static readonly double MaxDb = AudioMath.LinToDb(MaxLin);+ // The field's floor is silence: the fader's bottom, a drag to it or a typed "-inf" all read+ // "−∞" (#453), and anything quieter than −60 dB reads −∞ too, as the track headers do.private const double MinDb = -60.0;- private static double LinToDb(double v) => v <= 1e-4 ? MinDb : Math.Clamp(AudioMath.LinToDb(v), MinDb, MaxDb);+ private static double LinToDb(double v) => v <= 1e-3 ? MinDb : Math.Clamp(AudioMath.LinToDb(v), MinDb, MaxDb);private static double DbToLin(double db) => db <= MinDb + 1e-6 ? 0.0 : Math.Clamp(AudioMath.DbToLin(db), 0, MaxLin);+ private static DragNumber DbField(float vol) => new(LinToDb(vol), MinDb, MaxDb, 0.3, "+0.0;−0.0;0.0", 8)+ {+ Width = 52, HorizontalAlignment = HorizontalAlignment.Center, FloorText = "−∞",+ };private Control FaderRow(int id, float vol, IBrush color, out Control db, out MeterBar meter){var fader = new VFader(vol, color);- var dbNum = new DragNumber(LinToDb(vol), MinDb, MaxDb, 0.3, "+0.0;−0.0;0.0", 8)- {- Width = 52, HorizontalAlignment = HorizontalAlignment.Center,- };+ var dbNum = DbField(vol);ToolTip.SetTip(dbNum, Loc.T("Set the gain — drag, or double-click to type"));void SetVolume(double v) { if (id < 0) SetMasterVolume?.Invoke((float)v); else _engine.SetTrackVolume(id, (float)v); }if (id < 0) { _masterFader = fader; _masterDb = dbNum; }diff --git a/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs b/src/managed/Nota.Infrastructure/Persistence/ProjectModel.csindex 2342dcc5..b5f5c639 100644--- a/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs+++ b/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs@@ -97,6 +97,10 @@ public sealed class TransportDtopublic double MasterVolume { get; set; } = 1.0;public bool MetronomeOn { get; set; }public bool LoopOn { get; set; }+ /// <summary>The loop region in beats (#455); null in files from before it was saved, and+ /// when no region is set — loading those leaves the region as it is.</summary>+ public double? LoopStart { get; set; }+ public double? LoopEnd { get; set; }public int TimeSigNumerator { get; set; } = 4;public int TimeSigDenominator { get; set; } = 4;/// <summary>The project key ("Am", "Eb"); null = none set. Loops dropped in can bediff --git a/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs b/src/managed/Nota.Infrastructure/Persistence/ProjectService.csindex 1c2c6fc5..5b201679 100644--- a/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs+++ b/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs@@ -72,6 +72,8 @@ public sealed class ProjectServiceMasterVolume = transport.MasterVolume,MetronomeOn = transport.MetronomeOn,LoopOn = transport.LoopOn,+ LoopStart = engine.LoopEnd > engine.LoopStart ? engine.LoopStart : null,+ LoopEnd = engine.LoopEnd > engine.LoopStart ? engine.LoopEnd : null,TimeSigNumerator = transport.TimeSigNumerator,TimeSigDenominator = transport.TimeSigDenominator,Key = Nota.Application.Samples.MusicalKey.FromCode(transport.Key)?.Short,@@ -564,6 +566,12 @@ public sealed class ProjectService// section the user moved isn't mistaken for one still on its take when the UI's tempo lands.if (doc.Transport.Bpm > 0) engine.SetBpm(doc.Transport.Bpm);+ // The loop: its region as saved (#455) and whether it's on; the transport bar reads both back.+ if (doc.Transport.LoopStart is double ls && doc.Transport.LoopEnd is double le && le > ls)+ engine.SetLoop(doc.Transport.LoopOn, ls, le);+ else+ engine.SetLoop(doc.Transport.LoopOn, engine.LoopStart, engine.LoopEnd);+// Pan law (specs/006) first, as the baseline rather than an undo step. A missing mixer// is a pre-v21 project: Balance, so the mix sounds as it was saved.engine.SetPanLaw(ParsePanLaw(doc.Mixer?.PanLaw, warnings), checkpoint: false);diff --git a/tests/Nota.SmokeTest/LocalizationAllowList.txt b/tests/Nota.SmokeTest/LocalizationAllowList.txtindex aed32685..82936348 100644--- a/tests/Nota.SmokeTest/LocalizationAllowList.txt+++ b/tests/Nota.SmokeTest/LocalizationAllowList.txt@@ -2051,7 +2051,6 @@ Nota.App/DeviceCards/Midi/VelocityMidiBody.cs TRANSFER # data: device parameter,Nota.App/DeviceCards/Midi/VelocityMidiBody.cs Value # data: device parameter, port and value names and live readouts of their values (FR-004)Nota.App/DeviceCards/Midi/VelocityMidiBody.cs Velocity mode # data: device parameter, port and value names and live readouts of their values (FR-004)Nota.App/DeviceCards/Midi/VelocityMidiBody.cs in 1 # data: device parameter, port and value names and live readouts of their values (FR-004)-Nota.App/DeviceCards/PluginCard.cs Close editor # data: device parameter, port and value names and live readouts of their values (FR-004)Nota.App/DeviceCards/PluginCard.cs Effect # data: device parameter, port and value names and live readouts of their values (FR-004)Nota.App/DeviceCards/PluginCard.cs Filter # data: device parameter, port and value names and live readouts of their values (FR-004)Nota.App/DeviceCards/PluginCard.cs Instrument # data: device parameter, port and value names and live readouts of their values (FR-004)diff --git a/tests/Nota.SmokeTest/LoopPersistenceTests.cs b/tests/Nota.SmokeTest/LoopPersistenceTests.csnew file mode 100644index 00000000..5d5efa14--- /dev/null+++ b/tests/Nota.SmokeTest/LoopPersistenceTests.cs@@ -0,0 +1,51 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The loop region is part of the project (#455): its start and end, and whether it's on, survive+// save / load; a file from before the region was saved loads as before, the region untouched.+// Runs with `dotnet run --project tests/Nota.SmokeTest -- --loop` and the full run.++using Nota.Application;+using Nota.Infrastructure;++namespace Nota.SmokeTest;++internal static class LoopPersistenceTests+{+ public static IEnumerable<(bool ok, string label)> Run()+ {+ foreach (var r in RoundTrip(on: true)) yield return r;+ foreach (var r in RoundTrip(on: false)) yield return r;+ foreach (var r in OlderFile()) yield return r;+ }++ private static IEnumerable<(bool, string)> RoundTrip(bool on)+ {+ string dir = Path.Combine(Path.GetTempPath(), "nota-loop-" + Guid.NewGuid().ToString("N"));+ try+ {+ using var eng = new NotaEngine();+ ProjectTemplate.ApplyDefault(eng);+ eng.SetLoop(on, 16, 32); // bars 5–9+ new ProjectStore().Save(eng, new TransportState(120, 1, false, on), dir);+ using var e2 = new NotaEngine();+ var result = new ProjectStore().Load(e2, dir);+ yield return (e2.LoopStart == 16 && e2.LoopEnd == 32 && e2.LoopEnabled == on && result.Transport.LoopOn == on,+ $"loop: the region (bars 5–9) survives save / load, loop {(on ? "on" : "off")}");+ }+ finally { try { if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true); } catch (IOException) { } }+ }++ private static IEnumerable<(bool, string)> OlderFile()+ {+ using var eng = new NotaEngine();+ ProjectTemplate.ApplyDefault(eng);+ var doc = ProjectService.Capture(eng, new TransportState(120, 1, false, false), new List<string>());+ bool noRegion = doc.Transport.LoopStart is null && doc.Transport.LoopEnd is null; // none set: none written+ using var e2 = new NotaEngine();+ e2.SetLoop(false, 8, 12);+ ProjectService.Apply(doc, e2, Path.GetTempPath());+ yield return (noRegion && e2.LoopStart == 8 && e2.LoopEnd == 12 && !e2.LoopEnabled,+ "loop: a project without a saved region writes none, and loading it leaves the region as it was");+ }+}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 6e552b36..18b86aaf 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -454,6 +454,14 @@ if (args.Length >= 1 && args[0] == "--mixundo")Console.WriteLine(failures == 0 ? "MIXUNDO PASSED" : $"MIXUNDO FAILED ({failures})");return failures == 0 ? 0 : 1;}+// The loop region saved with the project alone: `--loop`. Also part of the full run.+if (args.Length >= 1 && args[0] == "--loop")+{+ Console.WriteLine("-- loop persistence --");+ foreach (var (ok, label) in LoopPersistenceTests.Run()) Check(ok, label);+ Console.WriteLine(failures == 0 ? "LOOP PASSED" : $"LOOP FAILED ({failures})");+ return failures == 0 ? 0 : 1;+}// Device-parameter and section undo alone: `--paramundo`. Also part of the full run.if (args.Length >= 1 && args[0] == "--paramundo"){@@ -15510,6 +15518,8 @@ Console.WriteLine("-- param + section undo --");foreach (var (ok, label) in ParamSectionUndoTests.Run()) Check(ok, label);Console.WriteLine("-- section names --");foreach (var (ok, label) in SectionNamingTests.Run()) Check(ok, label);+Console.WriteLine("-- loop persistence --");+foreach (var (ok, label) in LoopPersistenceTests.Run()) Check(ok, label);Console.WriteLine("-- device remove undo --");foreach (var (ok, label) in DeviceRemoveUndoTests.Run()) Check(ok, label);Console.WriteLine("-- device copy + rack undo --");