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) Session launches, audio takes, mono input, browser search, arming, Envelope Follower search (#343 #337 #340 #342 #332 #133) (#355)
Chris Laupamac0a3df625798
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cd06c200..78c9de89 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -108,8 +108,21 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.- **MCP**: `set_track_instrument` replaces a track's instrument with a built-in one (racksincluded); `move_device_to_track` moves or copies a device, the instrument included, toanother track.+- **Mono or stereo audio input** (nota-daw/nota#340): an audio track's record input lists the+ hardware input as **Ext 1**, **Ext 2** and **Ext 1/2** (track menu, header box, Session I/O+ row). A mono pick is recorded and monitored in the middle of both sides, so a mic on input 1+ of a stereo interface is no longer left-only. New audio tracks take Ext 1; projects saved+ before keep the stereo pair. Saved with the project; MCP `set_input_channels`.### Changed+- **One click arms one track** (nota-daw/nota#332): a click on a track's arm button arms that+ track and disarms the others, so picking which instrument the keyboard plays is one click.+ ⌘-click (Ctrl-click on Windows / Linux) arms several. While recording, a click never+ disarms another track. Selecting an instrument track (a new one included) arms it the same+ way, unless several tracks or an audio track are armed.+- **The Envelope Follower is easier to find** (nota-daw/nota#133): searching Modular's palette+ for "peak controller", "ducking" or "loudness" finds it, and the docs walk through ducking one+ track under another.- **Delete on the instrument deletes its track**, as an instrument track always has aninstrument; Nota asks first when the track has clips.- **A new Instrument Rack starts empty** instead of with a Nota Volt chain: drop an instrument@@ -132,6 +145,15 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.at full detail instead of in blocks.### Fixed+- **Session clips no longer wait forever to start** (nota-daw/nota#343): a clip launched on a+ muted track, or one silenced by another track's solo, starts on the next launch point and+ keeps time while silent; a transport loop with no bar line inside it now launches at the+ loop start instead of never.+- **An audio take in Session stops the track's playing clip** (nota-daw/nota#337), as a MIDI+ take does, rather than letting it play on until the take ends.+- **Audio effects vanishing from the Browser** (nota-daw/nota#342): a search typed on one tab+ and cleared on another left the first tab filtered, empty under an empty search box ("No+ audio effects yet"). A tab now follows the search box whenever it's shown.- A rack card's faders, mode buttons and switches (and zone or select-range drags) undo onegesture at a time on every rack, the MIDI Effect Rack included; a nested Drum Rack's windowfollows its chain when chains in front of it are removed or moved.diff --git a/FEATURES.md b/FEATURES.mdindex 73514144..cb7e6de4 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -441,7 +441,8 @@ track count and closes with Escape.## Audio: recording, clips, warp- **Recording** from an input (microphone, line, interface) onto an audio track, with- monitoring (in/auto/off).+ monitoring (in/auto/off). The input is **Ext 1** or **Ext 2** (mono, centred) or **Ext 1/2**+ (stereo pair); new tracks take Ext 1.- **Audio clips as samples** — drag an arrangement clip onto a track with a Sampler, NotaGrain, Drum Rack (next free pad) or Instrument Rack, or anywhere a sample goes (a pad, aRhythm voice, a Session slot); hovering an instrument track opens its devices. The samplediff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.csindex 3158592c..0de843c1 100644--- a/src/managed/Nota.App/ArrangementView.cs+++ b/src/managed/Nota.App/ArrangementView.cs@@ -2164,7 +2164,11 @@ public sealed partial class ArrangementView : UserControl// Record-arm applies to instrument (MIDI capture) + audio (input capture) tracks;// return and group tracks have no input, so they get no arm chip.if (!t.IsReturn && !t.IsGroup)- btnRow.Children.Add(ArmToggle(t.Armed, v => { t.Armed = v; _engine?.SetTrackArmed(t.Id, v); }));+ btnRow.Children.Add(ArmToggle(t.Armed, (v, additive) =>+ {+ t.Armed = v;+ if (_engine is not null) TrackArming.Set(_engine, t.Id, v, additive);+ }));// A compact routing selector sits with the arm button (the standard row leaves no// room for a 4th row): audio tracks get record-input, instrument tracks get "MIDI To".@@ -2463,27 +2467,28 @@ public sealed partial class ArrangementView : UserControlMenuItem? recInput = null;if (isAudio){- int cur = _engine.GetTrackRecordInput(trackId);+ var cur = RecordInputPick.Of(_engine, trackId);string curName = "Ext";var choices = new List<MenuItem>();- void Src(string label, string shortName, int source)+ void Src(string label, string shortName, RecordInputPick pick){- var mi = new MenuItem { Header = label, ToggleType = MenuItemToggleType.Radio, IsChecked = cur == source };- mi.Click += (_, _) => _engine.SetTrackRecordInput(trackId, source);+ bool on = pick.Matches(cur);+ var mi = new MenuItem { Header = label, ToggleType = MenuItemToggleType.Radio, IsChecked = on };+ mi.Click += (_, _) => pick.ApplyTo(_engine, trackId);choices.Add(mi);- if (cur == source) curName = shortName;+ if (on) curName = shortName;}- Src("Audio input (hardware)", "Ext", 0);- Src("Master", "Master", -1);+ foreach (var (pick, label, shortName) in RecordInputPick.Hardware) Src(label, shortName, pick);+ int fixedCount = RecordInputPick.Hardware.Length + 1; // the hardware entries + Master+ Src("Master", "Master", RecordInputPick.Track(-1));foreach (var v in _tracks)- if (v.Id != trackId) { string n = v.Name.Length > 0 ? v.Name : $"Track {v.Id}"; Src(n, n, v.Id); }+ if (v.Id != trackId) { string n = v.Name.Length > 0 ? v.Name : $"Track {v.Id}"; Src(n, n, RecordInputPick.Track(v.Id)); }foreach (var v in _returns)- { string n = v.Name.Length > 0 ? v.Name : $"Return {v.Id}"; Src(n, n, v.Id); }+ { string n = v.Name.Length > 0 ? v.Name : $"Return {v.Id}"; Src(n, n, RecordInputPick.Track(v.Id)); }recInput = MenuKit.ValueItem("Record input", GlyphKind.Input, curName);- recInput.Items.Add(choices[0]);- recInput.Items.Add(choices[1]);- if (choices.Count > 2) recInput.Items.Add(new Separator());- foreach (var c in choices.Skip(2)) recInput.Items.Add(c);+ foreach (var c in choices.Take(fixedCount)) recInput.Items.Add(c);+ if (choices.Count > fixedCount) recInput.Items.Add(new Separator());+ foreach (var c in choices.Skip(fixedCount)) recInput.Items.Add(c);}// MIDI from ▸ (instrument tracks only): play another instrument track's MIDI through@@ -2547,9 +2552,9 @@ public sealed partial class ArrangementView : UserControlHorizontalContentAlignment = HorizontalAlignment.Stretch, // let the item span the box (In left / name right)Margin = new Thickness(0, 0, 12, 0), // a touch shorter than the row};- var sources = new List<int>();+ var sources = new List<RecordInputPick>();// "In" pinned left (faded), the source name pinned right, so the name stands out.- void Add(string value, int src)+ void Add(string value, RecordInputPick src){var inTb = new TextBlock { Text = "In", FontSize = 9, Foreground = Brush("Brush.TextDisabled"), VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(monitor is null ? 6 : 4, 0) };var valTb = new TextBlock { Text = value, FontSize = 9, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Right, TextTrimming = TextTrimming.CharacterEllipsis, Margin = new Thickness(monitor is null ? 6 : 4, 0) };@@ -2566,19 +2571,19 @@ public sealed partial class ArrangementView : UserControlcb.Items.Add(new ComboBoxItem { Content = content, Padding = new Thickness(6, 2), MinHeight = 0, HorizontalContentAlignment = HorizontalAlignment.Stretch });sources.Add(src);}- Add("Ext", 0);- Add("Master", -1);- foreach (var v in _tracks) if (v.Id != trackId) Add(v.Name.Length > 0 ? v.Name : $"Track {v.Id}", v.Id);- foreach (var v in _returns) Add(v.Name.Length > 0 ? v.Name : $"Return {v.Id}", v.Id);- int cur = _engine?.GetTrackRecordInput(trackId) ?? 0;- int sel = sources.IndexOf(cur);+ foreach (var (pick, _, shortName) in RecordInputPick.Hardware) Add(shortName, pick);+ Add("Master", RecordInputPick.Track(-1));+ foreach (var v in _tracks) if (v.Id != trackId) Add(v.Name.Length > 0 ? v.Name : $"Track {v.Id}", RecordInputPick.Track(v.Id));+ foreach (var v in _returns) Add(v.Name.Length > 0 ? v.Name : $"Return {v.Id}", RecordInputPick.Track(v.Id));+ var cur = _engine is null ? RecordInputPick.Hardware[0].Pick : RecordInputPick.Of(_engine, trackId);+ int sel = sources.FindIndex(p => p.Matches(cur));cb.SelectedIndex = sel >= 0 ? sel : 0;- monitor?.SetSource(sel >= 0 ? cur : 0);+ monitor?.SetSource(sel >= 0 ? cur.Source : 0);cb.SelectionChanged += (_, _) =>{- if (cb.SelectedIndex < 0 || cb.SelectedIndex >= sources.Count) return;- _engine?.SetTrackRecordInput(trackId, sources[cb.SelectedIndex]);- monitor?.SetSource(sources[cb.SelectedIndex]);+ if (cb.SelectedIndex < 0 || cb.SelectedIndex >= sources.Count || _engine is null) return;+ sources[cb.SelectedIndex].ApplyTo(_engine, trackId);+ monitor?.SetSource(sources[cb.SelectedIndex].Source);};return cb;}@@ -2724,11 +2729,13 @@ public sealed partial class ArrangementView : UserControl// toggle's own colour — mute amber, solo blue, arm red — with// derived ink. Record-arm: at rest a neutral key with a red disc; armed, solid red with a// white disc.- private Control ArmToggle(bool initial, Action<bool> onChanged)+ // onChanged(armed, additive): additive = ⌘/Ctrl held, arm without disarming the others (#332).+ private Control ArmToggle(bool initial, Action<bool, bool> onChanged){bool state = initial;var disc = new Glyph(GlyphKind.Record, 7);var chip = new Border { Width = 18, Height = 16, CornerRadius = NotaRadius.Control, BorderThickness = new Thickness(1), Child = disc, Cursor = new Cursor(StandardCursorType.Hand) };+ ToolTip.SetTip(chip, TrackArming.Tip);void Paint(){chip.Background = state ? NotaPalette.Record : NotaPalette.SurfaceRaised;@@ -2739,7 +2746,7 @@ public sealed partial class ArrangementView : UserControlchip.PointerPressed += (_, e) =>{if (!e.GetCurrentPoint(chip).Properties.IsLeftButtonPressed) return;- e.Handled = true; state = !state; Paint(); onChanged(state);+ e.Handled = true; state = !state; Paint(); onChanged(state, TrackArming.IsAdditive(e.KeyModifiers));};return chip;}diff --git a/src/managed/Nota.App/BrowserView.cs b/src/managed/Nota.App/BrowserView.csindex 931cb24a..33cf749f 100644--- a/src/managed/Nota.App/BrowserView.cs+++ b/src/managed/Nota.App/BrowserView.cs@@ -703,6 +703,9 @@ public sealed class BrowserView : UserControl_sampleChipsHost.IsVisible = index == FilesTab && _vm?.HasSampleIndex == true;_statusBar.IsVisible = !isMap;if (isMap) { _matchCount.Text = ""; _emptyWrap.IsVisible = false; return; }+ // The shared search box may have changed on another tab (#342).+ if (index <= PresetsTab) _vm?.ShowTab(index, _search.Text?.Trim() ?? "");+ else ApplyFilter(index);RefreshCounts();}diff --git a/src/managed/Nota.App/MainWindow.Detail.cs b/src/managed/Nota.App/MainWindow.Detail.csindex d3658d28..80bff992 100644--- a/src/managed/Nota.App/MainWindow.Detail.cs+++ b/src/managed/Nota.App/MainWindow.Detail.cs@@ -111,7 +111,7 @@ public partial class MainWindow{parts.Add("audio");int src = Engine.GetTrackRecordInput(trackId);- parts.Add("In " + (src == 0 ? "Ext" : src == -1 ? "Master" : ChipTrackName(src)));+ parts.Add("In " + (src == 0 ? RecordInputPick.HardwareShort(Engine.GetTrackInputChannels(trackId)) : src == -1 ? "Master" : ChipTrackName(src)));// A Master source stays silent while monitored (it would feed back).if (src != -1 && Engine.GetTrackMonitor(trackId)) parts.Add("Monitor in");}@@ -142,6 +142,8 @@ public partial class MainWindowprivate void OnTrackSelected(int trackId){+ TrackArming.FollowSelection(Engine, trackId); // arm-on-select (#332)+// Switching to a different track abandons the previously edited clip. Reset the clip// editor to empty so a stale editor from the old track doesn't linger — most visible// in the popped-out Devices/Clip window, whose top pane isn't touched by ShowDevices.diff --git a/src/managed/Nota.App/MainWindow.Dnd.cs b/src/managed/Nota.App/MainWindow.Dnd.csindex dcd7760f..7a82e693 100644--- a/src/managed/Nota.App/MainWindow.Dnd.cs+++ b/src/managed/Nota.App/MainWindow.Dnd.cs@@ -182,7 +182,13 @@ public partial class MainWindow_ => DeviceChainView.ChainKind.Effect,}, pl.Index, pl.Name, pl.FactoryId);Timeline.Refresh();- if (r.CreatedTrack && t > 0) Timeline.RevealTrack(t); // a new track lands in view (F1)+ if (r.CreatedTrack && t > 0)+ {+ Timeline.RevealTrack(t); // a new track lands in view (F1)+ // …and becomes the selected track, as a drop does: the old selection's highlight+ // goes, and arm-on-select hands it the keyboard (#332).+ if (Timeline.SelectedTrackId != t) Timeline.SelectTrackFromOutside(t);+ }_session?.Refresh();if (_modular?.IsVisible == true) _modular.Refresh();if (revealDevices && r.ShowDevices && t > 0) ShowDevices(t);diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.csindex 0d4cab54..6189a8d6 100644--- a/src/managed/Nota.App/MainWindow.Files.cs+++ b/src/managed/Nota.App/MainWindow.Files.cs@@ -451,6 +451,7 @@ public partial class MainWindow_blockMovesDone = 0;CloseDetail(); // collapse the docked row too, not just hide the panel_deviceChain?.ForgetCardState(); // per-track preset labels belong to the old project+ TrackArming.ForgetSelection(); // the arm-on-select memory tooTimeline.Refresh();_session?.Refresh();// Popped out, the window stays up: show the new project's chain, not the old one's.diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex 64e3f676..d8507b3a 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -367,6 +367,8 @@ public partial class MainWindow : Windowvm.Transport.RecordArmTarget = () => Timeline.RecordArmTarget();vm.Transport.SelectionLoopRange = () => Timeline.SelectionLoopRange();vm.Transport.TracksChanged += () => { Timeline.Refresh(); ReloadEditorNotes(); };+ TrackArming.OthersChanged -= OnArmsChanged;+ TrackArming.OthersChanged += OnArmsChanged; // an exclusive arm disarmed other tracks (#332)Timeline.FollowSuspendedChanged -= OnFollowSuspendedChanged;Timeline.FollowSuspendedChanged += OnFollowSuspendedChanged;Timeline.LoopChanged += () => vm.Transport.SyncLoop(); // ruler drag / "Loop selection" → transport bar@@ -863,6 +865,15 @@ public partial class MainWindow : Window// Follow pauses when the lanes are scrolled away during playback (#105); the Follow// button dims to say so and the status bar says how to pick it up again.+ // Repaint every arm button once the click that disarmed the others has finished (the+ // views rebuild the very header the click landed on).+ private void OnArmsChanged() => Avalonia.Threading.Dispatcher.UIThread.Post(() =>+ {+ Timeline.Refresh();+ _session?.Refresh();+ _mixer?.Refresh();+ });+private void OnFollowSuspendedChanged(){bool paused = Timeline.FollowSuspended;diff --git a/src/managed/Nota.App/MixerView.cs b/src/managed/Nota.App/MixerView.csindex 514368ab..bed16672 100644--- a/src/managed/Nota.App/MixerView.cs+++ b/src/managed/Nota.App/MixerView.cs@@ -571,23 +571,24 @@ public sealed class MixerView : UserControlMidiLearn.Bind(solo, MidiTarget.TrackSolo(id), "Solo");row.Children.Add(mute);row.Children.Add(solo);- if (!isReturn) row.Children.Add(ArmToggle(ti.Armed != 0, v => _engine.SetTrackArmed(id, v)));+ if (!isReturn) row.Children.Add(ArmToggle(ti.Armed != 0, (v, additive) => TrackArming.Set(_engine, id, v, additive)));return new Border { Height = 28, BorderBrush = BorderInner, BorderThickness = new Thickness(0, 1, 0, 0), Child = row };}// Record-arm: neutral with a red disc at rest, solid record red with a pale disc when armed.- private Border ArmToggle(bool initial, Action<bool> set)+ private Border ArmToggle(bool initial, Action<bool, bool> set) // (armed, ⌘/Ctrl held) — #332{bool on = initial;var disc = new Glyph(GlyphKind.Record, 7);var b = new Border { Width = 20, Height = 17, CornerRadius = NotaRadius.Control, BorderThickness = new Thickness(1), Child = disc };+ ToolTip.SetTip(b, TrackArming.Tip);void Paint(){b.Background = on ? NotaPalette.Record : MasterBg;b.BorderBrush = on ? NotaPalette.Record : NotaPalette.Seam;disc.Foreground = on ? NotaPalette.RecordInk : NotaPalette.Record;}- b.PointerPressed += (_, e) => { if (!e.GetCurrentPoint(b).Properties.IsLeftButtonPressed) return; e.Handled = true; on = !on; set(on); Paint(); };+ b.PointerPressed += (_, e) => { if (!e.GetCurrentPoint(b).Properties.IsLeftButtonPressed) return; e.Handled = true; on = !on; set(on, TrackArming.IsAdditive(e.KeyModifiers)); Paint(); };Paint();return b;}diff --git a/src/managed/Nota.App/RecordInputPick.cs b/src/managed/Nota.App/RecordInputPick.csnew file mode 100644index 00000000..ac395195--- /dev/null+++ b/src/managed/Nota.App/RecordInputPick.cs@@ -0,0 +1,47 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// One entry of an audio track's record-input pickers (track menu, header box, Session I/O+// row): a source plus, for the hardware input, which of its channels the track takes (#340).+// The hardware input shows up as three entries — inputs 1/2 as a stereo pair, input 1 alone,+// input 2 alone — so a mono mic on one input of a stereo device can be recorded centred.++using System;+using Nota.Application;++namespace Nota.App;++internal readonly record struct RecordInputPick(int Source, InputChannels Channels)+{+ /// <summary>The hardware-input entries, in picker order, with their menu and short labels.</summary>+ public static readonly (RecordInputPick Pick, string Label, string Short)[] Hardware =+ {+ (new(0, InputChannels.Mono1), "Audio input 1 (mono)", "Ext 1"),+ (new(0, InputChannels.Mono2), "Audio input 2 (mono)", "Ext 2"),+ (new(0, InputChannels.Stereo), "Audio inputs 1/2 (stereo)", "Ext 1/2"),+ };++ /// <summary>A track's current pick. Channels only matter for the hardware input.</summary>+ public static RecordInputPick Of(IAudioEngine engine, int trackId)+ {+ int src = engine.GetTrackRecordInput(trackId);+ return new(src, src == 0 ? engine.GetTrackInputChannels(trackId) : InputChannels.Stereo);+ }++ /// <summary>The short label of a hardware pick ("Ext 1", "Ext 2", "Ext 1/2").</summary>+ public static string HardwareShort(InputChannels channels)+ => Array.Find(Hardware, h => h.Pick.Channels == channels).Short ?? "Ext";++ /// <summary>A track or return as a source (any channel setting: only hardware has one).</summary>+ public static RecordInputPick Track(int source) => new(source, InputChannels.Stereo);++ /// <summary>Whether this entry is the track's current pick.</summary>+ public bool Matches(RecordInputPick current)+ => Source == current.Source && (Source != 0 || Channels == current.Channels);++ public void ApplyTo(IAudioEngine engine, int trackId)+ {+ if (Source == 0) engine.SetTrackInputChannels(trackId, Channels);+ engine.SetTrackRecordInput(trackId, Source);+ }+}diff --git a/src/managed/Nota.App/SessionView.Mixer.cs b/src/managed/Nota.App/SessionView.Mixer.csindex 4c1d14b0..529c1094 100644--- a/src/managed/Nota.App/SessionView.Mixer.cs+++ b/src/managed/Nota.App/SessionView.Mixer.cs@@ -165,12 +165,12 @@ public sealed partial class SessionViewif (hasTrack){int id = c.TrackId;- btns.Children.Add(MixToggle("M", ti.Muted != 0, false, v => _engine.SetTrackMute(id, v)));- btns.Children.Add(MixToggle("S", ti.Soloed != 0, false, v => _engine.SetTrackSolo(id, v)));+ btns.Children.Add(MixToggle("M", ti.Muted != 0, false, (v, _) => _engine.SetTrackMute(id, v)));+ btns.Children.Add(MixToggle("S", ti.Soloed != 0, false, (v, _) => _engine.SetTrackSolo(id, v)));if (c.Kind == ColKind.Track)- btns.Children.Add(MixToggle(null, ti.Armed != 0, true, v =>+ btns.Children.Add(MixToggle(null, ti.Armed != 0, true, (v, additive) =>{- _engine.SetTrackArmed(id, v);+ TrackArming.Set(_engine, id, v, additive);if (v) _armed.Add(id); else _armed.Remove(id);UpdateStates();}));@@ -204,7 +204,8 @@ public sealed partial class SessionView// M / S / record-arm: a 20px key. Engaged mute fills amber, solo blue, arm the record red// with its white disc (DESIGN.md § Controls), each with derived ink.- private static Control MixToggle(string? label, bool initial, bool arm, Action<bool> set)+ // set(on, additive): additive = ⌘/Ctrl held (the arm button arms without disarming the others, #332).+ private static Control MixToggle(string? label, bool initial, bool arm, Action<bool, bool> set){bool on = initial;var text = new TextBlock { Text = label ?? "", FontSize = 10, FontWeight = FontWeight.SemiBold, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };@@ -229,12 +230,12 @@ public sealed partial class SessionViewb.BorderBrush = on ? fill : NotaPalette.Seam;text.Foreground = on ? NotaPalette.InkOn(fill) : NotaPalette.TextSecondary;}- ToolTip.SetTip(b, arm ? "Arm for recording" : label == "M" ? "Mute" : "Solo");+ ToolTip.SetTip(b, arm ? TrackArming.Tip : label == "M" ? "Mute" : "Solo");b.PointerPressed += (_, e) =>{if (!e.GetCurrentPoint(b).Properties.IsLeftButtonPressed) return;e.Handled = true;- on = !on; set(on); Paint();+ on = !on; set(on, TrackArming.IsAdditive(e.KeyModifiers)); Paint();};Paint();return b;@@ -250,32 +251,33 @@ public sealed partial class SessionViewif (_engine.TryGetTrackInfo(i, out var t) && t.Id != c.TrackId && !t.IsGroup)names.Add((t.Id, TrackNames.Of(_engine, t), t.IsInstrument));- var items = new List<(int Value, string Label)>();- int cur;+ // An audio track's hardware input appears once per channel pick (#340): 1, 2, 1/2.+ var items = new List<(RecordInputPick Value, string Label)>();+ RecordInputPick cur;if (c.IsInstrument){- items.Add((-1, "All ins"));- foreach (var n in names.Where(n => n.Instrument)) items.Add((n.Id, n.Name));- cur = _engine.GetTrackMidiSource(c.TrackId);+ items.Add((RecordInputPick.Track(-1), "All ins"));+ foreach (var n in names.Where(n => n.Instrument)) items.Add((RecordInputPick.Track(n.Id), n.Name));+ cur = RecordInputPick.Track(_engine.GetTrackMidiSource(c.TrackId));}else{- items.Add((0, "Ext in"));- items.Add((-1, "Master"));- foreach (var n in names) items.Add((n.Id, n.Name));- cur = _engine.GetTrackRecordInput(c.TrackId);+ foreach (var (pick, _, shortName) in RecordInputPick.Hardware) items.Add((pick, shortName));+ items.Add((RecordInputPick.Track(-1), "Master"));+ foreach (var n in names) items.Add((RecordInputPick.Track(n.Id), n.Name));+ cur = RecordInputPick.Of(_engine, c.TrackId);}var cb = new ComboBox { Height = IoRowH, FontSize = 10, Padding = new Thickness(6, 0), HorizontalAlignment = HorizontalAlignment.Stretch, Margin = new Thickness(4, 0) };foreach (var it in items) cb.Items.Add(new ComboBoxItem { Content = it.Label, FontSize = 10 });- int sel = items.FindIndex(it => it.Value == cur);+ int sel = items.FindIndex(it => it.Value.Matches(cur));cb.SelectedIndex = sel >= 0 ? sel : 0;int id = c.TrackId;bool inst = c.IsInstrument;cb.SelectionChanged += (_, _) =>{if (cb.SelectedIndex < 0) return;- int v = items[cb.SelectedIndex].Value;- if (inst) _engine.SetTrackMidiSource(id, v); else _engine.SetTrackRecordInput(id, v);+ var v = items[cb.SelectedIndex].Value;+ if (inst) _engine.SetTrackMidiSource(id, v.Source); else v.ApplyTo(_engine, id);};ToolTip.SetTip(cb, inst ? "MIDI input: every input, or another instrument track" : "Record input");return cb;diff --git a/src/managed/Nota.App/TrackArming.cs b/src/managed/Nota.App/TrackArming.csnew file mode 100644index 00000000..66107c46--- /dev/null+++ b/src/managed/Nota.App/TrackArming.cs@@ -0,0 +1,47 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The arm buttons' side of exclusive record-arm (#332, rule in Nota.Presentation.TrackArm):+// every arm button (Arrangement header, Session mixer, Mixer window) goes through here, and+// the views repaint when an arm disarmed other tracks.++using System;+using Nota.Application;+using Nota.Presentation;++namespace Nota.App;++internal static class TrackArming+{+ /// <summary>Raised after an arm changed tracks other than the button's own (an exclusive arm+ /// disarmed them, or the selection armed one), so every view repaints them.</summary>+ public static event Action? OthersChanged;++ /// <summary>Arms or disarms a track, exclusively unless <paramref name="additive"/> (see TrackArm).</summary>+ public static void Set(IAudioEngine engine, int trackId, bool on, bool additive)+ {+ if (TrackArm.Set(engine, trackId, on, additive)) OthersChanged?.Invoke();+ }++ private static int _followed = -1;++ /// <summary>The selection moved to <paramref name="trackId"/>: arm it if it's an+ /// instrument track (see TrackArm.FollowSelection). Only a move to another track counts,+ /// so a track disarmed by hand stays disarmed while you keep working on it.</summary>+ public static void FollowSelection(IAudioEngine engine, int trackId)+ {+ if (trackId == _followed) return;+ _followed = trackId;+ if (TrackArm.FollowSelection(engine, trackId)) OthersChanged?.Invoke();+ }++ /// <summary>A new or reopened project reuses track ids: its first selection is a move.</summary>+ public static void ForgetSelection() => _followed = -1;++ /// <summary>The arm buttons' tooltip, with the platform's modifier spelled out.</summary>+ public static string Tip => MenuKit.Keys("Arm for recording · ⌘-click to arm several tracks");++ /// <summary>⌘ on macOS, Ctrl elsewhere: the "add to the armed set" modifier.</summary>+ public static bool IsAdditive(Avalonia.Input.KeyModifiers m)+ => (m & (OperatingSystem.IsMacOS() ? Avalonia.Input.KeyModifiers.Meta : Avalonia.Input.KeyModifiers.Control)) != 0;+}diff --git a/src/managed/Nota.Application/Engine/EngineContracts.cs b/src/managed/Nota.Application/Engine/EngineContracts.csindex 4c0ace7e..3c54bba5 100644--- a/src/managed/Nota.Application/Engine/EngineContracts.cs+++ b/src/managed/Nota.Application/Engine/EngineContracts.cs@@ -287,6 +287,10 @@ public enum UngroupDropped { None = 0, MacroMappings = 1, ChainMix = 2 }/// channel as a track pans, Stereo folds it into the near side.</summary>public enum PanLaw { Balance = 0, Stereo = 1 }+/// <summary>Which hardware input channels an audio track records and monitors (#340): both as a+/// stereo pair (1/2), or input 1 / input 2 alone — a mono source, placed in the middle.</summary>+public enum InputChannels { Stereo = 0, Mono1 = 1, Mono2 = 2 }+/// <summary>One Stereo Map row (specs/008), laid out like native NotaStereoMeasure: what a/// track / return / the master sends to the master, averaged over ~300 ms. Balance is on the/// pan scale (a mono source panned to p reads p); width = 1 − correlation, clamped 0..1.</summary>diff --git a/src/managed/Nota.Application/Engine/IAudioEngine.cs b/src/managed/Nota.Application/Engine/IAudioEngine.csindex 26ae235b..802ae4ff 100644--- a/src/managed/Nota.Application/Engine/IAudioEngine.cs+++ b/src/managed/Nota.Application/Engine/IAudioEngine.cs@@ -326,6 +326,10 @@ public interface IAudioEngine : IDisposable/// <summary>Audio-track record input source: 0 hardware, -1 master, >0 source track id.</summary>void SetTrackRecordInput(int trackId, int source);int GetTrackRecordInput(int trackId);+ /// <summary>Which hardware input channels an audio track takes: both as a stereo pair, or+ /// input 1 / input 2 alone as a mono source in the middle (#340). Hardware input only.</summary>+ void SetTrackInputChannels(int trackId, InputChannels channels);+ InputChannels GetTrackInputChannels(int trackId);/// <summary>Live input monitoring (audio tracks, Monitor "In"): play the record-input/// source through the track in place of its clips. A master source stays silent.</summary>void SetTrackMonitor(int trackId, bool on);diff --git a/src/managed/Nota.Application/Palette/ModularCatalog.cs b/src/managed/Nota.Application/Palette/ModularCatalog.csindex b8979fd9..c065ebc3 100644--- a/src/managed/Nota.Application/Palette/ModularCatalog.cs+++ b/src/managed/Nota.Application/Palette/ModularCatalog.cs@@ -21,7 +21,7 @@ public static class ModularCatalogpublic static IReadOnlyList<ModularNode> All { get; } = new ModularNode[]{new("LFO", 0, "Modulator", D("lfo oscillator wobble", "A low-frequency oscillator, free or synced to the tempo.")),- new("Envelope Follower", 1, "Modulator", D("envelope follower env sidechain", "Turns an audio signal's level into a control signal.")),+ new("Envelope Follower", 1, "Modulator", D("envelope follower env sidechain peak controller ducking duck pump loudness level volume", "Turns the track's loudness into a control signal: a peak controller, for ducking one track under another.")),new("MIDI → CV", 2, "Converter", D("midi cv velocity note pitch", "Turns notes, velocity and controllers into control signals.")),new("ADSR", 3, "Modulator", D("adsr envelope", "An attack-decay-sustain-release envelope triggered by notes.")),new("Macro", 4, "Control", D("macro knob", "One knob driving several destinations.")),diff --git a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.csindex bf896fbc..4151bd66 100644--- a/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs+++ b/src/managed/Nota.Infrastructure/Interop/NativeMethods.Tracks.cs@@ -303,6 +303,12 @@ internal static partial class NativeMethods[LibraryImport(Lib, EntryPoint = "nota_track_get_record_input")]internal static partial int TrackGetRecordInput(IntPtr engine, int trackId);+ [LibraryImport(Lib, EntryPoint = "nota_track_set_input_channels")]+ internal static partial NotaResult TrackSetInputChannels(IntPtr engine, int trackId, int channels);++ [LibraryImport(Lib, EntryPoint = "nota_track_get_input_channels")]+ internal static partial int TrackGetInputChannels(IntPtr engine, int trackId);+[LibraryImport(Lib, EntryPoint = "nota_track_set_monitor")]internal static partial NotaResult TrackSetMonitor(IntPtr engine, int trackId, int on);diff --git a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.csindex 9595dcff..29bf21be 100644--- a/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs+++ b/src/managed/Nota.Infrastructure/Interop/NotaEngine.Tracks.cs@@ -505,6 +505,14 @@ public sealed partial class NotaEnginepublic int GetTrackRecordInput(int trackId){ ThrowIfDisposed(); return NativeMethods.TrackGetRecordInput(_handle, trackId); }+ /// <summary>Sets which hardware input channels an audio track takes (stereo 1/2, input 1 or input 2).</summary>+ public void SetTrackInputChannels(int trackId, InputChannels channels)+ { ThrowIfDisposed(); NativeMethods.TrackSetInputChannels(_handle, trackId, (int)channels); }++ /// <summary>Gets which hardware input channels an audio track takes.</summary>+ public InputChannels GetTrackInputChannels(int trackId)+ { ThrowIfDisposed(); return (InputChannels)NativeMethods.TrackGetInputChannels(_handle, trackId); }+/// <summary>Turns live input monitoring on/off for an audio track (hear its record input through the track).</summary>public void SetTrackMonitor(int trackId, bool on){ ThrowIfDisposed(); NativeMethods.TrackSetMonitor(_handle, trackId, on ? 1 : 0); }diff --git a/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs b/src/managed/Nota.Infrastructure/Persistence/ProjectModel.csindex d2c4c1cb..73c2b06a 100644--- a/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs+++ b/src/managed/Nota.Infrastructure/Persistence/ProjectModel.cs@@ -122,6 +122,9 @@ public sealed class TrackDto// output (encoded so it survives id reassignment across save/load).public int RecordInput { get; set; }public bool Monitor { get; set; } // live input monitoring (audio tracks)+ // Hardware input channels (audio tracks): 0 stereo pair, 1 input 1, 2 input 2. Absent in+ // files saved before 0.58, which recorded the stereo pair.+ public int? InputChannels { get; set; }// MIDI routing source ("MIDI In") as a doc-list index (survives id reassignment), or -1 = off.public int MidiFrom { get; set; } = -1;public float[] Sends { get; set; } = new float[4];diff --git a/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs b/src/managed/Nota.Infrastructure/Persistence/ProjectService.csindex 7cae8346..89c15d75 100644--- a/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs+++ b/src/managed/Nota.Infrastructure/Persistence/ProjectService.cs@@ -107,6 +107,7 @@ public sealed class ProjectService? (idToIndex.TryGetValue(rin, out var rix) ? rix + 2 : 0) // track source → doc index + 2: rin, // 0 hardware / -1 masterMonitor = engine.GetTrackMonitor(ti.Id),+ InputChannels = (int)engine.GetTrackInputChannels(ti.Id),MidiFrom = engine.GetTrackMidiSource(ti.Id) is var mfrom && mfrom > 0&& idToIndex.TryGetValue(mfrom, out var mix) ? mix : -1, // source → doc index, else off};@@ -674,6 +675,7 @@ public sealed class ProjectServiceif (t.ColorIndex >= 0) engine.SetTrackColorIndex(id, t.ColorIndex);if (t.RecordInput != 0) recInputDeferred.Add((id, t.RecordInput)); // resolve after all tracks existif (t.Monitor) monitorDeferred.Add((id, true)); // after record inputs resolve+ engine.SetTrackInputChannels(id, (InputChannels)(t.InputChannels ?? 0)); // older files: the stereo pairif (t.MidiFrom >= 0) midiFromDeferred.Add((id, t.MidiFrom)); // resolve after all tracks existfor (int b = 0; b < t.Sends.Length && b < 4; b++) engine.SetTrackSend(id, b, t.Sends[b]);diff --git a/src/managed/Nota.Mcp/Tools/MixerTools.cs b/src/managed/Nota.Mcp/Tools/MixerTools.csindex bc909338..9879b04c 100644--- a/src/managed/Nota.Mcp/Tools/MixerTools.cs+++ b/src/managed/Nota.Mcp/Tools/MixerTools.cs@@ -51,6 +51,12 @@ public sealed class MixerTools(IAudioEngine engine, IEngineDispatch dispatch, IA[McpServerTool(Name = "get_record_input"), Description("Read a track's record-input source index.")]public Task<int> GetRecordInput(int trackId) => Read(() => E.GetTrackRecordInput(trackId));+ [McpServerTool(Name = "set_input_channels"), Description("Set which hardware input channels an audio track records and monitors: 0 = both as a stereo pair (1/2), 1 = input 1 alone, 2 = input 2 alone (a mono source, placed in the middle).")]+ public Task SetInputChannels(int trackId, int channels) => Mutate(() => E.SetTrackInputChannels(trackId, (InputChannels)channels));++ [McpServerTool(Name = "get_input_channels"), Description("Read an audio track's hardware input channels: 0 stereo pair (1/2), 1 input 1, 2 input 2.")]+ public Task<int> GetInputChannels(int trackId) => Read(() => (int)E.GetTrackInputChannels(trackId));+[McpServerTool(Name = "set_track_monitor"), Description("Turn live input monitoring on/off for an audio track: it plays its record-input source (hardware input, or another track's / return's output) through its devices and fader in real time, in place of its clips.")]public Task SetTrackMonitor(int trackId, bool on) => Mutate(() => E.SetTrackMonitor(trackId, on));diff --git a/src/managed/Nota.Presentation/TrackArm.cs b/src/managed/Nota.Presentation/TrackArm.csnew file mode 100644index 00000000..2f5cdb21--- /dev/null+++ b/src/managed/Nota.Presentation/TrackArm.cs@@ -0,0 +1,61 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Exclusive record-arm (#332): arming a track with a plain click arms that track alone, so+// picking which instrument the keyboard plays is one click; the additive form (⌘-click, or+// Ctrl-click on Windows / Linux) arms or disarms one track and leaves the others as they are.+// Selecting an instrument track arms it the same way, while the arms are still the one the+// selection picked.++using Nota.Application;++namespace Nota.Presentation;++public static class TrackArm+{+ /// <summary>Arms or disarms <paramref name="trackId"/>. Arming without+ /// <paramref name="additive"/> disarms every other track first — except while recording,+ /// where disarming would end another track's take. Returns true when other tracks changed.</summary>+ public static bool Set(IAudioEngine engine, int trackId, bool on, bool additive)+ {+ bool others = false;+ if (on && !additive && !engine.IsRecording)+ for (int i = 0; i < engine.TrackCount; i++)+ if (engine.TryGetTrackInfo(i, out var t) && t.Id != trackId && t.Armed != 0)+ {+ engine.SetTrackArmed(t.Id, false);+ others = true;+ }+ engine.SetTrackArmed(trackId, on);+ return others;+ }++ /// <summary>Arm-on-select: selecting an instrument track arms it alone, so the keyboard+ /// plays the track you're on. The arms are left as they are while recording, when the+ /// track is already armed, and when they're a set built by hand — several tracks, or an+ /// audio track. Returns true when any arm changed.</summary>+ public static bool FollowSelection(IAudioEngine engine, int trackId)+ {+ if (engine.IsRecording) return false;+ bool isInstrument = false;+ int armedOthers = 0;+ for (int i = 0; i < engine.TrackCount; i++)+ {+ if (!engine.TryGetTrackInfo(i, out var t)) continue;+ bool inst = t.IsInstrument && !t.IsReturn && !t.IsGroup;+ if (t.Id == trackId)+ {+ if (t.Armed != 0) return false;+ isInstrument = inst;+ }+ else if (t.Armed != 0)+ {+ if (!inst) return false;+ armedOthers++;+ }+ }+ if (!isInstrument || armedOthers > 1) return false;+ Set(engine, trackId, true, additive: false);+ return true;+ }+}diff --git a/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs b/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.csindex 7237b02c..5c02c925 100644--- a/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs+++ b/src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs@@ -497,6 +497,16 @@ public sealed partial class BrowserViewModel : ObservableObjectelse RebuildVisible(tab);}+ /// <summary>A tree tab comes into view: the search box is shared by every tab, but only the+ /// tab on screen follows it as you type, so a tab shown again takes the box's query if it+ /// changed meanwhile. Otherwise a search cleared on another tab kept this one filtered —+ /// empty, under an empty box (#342).</summary>+ public void ShowTab(int tab, string query)+ {+ if (tab < 0 || tab >= _treeQuery.Length) return;+ if (_treeQuery[tab].Trim() != (query ?? "").Trim()) FilterTree(tab, query ?? "");+ }+// Flatten a tree into its visible ObservableCollection, honouring expand state and// the current query. With a query, matching is name/sub substring; a matching device// shows its category folders, and a device with matching presets shows just thosediff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.hindex 4a6ecd6c..ae6d2da3 100644--- a/src/native/nota.engine/include/nota/nota_engine.h+++ b/src/native/nota.engine/include/nota/nota_engine.h@@ -1358,6 +1358,10 @@ NOTA_API int32_t nota_track_has_clipboard(NotaEngine* engine);* -1 = master bus, >0 = another track's post-fader output (by id). */NOTA_API NotaResult nota_track_set_record_input(NotaEngine* engine, int32_t track_id, int32_t source);NOTA_API int32_t nota_track_get_record_input(NotaEngine* engine, int32_t track_id);+/* Hardware input channels an audio track takes: 0 = both as a stereo pair (1/2), 1 = input 1+ * alone, 2 = input 2 alone. A mono pick is heard and recorded in the middle of both sides. */+NOTA_API NotaResult nota_track_set_input_channels(NotaEngine* engine, int32_t track_id, int32_t channels);+NOTA_API int32_t nota_track_get_input_channels(NotaEngine* engine, int32_t track_id);/* Input monitoring (audio tracks, Monitor "In"): while on, the track plays its record-input* source live through its devices + fader instead of its clips. A master source stays* silent (it would feed back). push_monitor_frames feeds the hardware-monitor ring withoutdiff --git a/src/native/nota.engine/src/abi/nota_engine_track.cpp b/src/native/nota.engine/src/abi/nota_engine_track.cppindex 1b6610f7..f2a51eee 100644--- a/src/native/nota.engine/src/abi/nota_engine_track.cpp+++ b/src/native/nota.engine/src/abi/nota_engine_track.cpp@@ -684,6 +684,14 @@ NotaResult nota_track_set_record_input(NotaEngine* e, int32_t track_id, int32_tint32_t nota_track_get_record_input(NotaEngine* e, int32_t track_id) {return e ? CENG(e)->trackRecordInput(track_id) : 0;}+NotaResult nota_track_set_input_channels(NotaEngine* e, int32_t track_id, int32_t channels) {+ if (!e) return NOTA_ERR_INVALID_ARG;+ ENG(e)->setTrackInputChannels(track_id, channels);+ return NOTA_OK;+}+int32_t nota_track_get_input_channels(NotaEngine* e, int32_t track_id) {+ return e ? CENG(e)->trackInputChannels(track_id) : 0;+}NotaResult nota_track_set_monitor(NotaEngine* e, int32_t track_id, int32_t on) {if (!e) return NOTA_ERR_INVALID_ARG;ENG(e)->setTrackMonitor(track_id, on != 0);diff --git a/src/native/nota.engine/src/engine/Engine.cpp b/src/native/nota.engine/src/engine/Engine.cppindex 18614d24..384fbffe 100644--- a/src/native/nota.engine/src/engine/Engine.cpp+++ b/src/native/nota.engine/src/engine/Engine.cpp@@ -554,6 +554,7 @@ std::shared_ptr<Track> Engine::cloneTrack(const Track& t) const {nt->setReturnIndex(t.returnIndex()); // M6-1nt->setGroupId(t.groupId()); // group membershipnt->setRecordInputSource(t.recordInputSource()); // internal record routing+ nt->setInputChannels(t.inputChannels()); // mono / stereo hardware inputnt->setMonitor(t.monitor()); // live input monitoringnt->setMidiFromTrackId(t.midiFromTrackId()); // MIDI routingfor (int b = 0; b < kMaxReturns; ++b) nt->setSend(b, t.send(b)); // M6-1: send levelsdiff --git a/src/native/nota.engine/src/engine/Engine.h b/src/native/nota.engine/src/engine/Engine.hindex 54fb210a..db1d501f 100644--- a/src/native/nota.engine/src/engine/Engine.h+++ b/src/native/nota.engine/src/engine/Engine.h@@ -1184,6 +1184,8 @@ class Engine {// -1 = master bus, >0 = another track's post-fader output (by id).void setTrackRecordInput(int32_t trackId, int32_t source);int32_t trackRecordInput(int32_t trackId) const;+ void setTrackInputChannels(int32_t trackId, int32_t channels); // Track::kInputStereo / kInputMono1 / kInputMono2+ int32_t trackInputChannels(int32_t trackId) const;// Input monitoring (audio tracks): hear the record-input source live through the track.void setTrackMonitor(int32_t trackId, bool on);bool trackMonitor(int32_t trackId) const;@@ -1918,6 +1920,7 @@ class Engine {// jitter) and wraps at the loop length, so each pass overwrites the previous in place.// Activated when loop is on at record start OR the moment loop is enabled mid-take.bool captureLoop_ = false;+ int32_t captureChannels_ = Track::kInputStereo; // the take's hardware channel pick (#340)bool captureWrapped_ = false;size_t captureLoopFrames_ = 0; // loop length in capture-SR framessize_t captureOrigin_ = 0; // cursor position where this take started (for partial clips)diff --git a/src/native/nota.engine/src/engine/Engine_Recording.cpp b/src/native/nota.engine/src/engine/Engine_Recording.cppindex 4a4282e3..ba551b5d 100644--- a/src/native/nota.engine/src/engine/Engine_Recording.cpp+++ b/src/native/nota.engine/src/engine/Engine_Recording.cpp@@ -40,6 +40,14 @@ int32_t Engine::trackRecordInput(int32_t trackId) const {auto t = findTrackAuthoring(trackId);return t ? t->recordInputSource() : 0;}+void Engine::setTrackInputChannels(int32_t trackId, int32_t channels) {+ auto t = findTrackAuthoring(trackId);+ if (t && t->type() == TrackType::Audio) t->setInputChannels(channels);+}+int32_t Engine::trackInputChannels(int32_t trackId) const {+ auto t = findTrackAuthoring(trackId);+ return t ? t->inputChannels() : Track::kInputStereo;+}// --- live input monitoring ---------------------------------------------------void Engine::setTrackMonitor(int32_t trackId, bool on) {@@ -431,6 +439,7 @@ void Engine::drainInputQueue() {captureScratch_.push_back(f.l);captureScratch_.push_back(f.r);}+ Track::foldInputChannels(captureScratch_.data(), captureScratch_.size() / 2, captureChannels_);// Frames the audio thread had to drop while this drain was stalled (ring full).// They are the newest samples — the ones that couldn't fit after the popped batch —// so append an equal run of silence *after* the drained frames. That keeps the take's@@ -477,6 +486,7 @@ bool Engine::startAudioRecording(int32_t trackId) {// Internal resampling: capture another track / send / master output instead of the// hardware input. The audio thread feeds the ring from mixGraph; no device is opened.const int32_t src = t->recordInputSource();+ captureChannels_ = src == 0 ? t->inputChannels() : Track::kInputStereo; // a mono pick is hardware-onlyif (src != 0) {internalRecordSource_.store(src, std::memory_order_relaxed);audioRecordSampleRate_ = transport_.sampleRate();diff --git a/src/native/nota.engine/src/engine/Engine_Render.cpp b/src/native/nota.engine/src/engine/Engine_Render.cppindex 4714b9a8..613607ea 100644--- a/src/native/nota.engine/src/engine/Engine_Render.cpp+++ b/src/native/nota.engine/src/engine/Engine_Render.cpp@@ -1886,6 +1886,7 @@ void Engine::renderMonitorInput(Graph* g, const Track& t, float* dst, int32_t frconst int32_t src = t.recordInputSource();if (src == 0) {std::copy_n(monitorHwBuf_.data(), frames * 2, dst);+ Track::foldInputChannels(dst, static_cast<size_t>(frames), t.inputChannels()); // a mono pick (#340)return;}std::fill_n(dst, frames * 2, 0.0f);@@ -2166,39 +2167,55 @@ void Engine::mixGraph(Graph* g, float* out, int32_t frames, double blockStart, b// while it is muted.const bool keying = !audible && routeSlotForTrack(t.id()) >= 0;const bool postTapMuted = keying && leafMute(t);+ // Input monitoring (Monitor "In"): the track plays its record-input source live+ // in place of its clips — hardware input this segment, or the source track's+ // post-fader tap from the previous one. Master (-1) would feed back: silent.+ const bool monitoring = !frozenActive && !capturing && t.type() == TrackType::Audio && t.monitor();++ // 0) Session view (M5-2): apply quantized launch/stop; a playing slot+ // overrides this track's arrangement content. Requests apply on every track,+ // heard or not: a muted, solo-gated, monitoring or frozen track would otherwise+ // keep a launch queued forever (#343). Only the sound is skipped there — a+ // frozen or capturing track plays its buffer / arrangement, a monitoring one its+ // input. Serial: session clocks share followRng_ across tracks (deterministic+ // order = the old interleaved order).+ bool sessionActive = false;+ if (auto& sp = t.sessionPlayer) {+ // Follow actions + Repeat launch mode queue the next request before it applies.+ if (playing) sessionPreApply(t, frames / spb);+ if (sp->maybeApply(+ blockStart / spb, frames / spb, launchQuant_.load(std::memory_order_relaxed), seamOffs_)) {+ if (t.instrument) t.instrument->allNotesOff();+ for (auto& md : t.midiEffects)+ if (md) md->reset(); // clock switch → flush arp+ }+ sessionActive =+ !frozenActive && !capturing && !monitoring && sp->playing.load(std::memory_order_relaxed) >= 0;+ }if (!audible && !capturing && !feeding && !keying) {+ // Silent this block, but a playing slot keeps its place in the loop, so it is+ // in time again when the track is unmuted (and follow actions keep counting).+ if (sessionActive) {+ // The clip moves on without its note-offs reaching the instrument: release+ // what it holds, or a note crossed while silent would sound on after unmute.+ // Once, on going silent: a hosted plug-in queues each release until it renders.+ if (t.instrument && !t.sessionSilentReleased) t.instrument->allNotesOff();+ t.sessionSilentReleased = true;+ t.sessionPlayer->localBeats += frames / spb;+ sessionPostRender(t, frames / spb);+ }t.setMeter(0, 0, 0, 0);t.stereoFold(0, 0, 0, frames, stereoA);continue;}+ t.sessionSilentReleased = false;w.audible = audible;w.capturing = capturing;w.feeding = feeding;w.toMix = audible || capturing; // false: render only for the tapsw.postTapMuted = postTapMuted;- // Input monitoring (Monitor "In"): the track plays its record-input source live- // in place of its clips — hardware input this segment, or the source track's- // post-fader tap from the previous one. Master (-1) would feed back: silent.- w.monitoring = !frozenActive && !capturing && t.type() == TrackType::Audio && t.monitor();+ w.monitoring = monitoring;w.frozenActive = frozenActive;-- // 0) Session view (M5-2): apply quantized launch/stop; a playing slot- // overrides this track's arrangement content. (Skipped for a frozen or- // capturing track — the buffer/arrangement is the source of truth.)- // Serial: session clocks share followRng_ across tracks (deterministic- // order = the old interleaved order).- bool sessionActive = false;- if (!frozenActive && !capturing && !w.monitoring)- if (auto& sp = t.sessionPlayer) {- // Follow actions + Repeat launch mode queue the next request before it applies.- if (playing) sessionPreApply(t, frames / spb);- if (sp->maybeApply(blockStart / spb, frames / spb, launchQuant_.load(std::memory_order_relaxed))) {- if (t.instrument) t.instrument->allNotesOff();- for (auto& md : t.midiEffects)- if (md) md->reset(); // clock switch → flush arp- }- sessionActive = sp->playing.load(std::memory_order_relaxed) >= 0;- }w.sessionActive = sessionActive;// Render-path selection (same condition chain as the old inline loop).diff --git a/src/native/nota.engine/src/engine/Engine_Session.cpp b/src/native/nota.engine/src/engine/Engine_Session.cppindex 34f21744..8dc754df 100644--- a/src/native/nota.engine/src/engine/Engine_Session.cpp+++ b/src/native/nota.engine/src/engine/Engine_Session.cpp@@ -295,6 +295,13 @@ void Engine::recordSessionSlot(int32_t trackId, int32_t scene) {if (ok) {recordStartStatus_ = 0;recording_.store(true, std::memory_order_relaxed); // drives slot state = recording+ // A track plays one slot at a time: the take replaces whatever this track was+ // playing (or about to launch), from the moment capture starts (#337). Idle+ // players are left alone (a stray stop request would flush their MIDI state).+ if (auto& sp = t->sessionPlayer)+ if (sp->playing.load(std::memory_order_relaxed) >= 0 ||+ sp->pending.load(std::memory_order_relaxed) != SessionPlayer::kNone)+ sp->requestStopNow();if (countIn) {sessionCountIn_ = true;transportPlayCountIn();diff --git a/src/native/nota.engine/src/engine/Engine_Tracks.cpp b/src/native/nota.engine/src/engine/Engine_Tracks.cppindex f2441b46..9a464aa9 100644--- a/src/native/nota.engine/src/engine/Engine_Tracks.cpp+++ b/src/native/nota.engine/src/engine/Engine_Tracks.cpp@@ -959,7 +959,11 @@ int32_t Engine::instrumentScope(int32_t trackId, float* out, int32_t maxN) constint32_t Engine::addAudioTrack() {auto g = std::make_shared<Graph>(*authoring_);const int32_t id = nextTrackId_++;- g->tracks.push_back(std::make_shared<Track>(id, TrackType::Audio));+ auto t = std::make_shared<Track>(id, TrackType::Audio);+ // A new track records input 1 alone, as most microphones are mono (#340); stereo (1/2) is+ // one pick away. Older projects keep the stereo pair they were made with.+ t->setInputChannels(Track::kInputMono1);+ g->tracks.push_back(std::move(t));publish(g);return id;}@@ -3095,6 +3099,7 @@ std::shared_ptr<Track> Engine::deepCloneTrack(const Track& src, int32_t newId, bnt->setReturnIndex(src.returnIndex());nt->setGroupId(src.groupId()); // keep membership on duplicate (paste resets to top-level)nt->setRecordInputSource(src.recordInputSource());+ nt->setInputChannels(src.inputChannels());nt->setMonitor(src.monitor());nt->setMidiFromTrackId(src.midiFromTrackId());for (int b = 0; b < kMaxReturns; ++b) nt->setSend(b, src.send(b));diff --git a/src/native/nota.engine/src/engine/SessionPlayer.cpp b/src/native/nota.engine/src/engine/SessionPlayer.cppindex 83cb2e3c..c31daf89 100644--- a/src/native/nota.engine/src/engine/SessionPlayer.cpp+++ b/src/native/nota.engine/src/engine/SessionPlayer.cpp@@ -12,14 +12,14 @@ void SessionPlayer::requestLaunch(int32_t slot, double quant, bool legato, floatpending.store(slot, std::memory_order_relaxed);}-bool SessionPlayer::maybeApply(double blockStartBeats, double blockBeats, double globalQuant) {+bool SessionPlayer::maybeApply(double blockStartBeats, double blockBeats, double globalQuant, bool loopSeam) {const int32_t p = pending.load(std::memory_order_relaxed);if (p == kNone) return false;const double pq = pendingQuant.load(std::memory_order_relaxed);const double quant = (p == kStop || p == kStopNow || pq < 0.0) ? globalQuant : pq;bool boundary;- if (p == kStopNow || quant <= 0.0) {+ if (p == kStopNow || quant <= 0.0 || loopSeam) {boundary = true;} else {const double b1 = blockStartBeats + blockBeats;diff --git a/src/native/nota.engine/src/engine/SessionPlayer.h b/src/native/nota.engine/src/engine/SessionPlayer.hindex ed850fba..d0a19eb7 100644--- a/src/native/nota.engine/src/engine/SessionPlayer.h+++ b/src/native/nota.engine/src/engine/SessionPlayer.h@@ -48,9 +48,11 @@ class SessionPlayer {}// Audio thread: if a pending request exists and a quantize boundary falls in- // this block (or quant<=0), apply it. Returns true if `playing` changed- // (so the caller can flush hanging notes).- bool maybeApply(double blockStartBeats, double blockBeats, double globalQuant);+ // this block (or quant<=0), apply it. `loopSeam`: the block starts where the transport+ // loop just wrapped — that counts as a boundary too, or a loop that holds no multiple of+ // the quantum would keep a launch waiting forever (#343). Returns true if `playing`+ // changed (so the caller can flush hanging notes).+ bool maybeApply(double blockStartBeats, double blockBeats, double globalQuant, bool loopSeam = false);// Audio thread, after rendering a block: advance the played counter and publish the// loop position for the UI.diff --git a/src/native/nota.engine/src/engine/Track.h b/src/native/nota.engine/src/engine/Track.hindex 0afda1dc..3784fc34 100644--- a/src/native/nota.engine/src/engine/Track.h+++ b/src/native/nota.engine/src/engine/Track.h@@ -180,6 +180,10 @@ class Track {float midiNoteNorm() const { return midiNote_.load(std::memory_order_relaxed); }bool midiGate() const { return midiHeld_.load(std::memory_order_relaxed) > 0; }+ // A silent Session track released its instrument's notes on going silent (#343), so it+ // isn't sent again every block. Audio thread only.+ bool sessionSilentReleased = false;+// Metering (M6-2): post-fader block peak/RMS per channel. Written by the// audio thread each block, read by the UI. Transient — not copied across// snapshots (a freshly cloned track just re-populates on the next block).@@ -225,6 +229,23 @@ class Track {int32_t recordInputSource() const { return recordInputSource_.load(std::memory_order_relaxed); }void setRecordInputSource(int32_t s) { recordInputSource_.store(s, std::memory_order_relaxed); }+ // Which channels of the hardware input an audio track takes (#340): 0 = both, as a+ // stereo pair (1/2); 1 = input 1 alone, 2 = input 2 alone — a mono source, heard and+ // recorded in the middle of both sides. Only the hardware input: an internal source is+ // always stereo. Atomic (the audio thread reads it while monitoring).+ static constexpr int32_t kInputStereo = 0, kInputMono1 = 1, kInputMono2 = 2;+ int32_t inputChannels() const { return inputChannels_.load(std::memory_order_relaxed); }+ void setInputChannels(int32_t c) {+ inputChannels_.store(c == kInputMono1 || c == kInputMono2 ? c : kInputStereo, std::memory_order_relaxed);+ }+ // A mono pick: copy the chosen channel to both sides of interleaved stereo frames.+ static void foldInputChannels(float* lr, size_t frames, int32_t channels) {+ if (channels == kInputMono1)+ for (size_t i = 0; i < frames; ++i) lr[i * 2 + 1] = lr[i * 2];+ else if (channels == kInputMono2)+ for (size_t i = 0; i < frames; ++i) lr[i * 2] = lr[i * 2 + 1];+ }+// Input monitoring (audio tracks, Ableton's Monitor "In"): while on, the track plays its// record-input source live — hardware input, or another track's / return's post-fader// output — through its own devices + fader instead of its clips, transport rolling or not.@@ -317,6 +338,7 @@ class Track {int32_t returnIndex_ = -1; // >=0 for return tracksint32_t groupId_ = -1; // parent Group track id, or -1 (top-level)std::atomic<int32_t> recordInputSource_{0}; // 0 hardware, -1 master, >0 source track id+ std::atomic<int32_t> inputChannels_{kInputStereo}; // hardware input channels (#340)std::atomic<bool> monitor_{false}; // live input monitoring (audio tracks)std::atomic<int32_t> midiFromTrackId_{-1}; // -1 off, >0 forward MIDI to this track idstd::atomic<bool> frozen_{false}; // M7: play frozenBuf instead of the live chaindiff --git a/tests/Nota.SmokeTest/BrowserCategoryTests.cs b/tests/Nota.SmokeTest/BrowserCategoryTests.csindex d2bb95df..ff92da48 100644--- a/tests/Nota.SmokeTest/BrowserCategoryTests.cs+++ b/tests/Nota.SmokeTest/BrowserCategoryTests.cs@@ -118,6 +118,17 @@ internal static class BrowserCategoryTests&& pvm.CategoryFilter(0) == "Synths","a rescan that empties the picked category clears the pick; other picks stay");+ // The search box is shared by the tabs (#342): a search typed on Audio effects and+ // cleared on Instruments must not leave Audio effects filtered when it is shown again.+ var svm = new BrowserViewModel(new EmptyPluginCatalog(), new EmptyPresetLibrary(), new FactoryPresetCatalog());+ int allFx = Devices(svm.Effects).Count;+ svm.FilterTree(1, "zzz"); // typed on the Audio effects tab+ svm.ShowTab(0, "zzz"); // switch to Instruments; the box still reads "zzz"+ svm.FilterTree(0, ""); // cleared there+ svm.ShowTab(1, ""); // back to Audio effects, box empty+ yield return (Devices(svm.Effects).Count == allFx && allFx > 0,+ $"a search cleared on another tab doesn't leave Audio effects empty ({Devices(svm.Effects).Count}/{allFx})");+// An existing settings file has no key: the chips are on (FR-003).var old = JsonSerializer.Deserialize<Settings>("{}")!;yield return (old.BrowserCategoryChips, "settings without the new key show the category chips");diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 0f05ded6..95f2e6bc 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -551,6 +551,14 @@ if (args.Length >= 1 && args[0] == "--vocoder")Console.WriteLine(failures == 0 ? "VOCODER PASSED" : $"VOCODER FAILED ({failures})");return failures == 0 ? 0 : 1;}+// Session launches + recording input alone (fast iteration): `--session-input`. Also part of the full run.+if (args.Length >= 1 && args[0] == "--session-input")+{+ Console.WriteLine("-- session launch + record input --");+ foreach (var (ok, label) in SessionInputTests.Run()) Check(ok, label);+ Console.WriteLine(failures == 0 ? "SESSION INPUT PASSED" : $"SESSION INPUT FAILED ({failures})");+ return failures == 0 ? 0 : 1;+}// Live MIDI recording alone (fast iteration): `--live-record`. Also part of the full run.if (args.Length >= 1 && args[0] == "--live-record"){@@ -8386,7 +8394,8 @@ engine.StopTransport();e.SetTrackMute(sesT3, false);e.BackToArrangement();Check(e.ArrangementActive, "back to arrangement re-activates the timeline");- Check(e.SessionSlotState(sesT3, 0) != 3, "back to arrangement stopped the session clip");+ e.RenderOffline(buf, 64); // the stop lands on the next block (the muted clip did launch, #343)+ Check(e.SessionSlotState(sesT3, 0) == 1, "back to arrangement stopped the session clip");e.Seek(0); e.RenderOffline(buf, frames);Check(Rms(buf, frames) > 0.001f, $"arrangement plays after back to arrangement (rms={Rms(buf, frames):F4})");e.StopTransport();@@ -15084,6 +15093,8 @@ Console.WriteLine("-- loop seam --");foreach (var (ok, label) in LoopSeamTests.Run()) Check(ok, label);Console.WriteLine("-- loop record mode --");foreach (var (ok, label) in LoopRecordModeTests.Run()) Check(ok, label);+Console.WriteLine("-- session launch + record input --");+foreach (var (ok, label) in SessionInputTests.Run()) Check(ok, label);Console.WriteLine("-- tempo follow --");foreach (var (ok, label) in TempoFollowTests.Run()) Check(ok, label);Console.WriteLine("-- nota keys --");diff --git a/tests/Nota.SmokeTest/SessionInputTests.cs b/tests/Nota.SmokeTest/SessionInputTests.csnew file mode 100644index 00000000..6c5523a8--- /dev/null+++ b/tests/Nota.SmokeTest/SessionInputTests.cs@@ -0,0 +1,246 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Session launches and recording input (milestone 0.58.1): a clip launched on a muted,+// solo-gated or looped track starts on time instead of waiting forever (#343), an audio take+// in a Session slot replaces the clip its track was playing (#337), and an audio track can+// take one channel of a stereo input as a mono source in the middle (#340), and a plain click+// on an arm button arms that track alone, ⌘-click more than one, and selecting an instrument+// track arms it (#332).++using Nota.Application;+using Nota.Infrastructure;+using Nota.Presentation;++namespace Nota.SmokeTest;++internal static class SessionInputTests+{+ private const double Sr = 48000.0;+ private const double Spb = Sr * 60.0 / 120.0; // frames per beat at 120 BPM+ private const int Chunk = 256;++ public static IEnumerable<(bool, string)> Run()+ {+ foreach (var r in LaunchWhileSilent()) yield return r;+ foreach (var r in LaunchInsideShortLoop()) yield return r;+ foreach (var r in AudioTakeReplacesPlayingSlot()) yield return r;+ foreach (var r in MonoInput()) yield return r;+ foreach (var r in ExclusiveArm()) yield return r;+ }++ private static void Beats(NotaEngine e, double beats, float[]? keep = null)+ {+ var b = keep ?? new float[Chunk * 2];+ int frames = (int)Math.Round(beats * Spb);+ for (int done = 0; done < frames; done += Chunk) e.RenderOffline(b, Chunk, Sr);+ }++ private static float Peak(NotaEngine e, double beats)+ {+ var b = new float[Chunk * 2];+ float peak = 0;+ int frames = (int)Math.Round(beats * Spb);+ for (int done = 0; done < frames; done += Chunk)+ {+ e.RenderOffline(b, Chunk, Sr);+ foreach (var x in b) peak = Math.Max(peak, Math.Abs(x));+ }+ return peak;+ }++ // A rolling engine (1-bar launch quantum) with one instrument track holding a 4-beat clip.+ private static NotaEngine Rolling(out int track)+ {+ var e = new NotaEngine();+ e.SetBpm(120);+ e.SetMetronome(false);+ e.SetCountIn(0);+ e.SetLaunchQuant(4.0);+ track = e.AddInstrumentTrack();+ e.AddSessionMidiClip(track, 0, 4.0);+ e.SetSessionNotes(track, 0, new[] { new NotaNote(60, 0.0, 1.0, 0.9f) });+ e.Seek(0.0);+ e.Play();+ Beats(e, 1.0); // past the start, so a launch waits for the next bar line+ return e;+ }++ // #343: the launch used to apply only on tracks that rendered this block, so a muted track+ // (or one gated by another track's solo) kept it queued forever.+ private static IEnumerable<(bool, string)> LaunchWhileSilent()+ {+ using (var e = Rolling(out int t))+ {+ e.SetTrackMute(t, true);+ e.LaunchSlot(t, 0);+ Beats(e, 3.5); // over the bar line at beat 4+ yield return (e.SessionSlotState(t, 0) == 3, $"a muted track's launch starts on the bar (state {e.SessionSlotState(t, 0)})");+ Beats(e, 2.0);+ double pos = e.SessionSlotPosition(t);+ yield return (Math.Abs(pos - 2.5) < 0.1, $"…and its clip keeps time while muted (at {pos:F2} of 4 beats, want 2.5)");+ }+ using (var e = Rolling(out int t))+ {+ // The clip's note (beats 0–1) ends while the track is muted: it mustn't sound on+ // once the track is heard again.+ e.LaunchSlot(t, 0);+ Beats(e, 3.5); // launched at beat 4, now half a beat into the note+ float sounding = Peak(e, 0.25);+ e.SetTrackMute(t, true);+ Beats(e, 1.5); // past the note's end+ e.SetTrackMute(t, false);+ Beats(e, 0.5); // the release tail+ float after = Peak(e, 0.5);+ yield return (sounding > 0.01f && after < sounding * 0.05f,+ $"a note that ends while muted doesn't sound on after unmute (peak {after:F4} vs {sounding:F4} playing)");+ }+ using (var e = Rolling(out int t))+ {+ int other = e.AddInstrumentTrack();+ e.SetTrackSolo(other, true);+ e.LaunchSlot(t, 0);+ Beats(e, 3.5);+ yield return (e.SessionSlotState(t, 0) == 3, $"a launch starts while another track is soloed (state {e.SessionSlotState(t, 0)})");+ e.StopSlot(t);+ Beats(e, 4.0);+ yield return (e.SessionSlotState(t, 0) == 1, $"…and so does its stop (state {e.SessionSlotState(t, 0)})");+ }+ }++ // #343: a transport loop holding no bar line (here beats 4.5–7.5 with a 1-bar quantum)+ // never reached a launch point; the loop's wrap now counts as one.+ private static IEnumerable<(bool, string)> LaunchInsideShortLoop()+ {+ using var e = Rolling(out int t);+ e.SetLoop(true, 4.5, 7.5);+ e.Seek(4.5);+ Beats(e, 0.5);+ e.LaunchSlot(t, 0);+ Beats(e, 3.0); // one wrap+ yield return (e.SessionSlotState(t, 0) == 3, $"a launch inside a loop without a bar line starts at the wrap (state {e.SessionSlotState(t, 0)})");+ }++ // #337: an audio take into an empty slot left the track's playing clip running until the+ // take stopped. A track plays one slot at a time.+ private static IEnumerable<(bool, string)> AudioTakeReplacesPlayingSlot()+ {+ string wav = Path.Combine(Path.GetTempPath(), "nota_smoke_session_take.wav");+ WavWriter.WriteSine(wav, 2.0, 220.0, 48000);+ using var e = new NotaEngine();+ e.SetBpm(120);+ e.SetMetronome(false);+ e.SetCountIn(0);+ e.SetLaunchQuant(0.0);+ int src = e.AddInstrumentTrack(); // an internal source: no capture device needed+ int aud = e.AddAudioTrack();+ e.SetTrackRecordInput(aud, src);+ e.SetTrackArmed(aud, true);+ yield return (e.AddSessionAudioFile(aud, 0, wav), "audio slot filled");+ e.LaunchSlot(aud, 0);+ Beats(e, 1.0);+ yield return (e.SessionSlotState(aud, 0) == 3, "the audio clip plays");+ e.RecordSessionSlot(aud, 1);+ Beats(e, 0.25);+ yield return (e.SessionSlotState(aud, 1) == 4, $"the next slot records (state {e.SessionSlotState(aud, 1)})");+ yield return (e.SessionSlotState(aud, 0) == 1, $"…and the playing clip stopped when the take began (state {e.SessionSlotState(aud, 0)})");+ e.StopSessionRecord();+ e.StopTransport();+ File.Delete(wav);+ }++ // #340: a mic on input 1 of a stereo device was recorded and heard on the left only.+ private static IEnumerable<(bool, string)> MonoInput()+ {+ using (var e = new NotaEngine())+ {+ int mon = e.AddAudioTrack();+ yield return (e.GetTrackInputChannels(mon) == InputChannels.Mono1, "a new audio track takes input 1 (mono)");+ var leftOnly = new float[8192 * 2];+ for (int i = 0; i < 8192; i++) leftOnly[i * 2] = 0.5f * MathF.Sin(2f * MathF.PI * 440f * i / 48000f);+ e.PushMonitorFramesForTest(leftOnly, 8192); // test hook: no capture device is opened+ e.SetTrackRecordInput(mon, 0);+ e.SetTrackMonitor(mon, true);+ var buf = new float[2048 * 2];+ (double L, double R) Heard()+ {+ e.PushMonitorFramesForTest(leftOnly, 8192);+ e.RenderOffline(buf, 2048, Sr); // the ring keeps only a short cushion: measure this block+ double l = 0, r = 0;+ for (int i = 0; i < 2048; i++) { l += buf[i * 2] * (double)buf[i * 2]; r += buf[i * 2 + 1] * (double)buf[i * 2 + 1]; }+ return (Math.Sqrt(l / 2048), Math.Sqrt(r / 2048));+ }+ var mono = Heard();+ yield return (mono.R > 0.1 && Math.Abs(mono.L - mono.R) < 0.02 * mono.L,+ $"input 1 is heard on both sides (L {mono.L:F3}, R {mono.R:F3})");+ e.SetTrackInputChannels(mon, InputChannels.Stereo);+ var pair = Heard();+ yield return (pair.L > 0.1 && pair.R < 1e-4, $"the stereo pair keeps the sides apart (L {pair.L:F3}, R {pair.R:F5})");+ e.SetTrackInputChannels(mon, InputChannels.Mono2);+ var two = Heard();+ yield return (two.L < 1e-4 && two.R < 1e-4, $"input 2 alone hears the silent right input (L {two.L:F5}, R {two.R:F5})");+ }++ // Saved with the project; a project from before the setting keeps the stereo pair.+ using var src = new NotaEngine();+ int a = src.AddAudioTrack();+ src.SetTrackInputChannels(a, InputChannels.Mono2);+ var doc = ProjectService.Capture(src, new TransportState(120.0, 1.0, false, false), new List<string>());+ string dir = Path.Combine(Path.GetTempPath(), "nota-smoke-input-" + Guid.NewGuid().ToString("N"));+ Directory.CreateDirectory(dir);+ try+ {+ using (var dst = new NotaEngine())+ {+ ProjectService.Apply(doc, dst, dir);+ int id = FirstAudio(dst);+ yield return (dst.GetTrackInputChannels(id) == InputChannels.Mono2, $"input 2 survives save and load ({dst.GetTrackInputChannels(id)})");+ }+ foreach (var t in doc.Tracks) t.InputChannels = null; // as written before 0.58+ using (var old = new NotaEngine())+ {+ ProjectService.Apply(doc, old, dir);+ int id = FirstAudio(old);+ yield return (old.GetTrackInputChannels(id) == InputChannels.Stereo, $"an older project keeps the stereo pair ({old.GetTrackInputChannels(id)})");+ }+ }+ finally { Directory.Delete(dir, true); }+ }++ // #332: a plain arm click picks the one track the keyboard plays; ⌘-click adds tracks.+ private static IEnumerable<(bool, string)> ExclusiveArm()+ {+ using var e = new NotaEngine();+ int keys = e.AddInstrumentTrack(), drums = e.AddInstrumentTrack(), aud = e.AddAudioTrack();+ bool Armed(int id) { for (int i = 0; i < e.TrackCount; i++) if (e.TryGetTrackInfo(i, out var t) && t.Id == id) return t.Armed != 0; return false; }+ TrackArm.Set(e, keys, true, additive: false);+ bool changed = TrackArm.Set(e, drums, true, additive: false);+ yield return (changed && Armed(drums) && !Armed(keys), "a plain arm click arms that track alone");+ TrackArm.Set(e, aud, true, additive: true);+ yield return (Armed(drums) && Armed(aud), "⌘-click arms another track and keeps the first");+ TrackArm.Set(e, aud, false, additive: false);+ yield return (Armed(drums) && !Armed(aud), "disarming leaves the other tracks armed");++ // Arm-on-select: the selection moves the one arm to the instrument track you're on…+ TrackArm.Set(e, drums, false, additive: false);+ yield return (TrackArm.FollowSelection(e, keys) && Armed(keys), "selecting an instrument track arms it");+ yield return (TrackArm.FollowSelection(e, drums) && Armed(drums) && !Armed(keys), "…and selecting another moves the arm to it");+ // …but leaves alone an audio track, and a set armed by hand.+ yield return (!TrackArm.FollowSelection(e, aud) && !Armed(aud) && Armed(drums), "selecting an audio track doesn't arm it");+ TrackArm.Set(e, keys, true, additive: true);+ yield return (!TrackArm.FollowSelection(e, drums) && Armed(keys) && Armed(drums), "two armed tracks stay armed when the selection moves");+ int synth = e.AddInstrumentTrack();+ yield return (!TrackArm.FollowSelection(e, synth) && !Armed(synth), "…and a new track doesn't take the arm from them");+ TrackArm.Set(e, keys, false, additive: false);+ TrackArm.Set(e, drums, false, additive: false);+ TrackArm.Set(e, aud, true, additive: false);+ yield return (!TrackArm.FollowSelection(e, synth) && Armed(aud), "an armed audio track keeps its arm");+ }++ private static int FirstAudio(NotaEngine e)+ {+ for (int i = 0; i < e.TrackCount; i++)+ if (e.TryGetTrackInfo(i, out var t) && !t.IsInstrument && !t.IsReturn && !t.IsGroup) return t.Id;+ return -1;+ }+}