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.

(feat) Show arrangement send knobs only at Large height (#143) (#472)

Chris Laupama0cf5e591c4b5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7002d213..480d3489 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -73,16 +73,11 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
controller or Nota Remote first. The lane still widens by itself when a bend on the notes
needs more than the range picked (a step that would clip one is disabled in the menu), and
each clip keeps its pick for the session, like its scroll and zoom.
-- **Send levels in the Arrangement's track headers** (#143): a track row tall enough for
- them — a large row, or a standard one from 88 px — shows a small knob per return track
- (A, B, …) under volume and pan, with the level beside it; hover names the return,
- double-click turns the send off and ⌥-click types a value. A **Sends** key at the top of
- the header column hides or shows them on every track (saved with the project).
-- **Sends are undoable and automatable**: a send change made anywhere — the track header,
- the Mixer, the Session mixer, the Sends card or the MCP `set_send` tool — is one undo step.
- The automation lane's target menu lists **Send A · Reverb**-style entries after Pan; draw a
- send's envelope, or record it by moving a send control with automation record on, as with
- volume. Deleting a return removes the send automation to it, and later returns keep theirs.
+- **Send levels in the Arrangement's track headers** (#143): a track at the Large height
+ (128 px) or taller shows a small knob per return track (A, B, …) under volume and pan,
+ with the level beside it; hover names the return, double-click turns the send off and
+ ⌥-click types a value. Shorter rows leave the sends in the Mixer. A send move is not an
+ undo step, and a send is not an automation target.
- **Delete several versions at once** (#228): in the History tab, ⌘-click (Ctrl-click on
Windows and Linux) adds a version to the selection and Shift-click selects a run. With
more than one selected, the footer shows how many and when they were saved, and its
diff --git a/FEATURES.md b/FEATURES.md
index aeeb1f7a..9c4991c7 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -49,11 +49,11 @@ on a pool of render threads, export and freeze use every core, and an idle engin
## Project and transport
- **Project**: create / open / save (`.nota`), autosaves, undo/redo for every editing
- operation — including volume, pan, send and master-volume moves and the parameters of effects,
+ operation — including volume, pan and master-volume moves and the parameters of effects,
MIDI effects, instruments and plug-ins, from any source (device cards, Mixer, track
headers, Session mixer, **MST**, Nota Remote, a MIDI controller, MCP), one step per move,
and every arrangement section edit; a recorded automation pass undoes with its value.
- Mute, solo and devices inside racks are not in the history; automation playback,
+ Mute, solo, sends and devices inside racks are not in the history; automation playback,
opening a project and freezing add no steps.
- **New project template**: a new project (and the workspace Nota opens with) starts with an
instrument track (Nota Volt), an audio track and two returns — **Reverb** (Nota Reverb)
@@ -167,10 +167,11 @@ docks as a panel under any of the three, or floats in its own window — see
fit their height: one line (name, M / S / arm) when short, input, fader and pan on rows
of their own when tall. Drag the seam between headers and lanes to set the header
width (160–480 px). Both are saved with the project.
- - **Sends in the track headers** — a large row, or a standard one from 88 px, shows one
+ - **Sends in the track headers** — a track at the Large height (128 px) or taller shows one
small knob per return (A–D) under volume and pan with its level; hover names the
- return, double-click turns the send off, ⌥-click types a value. The **Sends** key at
- the top of the header column shows or hides them on every track (saved with the project).
+ return, double-click turns the send off, ⌥-click types a value. The level is the same
+ one the Mixer and the Sends card show, and it is not an undo step. A shorter row has no
+ knobs.
- **Track headers left or right** — View ▸ Track headers on the right (or Settings →
Appearance → Track headers) moves the header column, the return / master headers and
the header strips to the right edge, so the timeline starts at the left; remembered
@@ -641,8 +642,7 @@ docks as a panel under any of the three, or floats in its own window — see
## Automation
- **Automation lanes** on tracks and returns, with curved segments (Alt+drag) and points
- (double-click to add, double-click a point to remove). A track lane drives Volume, Pan, a
- send (**Send A · Reverb** … one per return; deleting a return drops its send lanes) or a
+ (double-click to add, double-click a point to remove). A track lane drives Volume, Pan or a
device parameter. A return's lane (Volume, Pan or a
device on its chain) is edited in its footer row, the master's volume in the Master row.
- **Automation mode** (⌘⇧A): the first time it opens, each track that already has automation
@@ -1481,8 +1481,8 @@ Coverage:
device (a Nota Chamber impulse response) and read its resource text (IR names).
- **MIDI clips and notes**: piano roll — add a clip, read/write/append/clear notes, move
and split; read and write a clip's controller curves (sustain, wheels, any CC).
-- **Automation**: create a lane (volume, pan, a send, a device or instrument parameter),
- read and write points.
+- **Automation**: create a lane (volume, pan, a device or instrument parameter),
+ read and write points. A send is not a lane target.
- **MIDI effects** and engine status.
- **Session**: the clip launcher (grid snapshot with clip and scene properties, create, copy,
move and clear slots, read and write slot notes, loop length, clip name / colour / launch
diff --git a/specs/069-arrangement-header-sends/plan.md b/specs/069-arrangement-header-sends/plan.md
new file mode 100644
index 00000000..e5d43d6b
--- /dev/null
+++ b/specs/069-arrangement-header-sends/plan.md
@@ -0,0 +1,68 @@
+# Implementation Plan: Arrangement header sends, Large only
+
+**Branch**: `cursor/arrangement-header-sends-2734` | **Date**: 2026-11-04 | **Spec**: [spec.md](spec.md)
+
+## Summary
+
+Keep the header send knobs from specs/072. Show them only when the row is at least the Large preset (128 px). Remove the **Sends** key and its saved flag. Stop recording send moves as undo steps, and stop send lanes from being created or played.
+
+## Technical Context
+
+**Language/Version**: C# / .NET 10 and C++20. The C++ change rejects a mix kind and an automation target that specs/072 added. No new ABI entry.
+
+**Primary Dependencies**: None added.
+
+**Storage**: Send levels are unchanged. The track-view sidecar no longer writes `showSends`. A saved `showSends: false` is ignored, so Large rows show their knobs.
+
+**Audio-Thread Impact**: None added. `applyAutomation` no longer calls `setSend` for a send lane, so playback does not write that atomic from an envelope. The live send level is still the atomic the audio thread already reads. No allocation, lock, I/O or logging on the audio thread. No new graph snapshot on the audio thread. No JUCE. Transport is untouched.
+
+**Testing**: `scripts/build-linux.sh`. `tests/Nota.SmokeTest/SendAutomationTests.cs` is rewritten to fail if a send move becomes an undo step or a send lane is created.
+
+**Target Platform**: Built and tested on Linux. macOS and Windows are CI.
+
+**Project Type**: Desktop app.
+
+**Performance Goals**: Header rebuild is unchanged. One less control in the zoom strip.
+
+**Constraints**: Do not renumber `AutomationTarget` or `MixKind`. Send stays value 5 and TrackSend stays 8 so a stored lane does not land on another target. Both are rejected.
+
+**Scale/Scope**: Header visibility, the send-control wiring, the lane menu, MCP `set_send` and `add_automation_lane`, and the engine apply paths.
+
+## Constitution Check
+
+- **I. Real-time**: Pass. The audio thread does not gain work. One existing write from a send lane is removed.
+- **II. Boundary**: Pass. No new C ABI. `nota_engine.h` says the send mix kind is ignored.
+- **III. Licensing**: Pass. No new file, no new dependency.
+- **IV. Verification**: Pass. Smoke test covers the engine half (not an undo step, lane rejected).
+- **V. One change**: Pass. #143 as the maintainer decided it.
+- **VI. Docs**: CHANGELOG, FEATURES, arrangement page EN + RU.
+- **VII. Spec-first**: this directory.
+- **VIII. Safety**: Pass. Nothing weakened.
+
+Post-design: the same.
+
+## Project Structure
+
+```text
+specs/069-arrangement-header-sends/
+src/managed/Nota.App/ArrangementView.Sends.cs
+src/managed/Nota.App/ArrangementView.cs
+src/managed/Nota.App/ArrangementView.Sizing.cs
+src/managed/Nota.App/ArrangementView.Automation.cs
+src/managed/Nota.App/SendControl.cs
+src/managed/Nota.Mcp/Tools/TrackTools.cs
+src/managed/Nota.Mcp/Tools/AutomationTools.cs
+src/native/nota.engine/src/engine/Engine.cpp
+src/native/nota.engine/src/engine/Engine_Automation.cpp
+src/native/nota.engine/src/engine/Automation.h
+src/native/nota.engine/include/nota/nota_engine.h
+tests/Nota.SmokeTest/SendAutomationTests.cs
+```
+
+## Design
+
+`ShowSendsOn` is true only for a non-return card whose height is at least `LargeRowHeight`, when the project has returns. The live relayout already rebuilds a card when `ShowSendsOn` flips, including on drag-release.
+
+`SendControl` writes `SetTrackSend` and nothing else. Mixer, Session and the Sends card already use it, so they stop opening a mix gesture and an automation write.
+
+`mixValue` returns false for `MixKind::TrackSend`, so a gesture that names it records no step. `applyAutomation` skips `AutomationTarget::Send`. `addAutomationLane` returns -1 for it. The lane menu no longer lists sends. MCP `set_send` calls `SetTrackSend` directly. MCP `add_automation_lane` with `"send"` returns -1.
diff --git a/specs/069-arrangement-header-sends/spec.md b/specs/069-arrangement-header-sends/spec.md
new file mode 100644
index 00000000..2efde527
--- /dev/null
+++ b/specs/069-arrangement-header-sends/spec.md
@@ -0,0 +1,108 @@
+# Feature Specification: Arrangement header sends, Large only
+
+**Feature Branch**: `cursor/arrangement-header-sends-2734`
+
+**Created**: 2026-11-04
+
+**Status**: Draft
+
+**Input**: User description: "Issue #143, maintainer decision A. Send controls in the arrangement track headers only. Do not make sends undoable or automatable. Show them only at Large track height."
+
+## Nota Context
+
+**Feature area**:
+
+- [x] Engine (C++, `src/native/nota.engine`) — real-time audio rules apply, see `ARCHITECTURE.md` AR table
+- [x] Managed app (C#, `src/managed/*`) — domain, application, infrastructure, presentation
+- [x] UI (Avalonia, `src/managed/Nota.App`) — follow `DESIGN.md` (Studio)
+- [ ] Plugin hosting (`pluginhost/`)
+- [ ] Build / packaging / CI
+- [ ] Docs only
+
+**Nota docs**: [`ARCHITECTURE.md`](../../ARCHITECTURE.md), [`CONTRIBUTING.md`](../../CONTRIBUTING.md),
+[`DESIGN.md`](../../DESIGN.md), [`FEATURES.md`](../../FEATURES.md).
+
+This narrows what already shipped on `develop` in specs/072 (#441). That change showed send
+knobs from 88 px and on every large row, added a **Sends** key, and made every send undoable
+and automatable. The maintainer chose the smaller reading of #143 instead.
+
+## User Scenarios & Testing
+
+### User Story 1 - Set a send from a Large header (Priority: P1)
+
+A person working on the timeline sets how much of a track goes to a return without leaving
+the Arrangement, once the track is at the Large height.
+
+**Independent Test**: Make a track Large. Drag its send knob. The Mixer and the Sends card
+show the same level. Set the track back to Standard. The knobs are gone and the level stays.
+
+**Acceptance Scenarios**:
+
+1. **Given** a project with returns and a track at the Large height (128 px) or taller, **When** the person looks at its header, **Then** they see one send knob per return, in bus order, with the level beside it when the header is wide enough, and the return's name on hover.
+2. **Given** that knob, **When** they drag it, type a percent, or double-click it, **Then** the send moves, takes the typed level, or turns off, and the audio follows.
+3. **Given** a track shorter than the Large height, **When** its header is shown, **Then** it has no send knobs.
+4. **Given** no return tracks, **When** a track is Large, **Then** its header has no send row.
+5. **Given** a return row, the master row, or a collapsed group bar, **When** it is shown, **Then** it has no send knobs. A selected group at Large height does.
+
+### User Story 2 - The same level everywhere (Priority: P2)
+
+The header, Mixer, Session mixer and Sends card stay on one level.
+
+**Acceptance Scenarios**:
+
+1. **Given** a Large header, **When** the same send is moved in the Mixer, the Session mixer or the Sends card, **Then** the header knob follows unless it is being dragged.
+2. **Given** a send moved in the header, **When** the person looks at the Mixer or the Sends card, **Then** it shows the new level.
+
+### User Story 3 - Sends stay out of undo and automation (Priority: P1)
+
+A send move is immediate and is not a history step, and there is no send envelope.
+
+**Independent Test**: Move a send, then undo. The send stays. The lane target menu has Volume and Pan, and no Send entry. `set_send` does not add an undo step.
+
+**Acceptance Scenarios**:
+
+1. **Given** a send moved from the header, the Mixer, the Session mixer, the Sends card or MCP `set_send`, **When** the person undoes, **Then** the send does not step back. Volume and pan still do.
+2. **Given** the automation target menu, **When** it opens on a track, **Then** it does not offer a send. A request to add a send lane does not create one, and a send lane does not move the level.
+
+### Edge Cases
+
+- The header column has no **Sends** key. A project that saved that key hidden still shows the knobs on Large rows.
+- At most four returns. Narrow headers show the knobs without the letter and level.
+- Adding or removing a return updates the knobs on the next refresh.
+
+## Requirements
+
+- **FR-001**: A track header at the Large height preset or taller MUST show one send knob per return.
+- **FR-002**: A shorter header MUST NOT show send knobs. There is no control that hides the Large-row knobs.
+- **FR-003**: Each knob MUST set that track's send, from off to full, heard immediately. Double-click turns it off. Option-click types a percent.
+- **FR-004**: Knobs MUST follow a send changed in the Mixer, Session mixer or Sends card, and MUST NOT jump while dragged.
+- **FR-005**: A send change MUST NOT be an undo step, from any surface, including MCP `set_send`.
+- **FR-006**: Sends MUST NOT be an automation target: no menu entry, no new lane, and a send lane MUST NOT move the level.
+- **FR-007**: Return rows, the master row and a collapsed group bar MUST NOT show send knobs.
+
+### Key Entities
+
+- **Track send**: how much of one track goes to one return, off to full. Already stored. This feature only shows and edits it on Large headers.
+- **Return**: one knob per return, lettered A, B, C, D.
+
+## Success Criteria
+
+- **SC-001**: On a Large track, a person sets a send without opening the Mixer, Session or the Devices panel.
+- **SC-002**: Compact and Standard headers have no send knobs, and there is no Sends key above the headers.
+- **SC-003**: Undo after a send move leaves the send where it is. No send appears in the automation target list.
+
+## Assumptions
+
+- The maintainer chose header controls only, at the Large preset (128 px) and taller, not a toggle and not the 88 px standard-row rule from specs/072.
+- The knobs already in the header stay. This change decides when they appear, and takes sends back out of undo and automation.
+- Audio, instrument and a selected group get the knobs. Returns, the master and a collapsed group do not.
+
+## Nota Compliance Checklist
+
+- [x] No new source file
+- [x] No new dependency
+- [x] Audio-thread impact: send automation no longer writes the send from a lane. The level stays the atomic the audio thread already reads. No new allocation, lock or I/O on the audio thread.
+- [x] No new C ABI. The send mix-gesture kind is rejected. The send automation target is rejected.
+- [x] Smoke test updated: a send move is not an undo step, and a send lane is not created
+- [x] CHANGELOG, FEATURES, user docs
+- [x] UI follows DESIGN.md; the existing inline knob stays
diff --git a/specs/069-arrangement-header-sends/tasks.md b/specs/069-arrangement-header-sends/tasks.md
new file mode 100644
index 00000000..efb5cf7b
--- /dev/null
+++ b/specs/069-arrangement-header-sends/tasks.md
@@ -0,0 +1,22 @@
+# Tasks: Arrangement header sends, Large only
+
+**Input**: [spec.md](spec.md), [plan.md](plan.md)
+
+## Phase 1: Where the knobs show (US1)
+
+- [x] T001 Show the send row only at `LargeRowHeight` and taller in `src/managed/Nota.App/ArrangementView.Sends.cs`, and remove the **Sends** key, `SetShowSends` and the `showSends` sidecar flag (`ArrangementView.cs`, `ArrangementView.Sizing.cs`) per FR-001, FR-002, FR-007
+
+## Phase 2: Not undoable, not automatable (US3)
+
+- [x] T002 `SendControl` only calls `SetTrackSend`. MCP `set_send` does the same, in `src/managed/Nota.Mcp/Tools/TrackTools.cs`, per FR-005
+- [x] T003 Reject `MixKind::TrackSend` in `mixValue` / `applyMix` (`Engine.cpp`) and reject `AutomationTarget::Send` in `addAutomationLane` and `applyAutomation` (`Engine_Automation.cpp`, `Automation.h`, `nota_engine.h`) per FR-006
+- [x] T004 Remove send entries from the lane menu (`ArrangementView.Automation.cs`) and from MCP `add_automation_lane` (`AutomationTools.cs`) per FR-006
+- [x] T005 Rewrite `tests/Nota.SmokeTest/SendAutomationTests.cs` so a send move is not an undo step and a send lane is not created
+
+## Phase 3: Docs
+
+- [x] T006 CHANGELOG `[Unreleased]`, FEATURES.md, and the arrangement page in nota-docs (EN + RU)
+
+## Dependencies
+
+T001 is the visible change. T002–T005 are the engine and wiring. T006 last.
diff --git a/src/managed/Nota.App/ArrangementView.Automation.cs b/src/managed/Nota.App/ArrangementView.Automation.cs
index ccecc9dd..444287b6 100644
--- a/src/managed/Nota.App/ArrangementView.Automation.cs
+++ b/src/managed/Nota.App/ArrangementView.Automation.cs
@@ -411,8 +411,7 @@ public sealed partial class ArrangementView
case AutomationTarget.Pan:
key = "PAN"; apply = () => SetAutoTarget(t, AutomationTarget.Pan, -1, -1); break;
case AutomationTarget.Send:
- { int bus = info.DeviceIndex;
- key = $"S:{bus}"; apply = () => SetAutoTarget(t, AutomationTarget.Send, bus, -1); break; }
+ continue; // sends are not an automation target (specs/069)
case AutomationTarget.PluginParam:
{ string pid = eA.AutomationLaneParamId(t.Id, i); int dv = info.DeviceIndex;
key = $"P:{dv}:{pid}"; apply = () => SetAutoPluginTarget(t, dv, pid); break; }
@@ -437,11 +436,6 @@ public sealed partial class ArrangementView
flyout.Items.Add(Leaf(Loc.T("common.volume"), "V", () => SetAutoTarget(t, AutomationTarget.Volume, -1, -1), automated));
flyout.Items.Add(Leaf(Loc.T("common.pan"), "PAN", () => SetAutoTarget(t, AutomationTarget.Pan, -1, -1), automated));
- // One send per return (specs/072); returns themselves send nowhere.
- if (!t.IsReturn)
- foreach (var (bus, name) in SendBuses())
- flyout.Items.Add(Leaf(Loc.F("arrangement.send", SendLetter(bus), name), $"S:{bus}",
- () => SetAutoTarget(t, AutomationTarget.Send, bus, -1), automated));
if (_engine is { } e)
{
// An instrument (deviceIndex -1) exposing params — the built-in Nota Synth
diff --git a/src/managed/Nota.App/ArrangementView.Sends.cs b/src/managed/Nota.App/ArrangementView.Sends.cs
index 74b34373..3c91f2df 100644
--- a/src/managed/Nota.App/ArrangementView.Sends.cs
+++ b/src/managed/Nota.App/ArrangementView.Sends.cs
@@ -1,19 +1,15 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Arrangement · send levels in the track headers (specs/072, #143). A track card tall enough
-// for it carries a row of inline knobs, one per return in bus order, so a send can be set
-// without leaving the Arrangement. The knobs go through SendControl (one undo step per drag,
-// automation write like volume / pan) and follow sends moved anywhere else on the meter tick.
-// A "Sends" key in the header column's top strip shows or hides the row on every card; it is
-// view state, saved in the track-view sidecar with the row heights.
+// Arrangement · send levels in the track headers (specs/069, #143). A Large track card carries
+// a row of inline knobs, one per return in bus order, so a send can be set without leaving
+// the Arrangement. The knobs write the live level only (not an undo step, not an automation
+// lane) and follow sends moved anywhere else on the meter tick.
using System;
using System.Collections.Generic;
-using System.Linq;
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
using Nota.Application;
@@ -23,21 +19,19 @@ namespace Nota.App;
public sealed partial class ArrangementView
{
- // A standard row shows its sends from this height: its three rows plus the knob row.
- internal const double SendsMinStandardHeight = 88;
private const double SendRowTop = 6;
// A full cell: the inline knob, then the bus letter over the level; narrower → knob only.
private const double SendCellW = 41, SendCellGap = 4;
- private bool _showSends = true;
- // Header send knobs, refreshed each meter tick so automation and other surfaces move them.
+ // Header send knobs, refreshed each meter tick so other surfaces move them.
private readonly List<(int trackId, int bus, Knob knob, TextBlock? value, Control cell, string name)> _sendKnobs = new();
- private Border? _sendsToggle;
- /// <summary>Whether a track card at this height shows its send row (specs/072 FR-001, FR-007).</summary>
+ /// <summary>Whether a track card at this height shows its send row (specs/069 FR-001).
+ /// The Large layout below the preset has no room for another line, so the knobs wait
+ /// for the Large height itself.</summary>
private bool ShowSendsOn(TrackVM t, HeaderTier tier, double rowH)
- => _showSends && !t.IsReturn && _returns.Count > 0
- && (tier == HeaderTier.Large || (tier == HeaderTier.Standard && rowH >= SendsMinStandardHeight));
+ => !t.IsReturn && _returns.Count > 0
+ && tier == HeaderTier.Large && rowH + 0.5 >= LargeRowHeight;
// The returns in bus order, with their bus and name.
private List<(int bus, string name)> SendBuses()
@@ -144,7 +138,7 @@ public sealed partial class ArrangementView
return row;
}
- // Follow sends changed elsewhere — the Mixer, the Sends card, automation, MCP — unless in the hand.
+ // Follow sends changed elsewhere — the Mixer, the Sends card, MCP — unless in the hand.
private void FollowSends(IAudioEngine e)
{
foreach (var (id, bus, knob, value, cell, name) in _sendKnobs)
@@ -157,44 +151,4 @@ public sealed partial class ArrangementView
ToolTip.SetTip(cell, SendTip(bus, name, v));
}
}
-
- // The "Sends" key at the right end of the header column's top strip: on = a solid accent key.
- private Border BuildSendsToggle()
- {
- var text = new TextBlock { Text = Loc.T("common.sends"), FontSize = 9, FontWeight = FontWeight.SemiBold, VerticalAlignment = VerticalAlignment.Center };
- var key = new Border
- {
- Height = 18, Padding = new Thickness(7, 0), CornerRadius = NotaRadius.Control, BorderThickness = new Thickness(1),
- VerticalAlignment = VerticalAlignment.Center, Cursor = new Cursor(StandardCursorType.Hand), Child = text,
- IsVisible = false,
- };
- ToolTip.SetTip(key, Loc.T("arrangement.sends.show_sends_in_track_headers"));
- key.PointerPressed += (_, e) =>
- {
- if (!e.GetCurrentPoint(key).Properties.IsLeftButtonPressed) return;
- e.Handled = true;
- SetShowSends(!_showSends);
- };
- _sendsToggle = key;
- PaintSendsToggle();
- return key;
- }
-
- private void PaintSendsToggle()
- {
- if (_sendsToggle is not { Child: TextBlock text } key) return;
- key.Background = _showSends ? NotaPalette.Accent : NotaPalette.SurfaceRaised;
- key.BorderBrush = _showSends ? NotaPalette.Accent : NotaPalette.Seam;
- text.Foreground = _showSends ? NotaPalette.InkOn(NotaPalette.Accent) : NotaPalette.TextSecondary;
- key.IsVisible = _returns.Count > 0;
- }
-
- /// <summary>Show or hide the send row on every track header (the top-strip key).</summary>
- internal void SetShowSends(bool on)
- {
- if (_showSends == on) return;
- _showSends = on;
- PaintSendsToggle();
- RebuildHeaders();
- }
}
diff --git a/src/managed/Nota.App/ArrangementView.Sizing.cs b/src/managed/Nota.App/ArrangementView.Sizing.cs
index b1f7e5bf..da24df0a 100644
--- a/src/managed/Nota.App/ArrangementView.Sizing.cs
+++ b/src/managed/Nota.App/ArrangementView.Sizing.cs
@@ -639,8 +639,6 @@ public sealed partial class ArrangementView
[JsonPropertyName("masterHeight")] public double? MasterHeight { get; set; }
// specs/070: folded groups by track index, shared with the Mixer. Additive — version stays 1.
[JsonPropertyName("collapsedGroups")] public List<int>? CollapsedGroups { get; set; }
- // specs/072: the Sends key; absent = shown. Additive too.
- [JsonPropertyName("showSends")] public bool? ShowSends { get; set; }
}
private sealed class TrackHeightDto
@@ -649,7 +647,7 @@ public sealed partial class ArrangementView
[JsonPropertyName("height")] public double Height { get; set; }
}
- /// <summary>Write the track, return and master heights, the header width, the folded groups and the Sends key
+ /// <summary>Write the track, return and master heights, the header width and the folded groups
/// into a .nota bundle, keyed by track index (ids only last a session). Cosmetic — a failure here never fails the save.</summary>
public void SaveTrackView(string bundleDir)
{
@@ -670,9 +668,7 @@ public sealed partial class ArrangementView
if (_engine.TryGetTrackInfo(i, out var ti) && ti.IsGroup && _fold.IsFolded(ti.Id)) folded.Add(i);
if (folded.Count > 0) dto.CollapsedGroups = folded;
}
- if (!_showSends) dto.ShowSends = false;
- if (dto.HeaderWidth is null && dto.TrackHeights.Count == 0 && dto.MasterHeight is null && dto.CollapsedGroups is null
- && dto.ShowSends is null)
+ if (dto.HeaderWidth is null && dto.TrackHeights.Count == 0 && dto.MasterHeight is null && dto.CollapsedGroups is null)
{
if (System.IO.File.Exists(path)) System.IO.File.Delete(path);
return;
@@ -705,7 +701,6 @@ public sealed partial class ArrangementView
if (idx >= 0 && _engine.TryGetTrackInfo(idx, out var gi) && gi.IsGroup) ids.Add(gi.Id);
_fold.Set(ids);
}
- if (dto.ShowSends is { } ss) _showSends = ss;
}
catch { /* a corrupt sidecar just means the default layout */ }
finally { ApplyHeaderWidth(final: false); }
@@ -719,8 +714,6 @@ public sealed partial class ArrangementView
_masterHeight = DefaultFooterRowHeight;
_clipboardHeights = null;
_userHeaderW = DefaultHeaderW;
- _showSends = true;
- PaintSendsToggle();
ApplyHeaderWidth(final: false);
}
}
diff --git a/src/managed/Nota.App/ArrangementView.cs b/src/managed/Nota.App/ArrangementView.cs
index 2c65a99f..f0e281bf 100644
--- a/src/managed/Nota.App/ArrangementView.cs
+++ b/src/managed/Nota.App/ArrangementView.cs
@@ -384,17 +384,9 @@ public sealed partial class ArrangementView : UserControl
zoomOut, zoomIn,
},
};
- // The Sends key (specs/072) at the strip's far end; hidden while there are no returns.
- var sendsKey = BuildSendsToggle();
- DockPanel.SetDock(sendsKey, Dock.Right);
- var zoomBar = new DockPanel
- {
- Width = HeaderW, LastChildFill = true,
- VerticalAlignment = VerticalAlignment.Center,
- Margin = new Thickness(8, 0, 0, 0),
- Children = { sendsKey, zoomKeys },
- };
- sendsKey.Margin = new Thickness(0, 0, 16, 0);
+ zoomKeys.Width = HeaderW;
+ zoomKeys.Margin = new Thickness(8, 0, 0, 0);
+ var zoomBar = zoomKeys;
_headerColumnParts.Add(zoomBar);
var topLeft = HeaderPanel(zoomBar);
var topGrid = new Grid { Height = RulerH };
@@ -2224,7 +2216,6 @@ public sealed partial class ArrangementView : UserControl
_cardTiers.Clear();
_cardSends.Clear();
_sendKnobs.Clear();
- PaintSendsToggle();
for (int i = 0; i < _tracks.Count; i++)
{
var card = BuildHeaderCard(_tracks[i]);
@@ -2330,7 +2321,7 @@ public sealed partial class ArrangementView : UserControl
double rowH = TrackRowHeight(t);
var tier = TierFor(rowH);
_cardTiers[t.Id] = tier;
- bool sends = ShowSendsOn(t, tier, rowH); // specs/072: the send row under volume / pan
+ bool sends = ShowSendsOn(t, tier, rowH); // specs/069: send knobs on a Large row
_cardSends[t.Id] = sends;
_sendKnobs.RemoveAll(k => k.trackId == t.Id);
diff --git a/src/managed/Nota.App/SendControl.cs b/src/managed/Nota.App/SendControl.cs
index ce90a5de..b5b6949b 100644
--- a/src/managed/Nota.App/SendControl.cs
+++ b/src/managed/Nota.App/SendControl.cs
@@ -1,15 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// One wiring for every send control (specs/072): the arrangement header's knobs, the Mixer
-// window's and Session mixer's faders and the Devices panel's Sends card. A drag is one undo
-// step (a value gesture, specs/009) and writes the send's automation lane while recording —
-// or overrides it while not — exactly as the volume and pan controls do, so a send behaves
-// the same whichever surface moves it.
+// One wiring for every send control (specs/069, #143): the arrangement header's knobs, the
+// Mixer window's and Session mixer's faders and the Devices panel's Sends card. A send is a
+// live level only — not an undo step and not an automation target — so this writes
+// SetTrackSend and nothing else, whichever surface moves it.
using System;
using Nota.Application;
-using Nota.Application.Editing;
namespace Nota.App;
@@ -18,41 +16,9 @@ internal static class SendControl
/// <summary>Wire a knob: drag, reset and typed values set the send to <paramref name="bus"/>;
/// <paramref name="changed"/> runs after each value (e.g. to update a read-out).</summary>
public static void Attach(Knob knob, IAudioEngine engine, int trackId, int bus, Action<double>? changed = null)
- {
- var g = new Gesture(engine, trackId, bus);
- knob.GestureBegin += g.Begin;
- knob.ValueChanged += v => { g.Change(v); changed?.Invoke(v); };
- knob.GestureEnd += g.End;
- }
+ => knob.ValueChanged += v => { engine.SetTrackSend(trackId, bus, (float)v); changed?.Invoke(v); };
/// <summary>Wire a mini fader the same way.</summary>
public static void Attach(MiniFader fader, IAudioEngine engine, int trackId, int bus, Action<double>? changed = null)
- {
- var g = new Gesture(engine, trackId, bus);
- fader.GestureBegin += g.Begin;
- fader.ValueChanged += v => { g.Change(v); changed?.Invoke(v); };
- fader.GestureEnd += g.End;
- }
-
- // The undo gesture opens before the automation write, so a lane the write creates while
- // recording and the value undo as one step; it closes after it.
- private sealed class Gesture(IAudioEngine engine, int trackId, int bus)
- {
- private readonly MixGesture _undo = new(engine, MixTarget.Send(trackId, bus));
- private readonly Action<double> _set = v => engine.SetTrackSend(trackId, bus, (float)v);
-
- public void Begin()
- {
- _undo.Begin();
- engine.BeginAutomationWrite(trackId, AutomationTarget.Send, bus, -1, "");
- }
-
- public void Change(double v) => _undo.Change(v, _set);
-
- public void End()
- {
- engine.EndAutomationWrite(trackId, AutomationTarget.Send, bus, -1, "");
- _undo.End();
- }
- }
+ => fader.ValueChanged += v => { engine.SetTrackSend(trackId, bus, (float)v); changed?.Invoke(v); };
}
diff --git a/src/managed/Nota.Application/Localization/en.json b/src/managed/Nota.Application/Localization/en.json
index b5896fda..79abbfed 100644
--- a/src/managed/Nota.Application/Localization/en.json
+++ b/src/managed/Nota.Application/Localization/en.json
@@ -122,7 +122,6 @@
"arrangement.sections.sections": "Sections",
"arrangement.sections.select_section": "Select section",
"arrangement.send": "Send {0} · {1}",
- "arrangement.sends.show_sends_in_track_headers": "Show sends in track headers",
"arrangement.takes.delete_take": "Delete take",
"arrangement.takes.flatten_takes": "Flatten takes",
"arrangement.takes.hide_takes": "Hide takes",
diff --git a/src/managed/Nota.Mcp/Tools/AutomationTools.cs b/src/managed/Nota.Mcp/Tools/AutomationTools.cs
index 1c34e1a4..839640df 100644
--- a/src/managed/Nota.Mcp/Tools/AutomationTools.cs
+++ b/src/managed/Nota.Mcp/Tools/AutomationTools.cs
@@ -42,14 +42,15 @@ public sealed class AutomationTools(IAudioEngine engine, IEngineDispatch dispatc
[McpServerTool(Name = "add_automation_lane"), Description(
"Add an automation lane. target: \"volume\", \"pan\", \"device_param\" (with deviceIndex+paramIndex) or "
- + "\"midi_param\" (a MIDI effect: deviceIndex = its index from list_midi_fx, paramIndex from get_midi_fx_params) or "
- + "\"send\" (a send level 0..1: deviceIndex = the return bus, 0 = A). "
+ + "\"midi_param\" (a MIDI effect: deviceIndex = its index from list_midi_fx, paramIndex from get_midi_fx_params). "
+ + "A send is not an automation target: \"send\" returns -1. "
+ "Returns the lane index.")]
public Task<int> AddAutomationLane(int trackId, string target, int deviceIndex = -1, int paramIndex = -1) => Mutate(() =>
{
+ if (target.Equals("send", StringComparison.OrdinalIgnoreCase)) return -1; // specs/069
var t = target.ToLowerInvariant() switch
{ "pan" => AutomationTarget.Pan, "device_param" => AutomationTarget.DeviceParam, "midi_param" => AutomationTarget.MidiDeviceParam,
- "send" => AutomationTarget.Send, _ => AutomationTarget.Volume };
+ _ => AutomationTarget.Volume };
return E.AddAutomationLane(trackId, t, deviceIndex, paramIndex);
});
diff --git a/src/managed/Nota.Mcp/Tools/TrackTools.cs b/src/managed/Nota.Mcp/Tools/TrackTools.cs
index f00bdcbd..eb1e31b2 100644
--- a/src/managed/Nota.Mcp/Tools/TrackTools.cs
+++ b/src/managed/Nota.Mcp/Tools/TrackTools.cs
@@ -73,6 +73,6 @@ public sealed class TrackTools(IAudioEngine engine, IEngineDispatch dispatch, IA
[McpServerTool(Name = "set_track_group"), Description("Move a track into a group (groupId = -1 for top level).")]
public Task SetTrackGroup(int trackId, int groupId) => Mutate(() => E.SetTrackGroup(trackId, groupId));
- [McpServerTool(Name = "set_send"), Description("Set a track's post-fader send level (0..1) to a return bus (0-based).")]
- public Task SetSend(int trackId, int returnBus, [Description("0..1")] float level) => Mutate(() => MixEdit.Step(E, () => E.SetTrackSend(trackId, returnBus, Math.Clamp(level, 0f, 1f)), MixTarget.Send(trackId, returnBus))); // one undo step
+ [McpServerTool(Name = "set_send"), Description("Set a track's post-fader send level (0..1) to a return bus (0-based). Not an undo step.")]
+ public Task SetSend(int trackId, int returnBus, [Description("0..1")] float level) => Mutate(() => E.SetTrackSend(trackId, returnBus, Math.Clamp(level, 0f, 1f))); // a live level, not an undo step (specs/069)
}
diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.h
index f82b1f16..b77c9346 100644
--- a/src/native/nota.engine/include/nota/nota_engine.h
+++ b/src/native/nota.engine/include/nota/nota_engine.h
@@ -980,9 +980,9 @@ NOTA_API NotaResult nota_engine_poll(NotaEngine* engine);
/* ---- Undo / redo (M6-6) -------------------------------------------------- */
/* Undo/redo of structural edits (tracks, clips, notes, device chains, session
* slots, arrangement sections) — restores a retained Graph snapshot — and of volume /
- * pan / sends / master volume (009, 072) and device-parameter (016) steps made through value
+ * pan / master volume (009) and device-parameter (016) steps made through value
* gestures. Returns NOTA_OK if a step was applied, NOTA_ERR_UNKNOWN if there was nothing
- * to undo/redo. Mute, solo, bypass and the transport are not covered. */
+ * to undo/redo. Mute, solo, sends, bypass and the transport are not covered. */
NOTA_API NotaResult nota_engine_undo(NotaEngine* engine);
NOTA_API NotaResult nota_engine_redo(NotaEngine* engine);
NOTA_API int32_t nota_engine_can_undo(const NotaEngine* engine);
@@ -997,7 +997,7 @@ NOTA_API void nota_engine_undo_group_end(NotaEngine* engine);
NOTA_API void nota_engine_clear_undo_history(NotaEngine* engine);
/* ---- Value undo (009, 016) ----------------------------------------------- */
-/* Volume / pan / send / master volume and device-parameter changes become undo steps through
+/* Volume / pan / master volume and device-parameter changes become undo steps through
* gestures. A gesture
* records its targets' values at begin and, at end, pushes ONE undo step with the values
* that changed (none changed → no step). If a structural checkpoint was pushed during the
@@ -1011,8 +1011,8 @@ NOTA_API void nota_engine_clear_undo_history(NotaEngine* engine);
#define NOTA_MIX_PLUGIN_PARAM 5 /* normalized 0..1; device_index -1 = the instrument */
#define NOTA_MIX_PRESET_TAG 6 /* a device's preset tag (specs/048): device_index as the
* surface needs, param_index = the surface (below) */
-#define NOTA_MIX_TRACK_SEND 8 /* a track's send level (specs/072): device_index = the
- * return bus 0..3 */
+#define NOTA_MIX_TRACK_SEND 8 /* rejected (specs/069): a send level is not an undo step.
+ * A gesture that names this kind records nothing. */
typedef struct NotaMixTarget {
int32_t kind; /* NOTA_MIX_* */
diff --git a/src/native/nota.engine/src/engine/Automation.h b/src/native/nota.engine/src/engine/Automation.h
index 9dbfc91c..dd7db133 100644
--- a/src/native/nota.engine/src/engine/Automation.h
+++ b/src/native/nota.engine/src/engine/Automation.h
@@ -16,13 +16,14 @@
namespace nota {
-// Send (specs/072): a track's send level into return bus `deviceIndex` (0..kMaxReturns-1).
+// Send stays 5 so a stored lane does not land on another target. It is not automated
+// (specs/069): addAutomationLane rejects it and applyAutomation does not play it.
enum class AutomationTarget : int32_t { Volume = 0, Pan = 1, DeviceParam = 2, PluginParam = 3, MidiDeviceParam = 4, Send = 5 };
-// The track's own mix values — volume, pan and the sends. Not tied to a device, so their lanes
+// The track's own mix values — volume and pan. Not tied to a device, so their lanes
// follow clips to any track (a device lane's index is only meaningful on its own chain).
inline bool isMixTarget(AutomationTarget t) {
- return t == AutomationTarget::Volume || t == AutomationTarget::Pan || t == AutomationTarget::Send;
+ return t == AutomationTarget::Volume || t == AutomationTarget::Pan;
}
// `curve` (M9-D) shapes the segment FROM this point TO the next: 0 = linear,
diff --git a/src/native/nota.engine/src/engine/Engine.cpp b/src/native/nota.engine/src/engine/Engine.cpp
index 5abeaf01..f45fa663 100644
--- a/src/native/nota.engine/src/engine/Engine.cpp
+++ b/src/native/nota.engine/src/engine/Engine.cpp
@@ -823,6 +823,7 @@ bool Engine::undo() {
// Restore without a new checkpoint; the restored chains may add or drop a latent
// device (a removed look-ahead coming back, #109), so compensation follows them.
if (e.graph) {
+ if (authoring_) keepLiveSends(*e.graph, *authoring_);
publishRaw(std::move(e.graph));
placeTakesForTempo(); // the snapshot may predate a tempo change
recomputePdc();
@@ -836,6 +837,48 @@ bool Engine::undo() {
return false;
}
+// specs/069. Message thread, before the restored graph is published. A shared track object
+// already holds the live levels, so it is left alone (the audio thread may be reading it).
+void Engine::keepLiveSends(Graph& restored, const Graph& live) const {
+ // No allocations: this runs on every undo/redo (perf-gate edit-warp-split).
+ const auto busOf = [](const std::shared_ptr<Track>& t) {
+ return t && t->type() == TrackType::Return && t->returnIndex() >= 0 && t->returnIndex() < kMaxReturns
+ ? t->returnIndex()
+ : -1;
+ };
+ // The track with `id` in `g`: track lists rarely reorder, so try the same index first.
+ const auto findById = [](const Graph& g, size_t hint, int32_t id) -> const Track* {
+ if (hint < g.tracks.size() && g.tracks[hint] && g.tracks[hint]->id() == id) return g.tracks[hint].get();
+ for (const auto& t : g.tracks)
+ if (t && t->id() == id) return t.get();
+ return nullptr;
+ };
+
+ // A return edit remaps buses. Copying a live slot onto the restored graph would put
+ // that level on a different return. The snapshot already has the levels for its buses.
+ // Same buses = the same (return id, bus) pairs on both sides; ids are unique.
+ size_t liveReturns = 0, oldReturns = 0;
+ for (const auto& t : restored.tracks)
+ if (busOf(t) >= 0) ++oldReturns;
+ for (size_t i = 0; i < live.tracks.size(); ++i) {
+ const int32_t bus = busOf(live.tracks[i]);
+ if (bus < 0) continue;
+ ++liveReturns;
+ const Track* old = findById(restored, i, live.tracks[i]->id());
+ if (!old || old->type() != TrackType::Return || old->returnIndex() != bus) return;
+ }
+ if (liveReturns != oldReturns) return;
+
+ for (size_t i = 0; i < restored.tracks.size(); ++i) {
+ auto& t = restored.tracks[i];
+ if (!t || t->type() == TrackType::Return) continue;
+ const Track* src = findById(live, i, t->id());
+ if (!src || src == t.get()) continue;
+ for (int b = 0; b < kMaxReturns; ++b)
+ if (t->send(b) != src->send(b)) t->setSend(b, src->send(b));
+ }
+}
+
// The restored racks drive their mapped targets again: the children they share with the
// copies an edit made still hold what those copies' mappings gave them (specs/040).
void Engine::reapplyRackMacros() {
@@ -859,6 +902,7 @@ bool Engine::redo() {
bool applied = false;
undoStack_.push_back({e.graph ? authoring_ : nullptr, e.mix});
if (e.graph) {
+ if (authoring_) keepLiveSends(*e.graph, *authoring_);
publishRaw(std::move(e.graph));
placeTakesForTempo(); // the snapshot may predate a tempo change
recomputePdc();
@@ -927,11 +971,7 @@ bool Engine::mixValue(const MixTarget& t, float& v) const {
}
auto tr = findTrackAuthoring(t.trackId);
if (!tr) return false;
- if (t.kind == MixKind::TrackSend) { // specs/072: a bus that can't exist has no value
- if (t.deviceIndex < 0 || t.deviceIndex >= kMaxReturns) return false;
- v = tr->send(t.deviceIndex);
- return true;
- }
+ if (t.kind == MixKind::TrackSend) return false; // specs/069: a send is not an undo step
v = t.kind == MixKind::TrackVolume ? tr->volume() : tr->pan();
return true;
}
@@ -963,11 +1003,7 @@ bool Engine::applyMix(const MixChange& c, bool after) {
}
auto tr = findTrackAuthoring(c.trackId);
if (!tr) return false; // the track is gone: skip quietly
- if (c.kind == MixKind::TrackSend) {
- if (c.deviceIndex < 0 || c.deviceIndex >= kMaxReturns) return false;
- tr->setSend(c.deviceIndex, v);
- return true;
- }
+ if (c.kind == MixKind::TrackSend) return false; // specs/069: nothing to restore
if (c.kind == MixKind::TrackVolume) tr->setVolume(v);
else
tr->setPan(v);
diff --git a/src/native/nota.engine/src/engine/Engine.h b/src/native/nota.engine/src/engine/Engine.h
index c077b7d1..3d79421a 100644
--- a/src/native/nota.engine/src/engine/Engine.h
+++ b/src/native/nota.engine/src/engine/Engine.h
@@ -1529,6 +1529,11 @@ class Engine {
// inherited); false when nothing moved.
bool insertTimeInto(Graph& g, double at, double len, bool duplicate);
void reapplyRackMacros(); // after undo/redo: racks drive their shared children again
+ // specs/069: a structural snapshot freezes send levels, and a send is not its own undo
+ // step. When the returns still sit on the same buses, copy the live levels onto the
+ // restored tracks. When a return was added, removed or moved, keep the snapshot's
+ // levels — those buses belong to that edit.
+ void keepLiveSends(Graph& restored, const Graph& live) const;
void reapplyCcRoutes(); // after undo/redo: Arps take their restored snapshot's targets
void syncCcRoutes(Graph& g); // before a publish: routes of fresh tracks from their Arps
void republishCcRoutes(int32_t trackId); // after a live CC target change: publish its route
diff --git a/src/native/nota.engine/src/engine/EngineTypes.h b/src/native/nota.engine/src/engine/EngineTypes.h
index 7d117cc4..6f40ca11 100644
--- a/src/native/nota.engine/src/engine/EngineTypes.h
+++ b/src/native/nota.engine/src/engine/EngineTypes.h
@@ -90,11 +90,12 @@ struct ControlEvent {
int32_t value;
};
-// Value undo (specs/009, specs/016): volume / pan / sends / master volume live in atomics outside the
+// Value undo (specs/009, specs/016): volume / pan / master volume live in atomics outside the
// graph, and device parameters live in Device objects that cloned tracks share — restoring
// an older graph restores neither. Their undo steps carry values instead of a snapshot. They
// share one history with the structural snapshots (UndoEntry), which keeps the order of all
-// edits. Parameter kinds address (track, device index, parameter index): DeviceParam an audio
+// edits. Send levels live in the same atomics and are not an undo step (specs/069). Parameter
+// kinds address (track, device index, parameter index): DeviceParam an audio
// effect, MidiDeviceParam a MIDI effect, PluginParam a normalized hosted-plugin / built-in
// instrument parameter (deviceIndex -1 = the instrument).
enum class MixKind : int32_t {
@@ -106,7 +107,7 @@ enum class MixKind : int32_t {
PluginParam = 5,
PresetTag = 6, // a device's preset tag (specs/048): deviceIndex as above, paramIndex = the surface
DeviceNotes = 7, // an EQ-8's band labels and notes (specs/049): the value indexes Engine::noteStates_
- TrackSend = 8 // a track's send level (specs/072): deviceIndex = the return bus
+ TrackSend = 8 // rejected (specs/069): a send level is not an undo step. deviceIndex would be the bus.
};
struct MixTarget {
MixKind kind;
diff --git a/src/native/nota.engine/src/engine/Engine_Automation.cpp b/src/native/nota.engine/src/engine/Engine_Automation.cpp
index 667631b9..fee27359 100644
--- a/src/native/nota.engine/src/engine/Engine_Automation.cpp
+++ b/src/native/nota.engine/src/engine/Engine_Automation.cpp
@@ -34,7 +34,7 @@ void Engine::applyAutomation(Graph* g, double beat) {
switch (lane.target) {
case AutomationTarget::Volume: t.setVolume(v); break;
case AutomationTarget::Pan: t.setPan(v); break;
- case AutomationTarget::Send: t.setSend(lane.deviceIndex, std::clamp(v, 0.0f, 1.0f)); break; // bus-guarded
+ case AutomationTarget::Send: break; // specs/069: a send lane does not move the level
case AutomationTarget::DeviceParam:
if (lane.deviceIndex >= 0 && lane.deviceIndex < static_cast<int32_t>(t.devices.size()))
if (auto* d = t.devices[lane.deviceIndex].get()) d->setParam(lane.paramIndex, v);
@@ -569,20 +569,18 @@ int32_t Engine::addAutomationLane(int32_t trackId, int32_t target, int32_t devic
auto old = findTrackAuthoring(trackId);
if (!old) return -1;
const auto tgt = static_cast<AutomationTarget>(target);
+ if (tgt == AutomationTarget::Send) return -1; // specs/069: sends are not an automation target
const bool usesDev = tgt == AutomationTarget::DeviceParam || tgt == AutomationTarget::MidiDeviceParam;
- const bool send = tgt == AutomationTarget::Send; // specs/072: one lane per return bus
- if (send && (deviceIndex < 0 || deviceIndex >= kMaxReturns)) return -1;
// Reuse an existing lane on the same target (no snapshot) — one lane per target.
for (size_t i = 0; i < old->automation.size(); ++i) {
const TrackLane& l = old->automation[i];
- if (!l.nested() && l.target == tgt && (!usesDev || (l.deviceIndex == deviceIndex && l.paramIndex == paramIndex)) &&
- (!send || l.deviceIndex == deviceIndex))
+ if (!l.nested() && l.target == tgt && (!usesDev || (l.deviceIndex == deviceIndex && l.paramIndex == paramIndex)))
return static_cast<int32_t>(i);
}
auto nt = cloneTrack(*old);
TrackLane lane;
lane.target = tgt;
- lane.deviceIndex = usesDev || send ? deviceIndex : -1;
+ lane.deviceIndex = usesDev ? deviceIndex : -1;
lane.paramIndex = usesDev ? paramIndex : -1;
nt->automation.push_back(std::move(lane));
const int32_t index = static_cast<int32_t>(nt->automation.size()) - 1;
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 260fbc43..975c8339 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -433,7 +433,7 @@ if (args.Length >= 1 && args[0] == "--linux-desktop")
return failures == 0 ? 0 : 1;
}
-// Sends as undoable, automatable mix values alone: `--sends` (specs/072). Also part of the full run.
+// Sends stay out of undo and automation: `--sends` (specs/069). Also part of the full run.
if (args.Length >= 1 && args[0] == "--sends")
{
Console.WriteLine("-- sends --");
diff --git a/tests/Nota.SmokeTest/SendAutomationTests.cs b/tests/Nota.SmokeTest/SendAutomationTests.cs
index 31aea1b1..024f5d42 100644
--- a/tests/Nota.SmokeTest/SendAutomationTests.cs
+++ b/tests/Nota.SmokeTest/SendAutomationTests.cs
@@ -1,12 +1,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
//
-// Sends as first-class mix values (specs/072-arrangement-track-sends, #143): a send gesture is
-// one exact undo step like volume and pan, a send lane plays back into the track's send level,
-// recording a send writes its lane in the same step as the value, the lane survives save/load
-// on its bus, and deleting a return drops the lanes to its bus and moves later ones down with
-// the send levels — undo bringing both back. The arrangement header's knobs rely on this.
-// Also runnable alone: `dotnet run --project tests/Nota.SmokeTest -- --sends`.
+// Sends stay live levels (specs/069-arrangement-header-sends, #143): moving a send is not an
+// undo step, from the plain setter, a mix gesture or MCP set_send, and a send is not an
+// automation target. Also runnable alone: `dotnet run --project tests/Nota.SmokeTest -- --sends`.
using Nota.Application;
using Nota.Application.Editing;
@@ -18,16 +15,20 @@ internal static class SendAutomationTests
{
public static IEnumerable<(bool ok, string label)> Run()
{
- foreach (var r in Undo()) yield return r;
- foreach (var r in Playback()) yield return r;
- foreach (var r in Record()) yield return r;
- foreach (var r in SaveLoad()) yield return r;
- foreach (var r in ReturnDelete()) yield return r;
+ foreach (var r in NotUndo()) yield return r;
+ foreach (var r in NotAutomation()) yield return r;
}
- // ---- value undo -------------------------------------------------------------------
+ private static float Volume(NotaEngine eng, int id)
+ {
+ for (int i = 0; i < eng.TrackCount; i++)
+ if (eng.TryGetTrackInfo(i, out var ti) && ti.Id == id) return ti.Volume;
+ return -1f;
+ }
- private static IEnumerable<(bool, string)> Undo()
+ // ---- not an undo step ----------------------------------------------------------------
+
+ private static IEnumerable<(bool, string)> NotUndo()
{
using var eng = new NotaEngine();
int t = eng.AddInstrumentTrack();
@@ -35,192 +36,98 @@ internal static class SendAutomationTests
eng.AddReturnTrack();
eng.ClearUndoHistory();
- // A drag: one gesture, many values, one step back to where it started.
- var g = new MixGesture(eng, MixTarget.Send(t, 1));
+ eng.SetTrackSend(t, 1, 0.4f);
+ yield return (Math.Abs(eng.GetTrackSend(t, 1) - 0.4f) < 1e-6f && !eng.CanUndo,
+ "sends: SetTrackSend changes the level and adds no undo step");
+
+ // A volume step, then a send, then undo: the volume returns and the send stays.
+ float vol0 = Volume(eng, t);
+ MixEdit.Step(eng, () => eng.SetTrackVolume(t, 0.5f), MixTarget.Volume(t));
+ eng.SetTrackSend(t, 1, 0.7f);
+ bool undone = eng.CanUndo && eng.Undo()
+ && Math.Abs(Volume(eng, t) - vol0) < 1e-4f
+ && Math.Abs(eng.GetTrackSend(t, 1) - 0.7f) < 1e-6f
+ && !eng.CanUndo;
+ yield return (undone, "sends: undo after a send restores the volume and leaves the send");
+
+ eng.ClearUndoHistory();
+ var g = new MixGesture(eng, MixTarget.Send(t, 0));
g.Begin();
- for (int i = 1; i <= 10; i++) g.Change(i * 0.06f, v => eng.SetTrackSend(t, 1, v));
+ g.Change(0.55f, v => eng.SetTrackSend(t, 0, v));
g.End();
- float after = eng.GetTrackSend(t, 1);
- bool one = eng.Undo() && eng.GetTrackSend(t, 1) == 0f && !eng.CanUndo;
- bool redo = eng.Redo() && eng.GetTrackSend(t, 1) == after;
- yield return (Math.Abs(after - 0.6f) < 1e-6f && one && redo,
- $"sends: a send drag is one undo step and redoes (0 → {after})");
+ yield return (Math.Abs(eng.GetTrackSend(t, 0) - 0.55f) < 1e-6f && !eng.CanUndo && !g.IsOpen,
+ "sends: a send gesture records nothing");
- // A gesture that ends where it began adds nothing.
- eng.ClearUndoHistory();
- var still = new MixGesture(eng, MixTarget.Send(t, 1));
- still.Begin();
- still.Change(0.9f, v => eng.SetTrackSend(t, 1, v));
- still.Change(after, v => eng.SetTrackSend(t, 1, v));
- still.End();
- yield return (!eng.CanUndo, "sends: a send gesture that changes nothing adds no step");
-
- // Other buses are untouched by a step on one.
- eng.SetTrackSend(t, 0, 0.3f);
- eng.ClearUndoHistory();
- MixEdit.Step(eng, () => eng.SetTrackSend(t, 1, 0.1f), MixTarget.Send(t, 1));
- eng.Undo();
- yield return (eng.GetTrackSend(t, 0) == 0.3f && eng.GetTrackSend(t, 1) == after,
- "sends: undoing bus B's step leaves bus A alone");
+ MixEdit.Step(eng, () => eng.SetTrackSend(t, 0, 0.2f), MixTarget.Send(t, 0));
+ yield return (Math.Abs(eng.GetTrackSend(t, 0) - 0.2f) < 1e-6f && !eng.CanUndo,
+ "sends: MixEdit.Step on a send adds no step");
- // MCP set_send is one step too.
- eng.ClearUndoHistory();
var tools = new Nota.Mcp.Tools.TrackTools(eng, new SyncDispatch(), new NoRefresh());
tools.SetSend(t, 0, 0.75f).GetAwaiter().GetResult();
- bool set = eng.GetTrackSend(t, 0) == 0.75f;
- yield return (set && eng.Undo() && eng.GetTrackSend(t, 0) == 0.3f && !eng.CanUndo,
- "sends: an MCP set_send call is one undo step");
+ yield return (Math.Abs(eng.GetTrackSend(t, 0) - 0.75f) < 1e-6f && !eng.CanUndo,
+ "sends: an MCP set_send call is not an undo step");
- // A step whose track is gone is skipped quietly (like volume).
- int gone = eng.AddAudioTrack();
+ // A rename snapshots the track, sends included. Undoing it must not put the send back.
eng.ClearUndoHistory();
- MixEdit.Step(eng, () => eng.SetTrackSend(gone, 0, 0.5f), MixTarget.Send(gone, 0));
- eng.RemoveTrack(gone);
- bool skipped = true;
- for (int i = 0; i < 4 && eng.CanUndo; i++) skipped &= eng.Undo();
- yield return (skipped, "sends: undo steps past a send step whose track was deleted");
- }
-
- // ---- automation playback ------------------------------------------------------------
-
- private static IEnumerable<(bool, string)> Playback()
- {
- using var eng = new NotaEngine();
- eng.SetBpm(120);
- int t = eng.AddInstrumentTrack();
- eng.AddReturnTrack();
- eng.AddReturnTrack();
- int lane = eng.AddAutomationLane(t, AutomationTarget.Send, 1, -1);
- int again = eng.AddAutomationLane(t, AutomationTarget.Send, 1, -1);
- int other = eng.AddAutomationLane(t, AutomationTarget.Send, 0, -1);
- int bad = eng.AddAutomationLane(t, AutomationTarget.Send, 4, -1);
- var info = lane >= 0 ? eng.AutomationLaneInfo(t, lane) : default;
- yield return (lane >= 0 && again == lane && other >= 0 && other != lane && bad < 0
- && info.Target == AutomationTarget.Send && info.DeviceIndex == 1,
- $"sends: one send lane per bus, bus kept, bus 4 refused (lanes {lane}/{again}/{other}/{bad})");
-
- eng.SetAutomationPoints(t, lane, new[] { new AutomationPoint(0, 0f), new AutomationPoint(8, 1f) });
+ eng.SetTrackName(t, "Bass");
+ eng.SetTrackSend(t, 0, 0.42f);
+ bool undoneName = eng.Undo() && eng.GetTrackName(t) != "Bass"
+ && Math.Abs(eng.GetTrackSend(t, 0) - 0.42f) < 1e-6f;
+ eng.SetTrackSend(t, 0, 0.2f);
+ bool redoneName = eng.Redo() && eng.GetTrackName(t) == "Bass"
+ && Math.Abs(eng.GetTrackSend(t, 0) - 0.2f) < 1e-6f;
+ yield return (undoneName && redoneName,
+ "sends: undo and redo of a rename leave the send");
+
+ // Deleting the first return slides the survivor down a bus. Undoing that puts
+ // each level back on its own return, not on the bus the survivor just left.
+ int r0 = -1, r1 = -1;
+ for (int i = 0; i < eng.TrackCount; i++)
+ {
+ if (!eng.TryGetTrackInfo(i, out var ti) || !ti.IsReturn) continue;
+ if (r0 < 0) r0 = ti.Id;
+ else r1 = ti.Id;
+ }
eng.ClearUndoHistory();
- var buf = new float[512 * 2];
- eng.Seek(4); eng.Play();
- eng.RenderOffline(buf, 512, 48000);
- eng.StopTransport();
- float mid = eng.GetTrackSend(t, 1), a = eng.GetTrackSend(t, 0);
- yield return (Math.Abs(mid - 0.5f) < 0.02f && a == 0f && !eng.CanUndo,
- $"sends: a send lane drives its bus during playback (beat 4 → {mid:F3}, bus A {a}) with no undo step");
+ eng.SetTrackSend(t, 0, 0.25f);
+ eng.SetTrackSend(t, 1, 0.8f);
+ bool deleted = r0 > 0 && eng.RemoveTrack(r0) && eng.TrackReturnIndex(r1) == 0
+ && Math.Abs(eng.GetTrackSend(t, 0) - 0.8f) < 1e-6f;
+ eng.SetTrackSend(t, 0, 0.15f);
+ bool restored = deleted && eng.Undo()
+ && eng.TrackReturnIndex(r0) == 0 && eng.TrackReturnIndex(r1) == 1
+ && Math.Abs(eng.GetTrackSend(t, 0) - 0.25f) < 1e-6f
+ && Math.Abs(eng.GetTrackSend(t, 1) - 0.8f) < 1e-6f;
+ yield return (restored, "sends: undo of a deleted return puts each send back on its return");
}
- // ---- recording a send ---------------------------------------------------------------
+ // ---- not an automation target -------------------------------------------------------
- private static IEnumerable<(bool, string)> Record()
+ private static IEnumerable<(bool, string)> NotAutomation()
{
using var eng = new NotaEngine();
- eng.SetBpm(120);
int t = eng.AddInstrumentTrack();
eng.AddReturnTrack();
- eng.ClearUndoHistory();
- var buf = new float[512 * 2];
+ int lane = eng.AddAutomationLane(t, AutomationTarget.Send, 0, -1);
+ int vol = eng.AddAutomationLane(t, AutomationTarget.Volume, -1, -1);
+ yield return (lane < 0 && vol >= 0 && eng.AutomationLaneCount(t) == 1
+ && eng.AutomationLaneInfo(t, vol).Target == AutomationTarget.Volume,
+ $"sends: a send lane is refused and a volume lane still opens ({lane}/{vol})");
+
+ eng.SetTrackSend(t, 0, 0.3f);
eng.SetAutomationRecord(true);
- eng.Seek(0); eng.Play();
- int h = eng.BeginMixGesture(MixTarget.Send(t, 0)); // as SendControl does: undo first
eng.BeginAutomationWrite(t, AutomationTarget.Send, 0, -1, "");
- for (int i = 0; i < 20; i++) { eng.SetTrackSend(t, 0, 0.2f + i * 0.02f); eng.RenderOffline(buf, 512, 48000); }
+ eng.SetTrackSend(t, 0, 0.8f);
eng.EndAutomationWrite(t, AutomationTarget.Send, 0, -1, "");
- eng.EndMixGesture(h);
- eng.StopTransport();
eng.SetAutomationRecord(false);
- int lanes = eng.AutomationLaneCount(t);
- bool sendLane = lanes == 1 && eng.AutomationLaneInfo(t, 0) is { Target: AutomationTarget.Send, DeviceIndex: 0 };
- float v1 = eng.GetTrackSend(t, 0);
- eng.Undo();
- bool undone = eng.AutomationLaneCount(t) == 0 && eng.GetTrackSend(t, 0) == 0f && !eng.CanUndo;
- yield return (sendLane && undone,
- $"sends: recording a send creates its lane and undoes with the value in one step ({lanes} lane, {v1:F2})");
- }
-
- // ---- save / load ----------------------------------------------------------------------
-
- private static IEnumerable<(bool, string)> SaveLoad()
- {
- using var eng = new NotaEngine();
- int t = eng.AddInstrumentTrack();
- eng.AddReturnTrack();
- eng.AddReturnTrack();
- int lane = eng.AddAutomationLane(t, AutomationTarget.Send, 1, -1);
- eng.SetAutomationPoints(t, lane, new[] { new AutomationPoint(0, 0.25f), new AutomationPoint(4, 0.75f, 0.3f) });
- string dir = Path.Combine(Path.GetTempPath(), "nota-sends-" + Guid.NewGuid().ToString("N"));
- try
- {
- var doc = ProjectService.Capture(eng, new TransportState(120, 1, false, false), new List<string>());
- ProjectService.Save(doc, dir, eng);
- using var e2 = new NotaEngine();
- ProjectService.Apply(ProjectService.Load(dir), e2, dir);
- int t2 = -1;
- for (int i = 0; i < e2.TrackCount; i++)
- if (e2.TryGetTrackInfo(i, out var ti) && ti.IsInstrument) t2 = ti.Id;
- bool ok = false;
- for (int l = 0; t2 > 0 && l < e2.AutomationLaneCount(t2); l++)
- {
- var info = e2.AutomationLaneInfo(t2, l);
- var pts = e2.GetAutomationPoints(t2, l);
- if (info.Target == AutomationTarget.Send && info.DeviceIndex == 1 && pts.Length == 2
- && Math.Abs(pts[0].Value - 0.25f) < 1e-6f && Math.Abs(pts[1].Value - 0.75f) < 1e-6f
- && Math.Abs(pts[1].Curve - 0.3f) < 1e-6f)
- ok = true;
- }
- yield return (ok, "sends: save/load keeps a send lane on its bus");
- }
- finally
- {
- try { if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true); } catch (IOException) { }
- }
- }
-
- // ---- deleting a return ----------------------------------------------------------------
-
- private static IEnumerable<(bool, string)> ReturnDelete()
- {
- using var eng = new NotaEngine();
- int t = eng.AddInstrumentTrack();
- int r0 = eng.AddReturnTrack();
- int r1 = eng.AddReturnTrack();
- int r2 = eng.AddReturnTrack();
- eng.SetTrackSend(t, 0, 0.1f);
- eng.SetTrackSend(t, 1, 0.2f);
- eng.SetTrackSend(t, 2, 0.3f);
- foreach (int bus in new[] { 0, 1, 2 })
- {
- int l = eng.AddAutomationLane(t, AutomationTarget.Send, bus, -1);
- eng.SetAutomationPoints(t, l, new[] { new AutomationPoint(0, 0.1f * (bus + 1)) });
- }
- eng.ClearUndoHistory();
-
- bool removed = eng.RemoveTracks(new[] { r1 });
- var buses = SendLaneBuses(eng, t);
- bool remapped = removed && eng.TrackReturnIndex(r2) == 1 && buses.Count == 2
- && buses.TryGetValue(0, out var v0) && Math.Abs(v0 - 0.1f) < 1e-6f
- && buses.TryGetValue(1, out var v1) && Math.Abs(v1 - 0.3f) < 1e-6f
- && Math.Abs(eng.GetTrackSend(t, 1) - 0.3f) < 1e-6f;
- yield return (remapped,
- $"sends: deleting return B drops its send lane and moves C's lane and level to bus B ({string.Join(", ", buses.Select(kv => $"{kv.Key}:{kv.Value:F1}"))})");
-
- eng.Undo();
- buses = SendLaneBuses(eng, t);
- yield return (eng.TrackReturnIndex(r0) == 0 && buses.Count == 3 && buses.TryGetValue(2, out var c) && Math.Abs(c - 0.3f) < 1e-6f,
- "sends: undo brings the return and its send lane back");
- }
-
- // Bus → first point value of each send lane on the track.
- private static Dictionary<int, float> SendLaneBuses(NotaEngine eng, int t)
- {
- var map = new Dictionary<int, float>();
- for (int l = 0; l < eng.AutomationLaneCount(t); l++)
- {
- var info = eng.AutomationLaneInfo(t, l);
- if (info.Target != AutomationTarget.Send) continue;
- var pts = eng.GetAutomationPoints(t, l);
- map[info.DeviceIndex] = pts.Length > 0 ? pts[0].Value : -1f;
- }
- return map;
+ bool noLane = eng.AutomationLaneCount(t) == 1
+ && eng.AutomationLaneInfo(t, 0).Target == AutomationTarget.Volume
+ && Math.Abs(eng.GetTrackSend(t, 0) - 0.8f) < 1e-6f;
+ yield return (noLane, "sends: recording a send writes no lane");
+
+ var tools = new Nota.Mcp.Tools.AutomationTools(eng, new SyncDispatch(), new NoRefresh());
+ int mcp = tools.AddAutomationLane(t, "send", 0, -1).GetAwaiter().GetResult();
+ yield return (mcp < 0 && eng.AutomationLaneCount(t) == 1,
+ "sends: MCP add_automation_lane \"send\" returns -1");
}
}