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: send faders in sync, Init in the preset list, version opens What's New (#155)

Chris Laupama76fb0e12e468
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5dc85b26..0307051c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,17 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Release notes from the status bar** (nota-daw/nota#127): the version number at the
+ bottom right of the main window, next to the sample rate, is now a button: click it to
+ open What's New for the installed version (it never starts an update). Escape closes What's
+ New. The status bar now always shows the app version; before, it showed nothing at launch
+ and the engine's version after an audio device change.
+- **Back to Init from any preset** (nota-daw/nota#57): the preset list on a built-in
+ instrument or effect card (and its right-click Preset menu) now starts with **Init**,
+ which puts every parameter back to its default, as on a freshly added device. The card
+ size and a loaded sample stay. ‹ › step through Init too: past the last preset comes Init,
+ then the first again. Devices whose factory list already has its own "Init" preset keep
+ just that one.
- **Fold a device into a narrow strip** (nota-daw/nota#147): double-click a device's header
(or choose Fold in its right-click menu) and the card collapses into a 28 px strip with its
name, rotated, and its on/off switch, so a long chain fits the Devices panel. Double-click
@@ -71,6 +82,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
Windows and Linux) always starts a new track.
### Fixed
+- **Send faders stay in step everywhere** (nota-daw/nota#138): turning a Send knob on a
+ track's Sends card in the Devices panel now moves that send's fader in the Session mixer
+ and the Mixer window at once, and the other way round. Automation of a send shows on all
+ three too. Before, the other controls kept the old value until the view was rebuilt.
- **The clip editor shows the playhead of a playing Session clip** (nota-daw/nota#137):
open a launched slot and the piano roll's cursor, or the Drum Rack step grid's lit
column, now follows the slot as it loops. Before, only Arrangement clips showed one.
diff --git a/FEATURES.md b/FEATURES.md
index 37435b29..86eec46e 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -454,7 +454,7 @@ track count and closes with Escape.
## Built-in devices
Every built-in device uses the same 700×260 shell with a shared header: on/bypass dot,
-name, subtitle, preset picker, **A/B comparison** (parameter snapshots), stereo meter,
+name, subtitle, preset picker (with **Init** to return to every default), **A/B comparison** (parameter snapshots), stereo meter,
voice count (on synths), move arrows, delete, and the ⠿ drag handle. All support factory
and user presets, automation, persistence and cloning. Instrument cards (built-in, racks
and hosted plug-ins) have the same on/off switch as effects: off silences the instrument
@@ -1029,7 +1029,8 @@ audio effects after it keep running and keep their settings; saved with the proj
on Windows and Linux — hides the title bar and its separator so the workspace fills the
screen edge to edge; leaving full screen brings the bar back. Maximized keeps the bar.
- **What's New** — a window showing changelog entries newer than `LastSeenVersion`, once
- after the first launch on a new version.
+ after the first launch on a new version; any time from Help ▸ What's New or the version
+ number in the status bar.
- **Self-update** — the start screen's banner announces a newer GitHub release. **Update**
downloads the build for this platform (with progress, checked against the release's
sha256). **Restart now** installs it and relaunches, and **Later** installs it on quit.
diff --git a/src/managed/Nota.App/DeviceCardKit.cs b/src/managed/Nota.App/DeviceCardKit.cs
index fc5a4996..8adb1bec 100644
--- a/src/managed/Nota.App/DeviceCardKit.cs
+++ b/src/managed/Nota.App/DeviceCardKit.cs
@@ -311,12 +311,13 @@ internal static class DeviceCardKit
=> Segments(options, () => Math.Clamp(get(), 0, options.Length - 1), set, out _);
// Preset picker "‹ Name ▾ ›" — a sunken field (a list you pick from, not a button): the
- // name opens the factory presets for this kind with the current one checked; ‹ › step to
- // the previous / next preset, wrapping (from Init, › is the first and ‹ the last).
- // Clicks are handled so they neither select nor start dragging the card. Shared by the
- // card shell and the rack chain full-UI popups.
+ // name opens the factory presets for this kind with the current one checked — under an
+ // "Init" entry when the caller can reset to defaults (init); ‹ › step to the previous /
+ // next preset (from Init, › is the first and ‹ the last). Clicks are handled so they
+ // neither select nor start dragging the card. Shared by the card shell and the rack chain
+ // full-UI popups.
internal static Control PresetPicker(IReadOnlyList<string> presets, int cur, string current,
- Action<int> apply, Action<int> step, double nameWidth = 132, double height = 18)
+ Action<int> apply, Action<int> step, double nameWidth = 132, double height = 18, Action? init = null)
{
double H = height; // 18 in a card header, 22 in the device window's title bar
var label = new TextBlock
@@ -338,6 +339,13 @@ internal static class DeviceCardKit
if (!e.GetCurrentPoint(name).Properties.IsLeftButtonPressed) return;
e.Handled = true;
var flyout = new MenuFlyout();
+ if (init != null)
+ {
+ var mi = new MenuItem { Header = "Init", ToggleType = MenuItemToggleType.Radio, IsChecked = cur < 0 && string.IsNullOrEmpty(current) };
+ mi.Click += (_, _) => init();
+ flyout.Items.Add(mi);
+ flyout.Items.Add(new Separator());
+ }
for (int i = 0; i < presets.Count; i++)
{
int iv = i;
diff --git a/src/managed/Nota.App/DeviceChainView.Shell.cs b/src/managed/Nota.App/DeviceChainView.Shell.cs
index b3890ce3..4e974018 100644
--- a/src/managed/Nota.App/DeviceChainView.Shell.cs
+++ b/src/managed/Nota.App/DeviceChainView.Shell.cs
@@ -202,6 +202,7 @@ public sealed partial class DeviceChainView
// Factory presets for this device (or the card's own list), and applying one in place.
List<(string Id, string Name)> presets;
Action<string> applyById;
+ Action? resetToInit = null; // factory lists only: Init isn't a preset, it's every default (#57)
if (s.Presets is { } own)
{
presets = own.Items.ToList();
@@ -224,13 +225,26 @@ public sealed partial class DeviceChainView
.Select(p => (p.Id, p.DisplayName)).ToList()
: new List<(string Id, string Name)>();
applyById = id => _factory.ApplyInPlace(_engine, id, _trackId, di);
+ // A device whose factory list already starts from its own "Init" preset needs no second one.
+ if (presets.Count > 0 && !presets.Any(p => p.Name == "Init"))
+ resetToInit = () =>
+ {
+ string warn = _factory.ResetInPlace(_engine, _trackId, di, s.Kind == ChainKind.Midi);
+ if (warn.Length > 0) StatusMessage?.Invoke(warn);
+ };
}
int curPreset = presets.FindIndex(p => p.Id == extra.PresetId);
+ bool atInit = curPreset < 0 && string.IsNullOrEmpty(extra.Preset);
void ApplyPreset(int i) { var p = presets[i]; applyById(p.Id); extra.PresetId = p.Id; extra.Preset = p.Name; Rebuild(); }
+ void ApplyInit() { resetToInit!(); extra.PresetId = ""; extra.Preset = ""; Rebuild(); }
void StepPreset(int dir)
{
int n = presets.Count; if (n == 0) return;
- ApplyPreset(curPreset < 0 ? (dir > 0 ? 0 : n - 1) : ((curPreset + dir) % n + n) % n);
+ if (curPreset < 0) { ApplyPreset(dir > 0 ? 0 : n - 1); return; } // from Init (or a preset not in the list)
+ int next = curPreset + dir;
+ // ‹ › walk Init → the presets → back to Init when there is an Init entry, else wrap.
+ if (resetToInit != null && (next < 0 || next >= n)) ApplyInit();
+ else ApplyPreset((next % n + n) % n);
}
// A compact (mini) card keeps the same picker — same list, same current preset — only narrower:
// the preset belongs to the device, not to the card size.
@@ -240,7 +254,7 @@ public sealed partial class DeviceChainView
if (presets.Count > 0)
{
picker = PresetPicker(presets.Select(p => p.Name).ToList(), curPreset, extra.Preset, ApplyPreset, StepPreset,
- nameWidth: s.Compact ? 74 : 132);
+ nameWidth: s.Compact ? 74 : 132, init: resetToInit != null ? ApplyInit : null);
Grid.SetColumn(picker, 1); headerGrid.Children.Add(picker);
}
@@ -255,6 +269,12 @@ public sealed partial class DeviceChainView
var prev = new MenuItem { Header = "Previous preset", Icon = MenuKit.Icon(GlyphKind.ChevronLeft) }; prev.Click += (_, _) => StepPreset(-1);
var next = new MenuItem { Header = "Next preset", Icon = MenuKit.Icon(GlyphKind.ChevronRight) }; next.Click += (_, _) => StepPreset(+1);
menu.Items.Add(prev); menu.Items.Add(next); menu.Items.Add(new Separator());
+ if (resetToInit != null)
+ {
+ var init = new MenuItem { Header = "Init", ToggleType = MenuItemToggleType.Radio, IsChecked = atInit };
+ init.Click += (_, _) => ApplyInit();
+ menu.Items.Add(init); menu.Items.Add(new Separator());
+ }
for (int i = 0; i < presets.Count; i++)
{
int iv = i;
diff --git a/src/managed/Nota.App/DeviceChainView.cs b/src/managed/Nota.App/DeviceChainView.cs
index 22c0c2ef..5a22a080 100644
--- a/src/managed/Nota.App/DeviceChainView.cs
+++ b/src/managed/Nota.App/DeviceChainView.cs
@@ -237,6 +237,13 @@ public sealed partial class DeviceChainView : UserControl
var knob = new Knob(_engine.GetTrackSend(_trackId, bus), 1.0) { Accent = true, Default = 0 };
int b = bus;
knob.ValueChanged += v => { _engine.SetTrackSend(_trackId, b, (float)v); value.Text = Pct((float)v); };
+ // Follow the Session / Mixer send faders and automation (#138).
+ _deviceLiveRefreshers.Add(() =>
+ {
+ if (knob.Dragging) return;
+ float v = _engine.GetTrackSend(_trackId, b);
+ if (Math.Abs(v - knob.Value) > 1e-3) { knob.Value = v; value.Text = Pct(v); }
+ });
knobs.Children.Add(KnobCell($"Send {letter}", knob, value));
shown++;
}
diff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axaml
index bc5158fc..297ec9b5 100644
--- a/src/managed/Nota.App/MainWindow.axaml
+++ b/src/managed/Nota.App/MainWindow.axaml
@@ -399,7 +399,7 @@
<Border DockPanel.Dock="Bottom" Background="{DynamicResource Brush.BgApp}"
BorderBrush="{DynamicResource Brush.Seam}" BorderThickness="0,1,0,0"
Height="22" Padding="16,0">
- <Grid ColumnDefinitions="*,Auto,Auto,Auto">
+ <Grid ColumnDefinitions="*,Auto,Auto,Auto,Auto">
<TextBlock Classes="Caption" VerticalAlignment="Center" Text="{Binding StatusText}"/>
<!-- Settings → Downloads job (MainWindow.Downloads.cs): it keeps running after Settings closes. -->
<Panel x:Name="DownloadHost" Grid.Column="1" VerticalAlignment="Center"/>
@@ -417,6 +417,12 @@
</StackPanel>
<TextBlock Grid.Column="3" Classes="Caption Mono"
VerticalAlignment="Center" Text="{Binding EngineInfo}"/>
+ <!-- The installed version: opens its release notes (What's New), never an update (#127). -->
+ <Button x:Name="VersionButton" Grid.Column="4" Classes="ghost"
+ VerticalAlignment="Center" Margin="6,0,-6,0" Padding="6,1" MinHeight="0"
+ Cursor="Hand" ToolTip.Tip="View release notes">
+ <TextBlock x:Name="VersionText" Classes="Caption Mono"/>
+ </Button>
</Grid>
</Border>
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index 7217ee72..9390bb41 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -498,6 +498,10 @@ public partial class MainWindow : Window
// Clicking away from a text field (browser search, rename boxes…) hands the keyboard back.
ReleaseTextFocusOnOutsidePress(this);
+ // Status bar: the installed version opens its release notes (#127).
+ VersionText.Text = $"v{AppInfo.Version}";
+ VersionButton.Click += (_, _) => ShowWhatsNew();
+
Closed += (_, _) => vm.Dispose();
SetUpCpuTip(vm.Engine);
diff --git a/src/managed/Nota.App/MixerView.cs b/src/managed/Nota.App/MixerView.cs
index 558b7d5b..87344a74 100644
--- a/src/managed/Nota.App/MixerView.cs
+++ b/src/managed/Nota.App/MixerView.cs
@@ -44,6 +44,7 @@ public sealed class MixerView : UserControl
private readonly IAudioEngine _engine;
private readonly StackPanel _row = new() { Orientation = Orientation.Horizontal, Spacing = 2, Margin = new Thickness(10) };
private readonly List<(int trackId, MeterBar meter)> _meters = new();
+ private readonly List<(int trackId, int bus, MiniFader fader)> _sendFaders = new();
// Sends / I/O sections are collapsible across every strip (mockup 1f header
// toggles); we keep the section borders so a toggle can hide them all at once.
private readonly List<Control> _sendSections = new();
@@ -139,6 +140,7 @@ public sealed class MixerView : UserControl
{
_row.Children.Clear();
_meters.Clear();
+ _sendFaders.Clear();
_sendSections.Clear();
_ioSections.Clear();
_balBadges.Clear();
@@ -173,6 +175,13 @@ public sealed class MixerView : UserControl
double v = get();
if (Math.Abs(f.Value - v) > 1e-3) { f.SetValueExternal(v); db.Value = LinToDb(v); }
}
+ // Sends follow the Devices panel's Sends card, the Session mixer and automation (#138).
+ foreach (var (id, bus, send) in _sendFaders)
+ {
+ if (send.Dragging) continue;
+ double v = _engine.GetTrackSend(id, bus);
+ if (Math.Abs(send.Value - v) > 1e-3) send.Value = v;
+ }
SyncPanLaw(); // undo/redo or a load elsewhere may have changed it
}
@@ -444,6 +453,7 @@ public sealed class MixerView : UserControl
var f = new MiniFader(_engine.GetTrackSend(id, bus), 1.0) { VerticalAlignment = VerticalAlignment.Center };
int b = bus;
f.ValueChanged += v => _engine.SetTrackSend(id, b, (float)v);
+ _sendFaders.Add((id, b, f));
Grid.SetColumn(f, 1); grid.Children.Add(f);
}
else
diff --git a/src/managed/Nota.App/SessionView.Mixer.cs b/src/managed/Nota.App/SessionView.Mixer.cs
index b352090f..437ebdb8 100644
--- a/src/managed/Nota.App/SessionView.Mixer.cs
+++ b/src/managed/Nota.App/SessionView.Mixer.cs
@@ -87,6 +87,9 @@ public sealed partial class SessionView
if (_showIO) root.Children.Add(Section(InputRow(c), MonitorRow(c), OutputRow(c)));
+ // Send faders follow changes made elsewhere — the Devices panel's Sends card, the
+ // Mixer window, automation (#138) — on the same tick as the meters.
+ var sendSyncs = new List<Action>();
if (_showSends && ReturnRows > 0)
{
var rows = new List<Control>();
@@ -100,6 +103,12 @@ public sealed partial class SessionView
void Show() => read.Text = f.Value <= 0.005 ? "–" : NotaNum.Str(f.Value * 100, "0");
f.ValueChanged += v => { _engine.SetTrackSend(id, bus, (float)v); Show(); };
Show();
+ sendSyncs.Add(() =>
+ {
+ if (f.Dragging) return;
+ double v = _engine.GetTrackSend(id, bus);
+ if (Math.Abs(v - f.Value) > 1e-3) { f.Value = v; Show(); }
+ });
rows.Add(FaderRow(f, read));
}
else rows.Add(new Border { Height = FaderRowH });
@@ -165,6 +174,11 @@ public sealed partial class SessionView
}
root.Children.Add(Section(panRow, FaderRow(vol, db), meters, btns));
}
+ if (sendSyncs.Count > 0)
+ {
+ var meterOnly = meter;
+ meter = () => { meterOnly(); foreach (var sync in sendSyncs) sync(); };
+ }
return new MixerParts { Root = root, UpdateMeter = meter };
}
diff --git a/src/managed/Nota.App/WhatsNewWindow.cs b/src/managed/Nota.App/WhatsNewWindow.cs
index e4b31ef1..3db6330f 100644
--- a/src/managed/Nota.App/WhatsNewWindow.cs
+++ b/src/managed/Nota.App/WhatsNewWindow.cs
@@ -70,6 +70,7 @@ public sealed class WhatsNewWindow : NotaWindow
Classes = { "primary" },
};
ok.Click += (_, _) => Close();
+ KeyDown += (_, e) => { if (e.Key == Avalonia.Input.Key.Escape) { Close(); e.Handled = true; } };
var root = new Grid { RowDefinitions = new RowDefinitions("Auto,*,Auto") };
Grid.SetRow(header, 0);
diff --git a/src/managed/Nota.Application/Ports/IFactoryPresets.cs b/src/managed/Nota.Application/Ports/IFactoryPresets.cs
index d29344d3..1180e262 100644
--- a/src/managed/Nota.Application/Ports/IFactoryPresets.cs
+++ b/src/managed/Nota.Application/Ports/IFactoryPresets.cs
@@ -28,4 +28,9 @@ public interface IFactoryPresets
/// <summary>Applies a factory preset by id to an EXISTING instrument/device in place
/// (deviceIndex -1 = the track's instrument), for the in-header preset picker.</summary>
string ApplyInPlace(IAudioEngine engine, string id, int trackId, int deviceIndex);
+
+ /// <summary>Returns an existing built-in instrument / effect / MIDI effect to Init — every
+ /// parameter at its default (deviceIndex -1 = the track's instrument). The card size and a
+ /// loaded sample stay as they are. Returns "" on success or a user-facing warning.</summary>
+ string ResetInPlace(IAudioEngine engine, int trackId, int deviceIndex, bool midiEffect);
}
diff --git a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
index e3ac3646..43010977 100644
--- a/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/FactoryPresetCatalog.cs
@@ -2566,6 +2566,9 @@ public sealed class FactoryPresetCatalog : IFactoryPresets
? PresetService.ApplyInPlace(doc, engine, trackId, deviceIndex)
: "Unknown factory preset.";
+ public string ResetInPlace(IAudioEngine engine, int trackId, int deviceIndex, bool midiEffect)
+ => PresetService.ResetInPlace(engine, trackId, deviceIndex, midiEffect);
+
// Nota Consort preset helpers (see the Consort block above).
private static (string, float)[] P(params (string, float)[] ps) => ps;
private static (string, float)[] Cat(params (string, float)[][] parts)
diff --git a/src/managed/Nota.Infrastructure/Persistence/PresetService.cs b/src/managed/Nota.Infrastructure/Persistence/PresetService.cs
index 3df124a7..08038ac8 100644
--- a/src/managed/Nota.Infrastructure/Persistence/PresetService.cs
+++ b/src/managed/Nota.Infrastructure/Persistence/PresetService.cs
@@ -292,6 +292,30 @@ public static class PresetService
return "";
}
+ /// <summary>Init for a built-in device in place: every parameter back to its default, as on a
+ /// freshly added device (#57). An instrument goes through an empty preset, so it keeps its
+ /// card size, a loaded sample (and the Sampler's / Rhythm's sample regions) like any preset.</summary>
+ public static string ResetInPlace(IAudioEngine engine, int trackId, int deviceIndex, bool midiEffect)
+ {
+ if (trackId <= 0) return "Select a track first.";
+ if (deviceIndex < 0)
+ return ApplyInPlace(new PresetDocument { Type = "builtin-instrument", NamedParams = new() }, engine, trackId, -1);
+ if (midiEffect)
+ {
+ int pc = engine.MidiEffectParamCount(trackId, deviceIndex);
+ for (int i = 0; i < pc; i++)
+ if (engine.MidiEffectParamName(trackId, deviceIndex, i) != "View") // the card size
+ engine.MidiEffectSetParam(trackId, deviceIndex, i, engine.MidiEffectParamDefault(trackId, deviceIndex, i));
+ }
+ else
+ {
+ int pc = engine.DeviceParamCount(trackId, deviceIndex);
+ for (int i = 0; i < pc; i++)
+ engine.DeviceSetParam(trackId, deviceIndex, i, engine.DeviceParamDefault(trackId, deviceIndex, i));
+ }
+ return "";
+ }
+
/// <summary>Applies a preset to an EXISTING instrument/device in place (no new track/
/// device is created) — for the in-header preset picker. Built-in instruments reset all
/// params to default first so the patch is clean; effects set the preset's named params.</summary>
diff --git a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
index 44abb0f5..fa6790f5 100644
--- a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
+++ b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
@@ -15,7 +15,6 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
{
private readonly IPeriodicTimer _clock;
private readonly IPeriodicTimer _autosave;
- private readonly EngineBuildInfo _build;
private readonly ILogSink _log;
private int _lastXrunCount;
@@ -72,13 +71,11 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
Transport = transport;
Browser = browser;
Settings = settings;
- _build = build;
_log = log;
Engine.Start();
Engine.SetBpm(120);
Engine.SetTimeSignature(4, 4);
- // EngineInfo = $"v{_build.Version} · {Engine.SampleRate:0} Hz";
EngineInfo = $"{Engine.SampleRate:0}\u2009Hz";
_log.Info($"Engine started · {Engine.SampleRate:0}\u2009Hz");
@@ -151,7 +148,7 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
SuspendEnginePolling = false;
}
- EngineInfo = $"v{_build.Version} · {Engine.SampleRate:0}\u2009Hz";
+ EngineInfo = $"{Engine.SampleRate:0}\u2009Hz"; // the version sits beside it, as its own button (#127)
int buf = Engine.NegotiatedBufferFrames;
_log.Info($"Audio applied · {Engine.NegotiatedSampleRate:0}\u2009Hz · {buf} frames");
bool fallback = Engine.AudioExclusiveFallback;
diff --git a/tests/Nota.SmokeTest/PresetInitTests.cs b/tests/Nota.SmokeTest/PresetInitTests.cs
new file mode 100644
index 00000000..b9897318
--- /dev/null
+++ b/tests/Nota.SmokeTest/PresetInitTests.cs
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Init in the preset list (#57): after a factory preset, ResetInPlace puts every parameter of a
+// built-in instrument, audio effect or MIDI effect back to its default, as on a freshly added
+// device, and keeps the card size (the instrument's view param, a MIDI effect's "View").
+
+using Nota.Application;
+using Nota.Infrastructure;
+
+namespace Nota.SmokeTest;
+
+internal static class PresetInitTests
+{
+ public static IEnumerable<(bool, string)> Run()
+ {
+ var cat = new FactoryPresetCatalog();
+ using var e = new NotaEngine();
+
+ // ---- instrument: Nota Synth after a factory preset ---------------------------------
+ int t = e.AddInstrumentTrack();
+ e.SetTrackBuiltinInstrument(t, 0);
+ int pc = e.PluginParamCount(t, -1);
+ int view = InstrumentView.Index(e, t);
+ var preset = cat.All().First(p => p.IsInstrument && p.BuiltinKind == 0 && p.DisplayName == "Warm Pad");
+ yield return (cat.ApplyInPlace(e, preset.Id, t, -1).Length == 0, "a Synth factory preset applies in place");
+ int moved = Enumerable.Range(0, pc).Count(i => i != view && Math.Abs(e.PluginParamGet(t, -1, i) - e.InstrumentParamDefault(t, i)) > 1e-4);
+ if (view >= 0) e.PluginParamSet(t, -1, view, 1f - e.InstrumentParamDefault(t, view)); // the other card size
+ float viewBefore = view >= 0 ? e.PluginParamGet(t, -1, view) : 0f;
+ yield return (cat.ResetInPlace(e, t, -1, midiEffect: false).Length == 0, "Init on the instrument reports no warning");
+ int off = Enumerable.Range(0, pc).Count(i => i != view && Math.Abs(e.PluginParamGet(t, -1, i) - e.InstrumentParamDefault(t, i)) > 1e-4);
+ yield return (moved > 0 && off == 0, $"Init puts every Synth param back to its default ({moved} moved by the preset, {off} left off)");
+ yield return (view < 0 || Math.Abs(e.PluginParamGet(t, -1, view) - viewBefore) < 1e-6, "Init keeps the instrument card's size");
+
+ // ---- audio effect: a Delay after a factory preset ----------------------------------
+ int d = e.AddBuiltinDevice(t, 3);
+ var fx = cat.All().First(p => !p.IsInstrument && !p.IsMidiEffect && p.BuiltinKind == 3);
+ cat.ApplyInPlace(e, fx.Id, t, d);
+ int dc = e.DeviceParamCount(t, d);
+ int fxMoved = Enumerable.Range(0, dc).Count(i => Math.Abs(e.DeviceGetParam(t, d, i) - e.DeviceParamDefault(t, d, i)) > 1e-4);
+ cat.ResetInPlace(e, t, d, midiEffect: false);
+ int fxOff = Enumerable.Range(0, dc).Count(i => Math.Abs(e.DeviceGetParam(t, d, i) - e.DeviceParamDefault(t, d, i)) > 1e-4);
+ yield return (fxMoved > 0 && fxOff == 0, $"Init puts every Delay param back to its default ({fxMoved} moved by \"{fx.DisplayName}\", {fxOff} left off)");
+
+ // ---- MIDI effect: every param but View --------------------------------------------
+ int m = e.AddMidiEffect(t, 0);
+ int mc = e.MidiEffectParamCount(t, m);
+ int mView = Enumerable.Range(0, mc).FirstOrDefault(i => e.MidiEffectParamName(t, m, i) == "View", -1);
+ for (int i = 0; i < mc; i++)
+ {
+ float def = e.MidiEffectParamDefault(t, m, i);
+ e.MidiEffectSetParam(t, m, i, def == 0f ? 1f : 0f);
+ }
+ float mViewBefore = mView >= 0 ? e.MidiEffectGetParam(t, m, mView) : 0f;
+ cat.ResetInPlace(e, t, m, midiEffect: true);
+ int mOff = Enumerable.Range(0, mc).Count(i => i != mView && Math.Abs(e.MidiEffectGetParam(t, m, i) - e.MidiEffectParamDefault(t, m, i)) > 1e-4);
+ yield return (mc > 0 && mOff == 0, $"Init puts every MIDI effect param back to its default ({mOff} of {mc} left off)");
+ yield return (mView < 0 || Math.Abs(e.MidiEffectGetParam(t, m, mView) - mViewBefore) < 1e-6, "Init keeps the MIDI effect card's size (View)");
+ }
+}
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 71b3ad8e..372c8a09 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -396,6 +396,14 @@ if (args.Length >= 1 && args[0] == "--instrument-off")
Console.WriteLine(failures == 0 ? "INSTRUMENT OFF PASSED" : $"INSTRUMENT OFF FAILED ({failures})");
return failures == 0 ? 0 : 1;
}
+// Init in the preset list alone (fast iteration): `--preset-init`. Also part of the full run.
+if (args.Length >= 1 && args[0] == "--preset-init")
+{
+ Console.WriteLine("-- preset init --");
+ foreach (var (ok, label) in PresetInitTests.Run()) Check(ok, label);
+ Console.WriteLine(failures == 0 ? "PRESET INIT PASSED" : $"PRESET INIT FAILED ({failures})");
+ return failures == 0 ? 0 : 1;
+}
// MPE alone (fast iteration): `--mpe`. Also part of the full run.
if (args.Length >= 1 && args[0] == "--mpe")
{
@@ -14778,6 +14786,8 @@ Console.WriteLine("-- nota keys --");
foreach (var (ok, label) in KeysTests.Run()) Check(ok, label);
Console.WriteLine("-- instrument on/off --");
foreach (var (ok, label) in InstrumentBypassTests.Run()) Check(ok, label);
+Console.WriteLine("-- preset init --");
+foreach (var (ok, label) in PresetInitTests.Run()) Check(ok, label);
Console.WriteLine("-- nota mosaic --");
foreach (var (ok, label) in MosaicTests.Run()) Check(ok, label);