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
(feat) Select first automation in list when run automation mode
Egor Khindikaynenaff6652672e7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9b4c4e4c..d997c161 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,10 @@ created, and the build-and-publish run starts.Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.+### Changed+- The first time you switch to automation mode, each track that already has automation+ shows its first automated parameter instead of Volume.+### Fixed- Reordering or removing effects in Devices no longer scrambles their automation: each lanestays on its own device and parameter. Removing a device also removes its automation.diff --git a/src/managed/Nota.App/ArrangementView.Automation.cs b/src/managed/Nota.App/ArrangementView.Automation.csindex 7166702b..fc0891c6 100644--- a/src/managed/Nota.App/ArrangementView.Automation.cs+++ b/src/managed/Nota.App/ArrangementView.Automation.cs@@ -133,6 +133,29 @@ public sealed partial class ArrangementViewRedraw();}+ /// <summary>The first lane on a track that carries points — the top entry of the target+ /// menu's quick-access section — or null when the track has no automation yet.</summary>+ private static (AutomationTarget target, int dev, int param, string paramId)? FirstAutomatedTarget(IAudioEngine e, int trackId)+ {+ int n = e.AutomationLaneCount(trackId);+ for (int i = 0; i < n; i++)+ {+ var info = e.AutomationLaneInfo(trackId, i);+ if (info.PointCount <= 0) continue;+ return info.Target switch+ {+ AutomationTarget.Volume or AutomationTarget.Pan => (info.Target, -1, -1, ""),+ AutomationTarget.PluginParam => (info.Target, info.DeviceIndex, -1, e.AutomationLaneParamId(trackId, i)),+ _ => (info.Target, info.DeviceIndex, info.ParamIndex, ""),+ };+ }+ return null;+ }++ /// <summary>Forget every track's chosen lane target (a project was opened / created), so+ /// the next automation-mode visit picks each track's first automated param again.</summary>+ public void ForgetAutoTargets() => _autoTargets.Clear();+/// <summary>The device chain reordered / removed effects (midi=false) or MIDI effects on a/// track: keep its shown automation target on the same device (the engine moves the lanes/// the same way). map: old chain index → new, -1 when the device is gone (→ Volume).</summary>diff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.csindex b7ad7dcd..8ab0ce93 100644--- a/src/managed/Nota.App/ArrangementView.cs+++ b/src/managed/Nota.App/ArrangementView.cs@@ -674,7 +674,10 @@ public sealed partial class ArrangementView : UserControl};if (_automationMode){- if (_autoTargets.TryGetValue(ti.Id, out var sel))+ // First visit to this track's lane: show its first automated param, not Volume.+ if (!_autoTargets.TryGetValue(ti.Id, out var sel) && FirstAutomatedTarget(eng, ti.Id) is { } first)+ _autoTargets[ti.Id] = sel = first;+ if (_autoTargets.ContainsKey(ti.Id))(tvm.AutoTarget, tvm.AutoDeviceIndex, tvm.AutoParamIndex, tvm.AutoParamId) = sel;tvm.AutoLabel = AutoLabelFor(tvm);LoadAutoPoints(tvm);diff --git a/src/managed/Nota.App/MainWindow.Files.cs b/src/managed/Nota.App/MainWindow.Files.csindex 70171de6..be9c6347 100644--- a/src/managed/Nota.App/MainWindow.Files.cs+++ b/src/managed/Nota.App/MainWindow.Files.cs@@ -363,6 +363,7 @@ public partial class MainWindow{_importEpoch++; // imports still running belong to the old graphTimeline.ClearPendingImports();+ Timeline.ForgetAutoTargets(); // lane targets are per-project track/device indices_editorRoll = null;_clipEditor = null;_editorTrackId = -1;