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) Send levels in the Arrangement's track headers (#143) (#441)
Egor Khindikaynen0fd02fef8c12
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e837817b..28253e05 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,16 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.## [Unreleased]### Added+- **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.- **Delete several versions at once** (#228): in the History tab, ⌘-click (Ctrl-click onWindows and Linux) adds a version to the selection and Shift-click selects a run. Withmore than one selected, the footer shows how many and when they were saved, and itsdiff --git a/FEATURES.md b/FEATURES.mdindex 30b88bbc..de8ea8ef 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 and master-volume moves and the parameters of effects,+ operation — including volume, pan, send and master-volume moves and the parameters of effects,MIDI effects, instruments and plug-ins, from any source (device cards, Mixer, trackheaders, 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, sends and devices inside racks are not in the history; automation playback,+ Mute, solo 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 aninstrument track (Nota Volt), an audio track and two returns — **Reverb** (Nota Reverb)@@ -149,6 +149,10 @@ docks as a panel under any of the three, or floats in its own window — seefit their height: one line (name, M / S / arm) when short, input, fader and pan on rowsof their own when tall. Drag the seam between headers and lanes to set the headerwidth (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+ 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).- **Track headers left or right** — View ▸ Track headers on the right (or Settings →Appearance → Track headers) moves the header column, the return / master headers andthe header strips to the right edge, so the timeline starts at the left; remembered@@ -597,7 +601,9 @@ 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 return's lane (Volume, Pan or a+ (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+ device parameter. A return's lane (Volume, Pan or adevice 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 automationshows its first automated parameter.@@ -1417,7 +1423,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, moveand split; read and write a clip's controller curves (sustain, wheels, any CC).-- **Automation**: create a lane, read and write points.+- **Automation**: create a lane (volume, pan, a send, a device or instrument parameter),+ read and write points.- **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 / launchdiff --git a/specs/072-arrangement-track-sends/checklists/requirements.md b/specs/072-arrangement-track-sends/checklists/requirements.mdnew file mode 100644index 00000000..05f1d4df--- /dev/null+++ b/specs/072-arrangement-track-sends/checklists/requirements.md@@ -0,0 +1,39 @@+# Specification Quality Checklist: Send levels in the arrangement track headers++**Purpose**: Validate specification completeness and quality before proceeding to planning+**Created**: 2026-11-02+**Feature**: [spec.md](../spec.md)++## Content Quality++- [x] No implementation details (languages, frameworks, APIs)+- [x] Focused on user value and business needs+- [x] Written for non-technical stakeholders+- [x] All mandatory sections completed++## Requirement Completeness++- [x] No [NEEDS CLARIFICATION] markers remain+- [x] Requirements are testable and unambiguous+- [x] Success criteria are measurable+- [x] Success criteria are technology-agnostic (no implementation details)+- [x] All acceptance scenarios are defined+- [x] Edge cases are identified+- [x] Scope is clearly bounded+- [x] Dependencies and assumptions identified++## Feature Readiness++- [x] All functional requirements have clear acceptance criteria+- [x] User scenarios cover primary flows+- [x] Feature meets measurable outcomes defined in Success Criteria+- [x] No implementation details leak into specification++## Notes++- The Nota Context and Compliance sections name the engine / managed / UI areas by+ project convention; FR-011 states the audio-thread rule as a constraint, not a design.+- Sends gaining undo and automation everywhere (not only in the header) is a deliberate+ scope call: the issue asks for undoable, automatable sends kept in sync with the Mixer+ and Sends card, and a header-only undo would make the same value undo from one control+ and not another.diff --git a/specs/072-arrangement-track-sends/contracts/abi.md b/specs/072-arrangement-track-sends/contracts/abi.mdnew file mode 100644index 00000000..867baa4b--- /dev/null+++ b/specs/072-arrangement-track-sends/contracts/abi.md@@ -0,0 +1,34 @@+# C ABI contract changes (`nota_engine.h`)++No new functions. Two new values on existing calls.++## Value undo++```c+#define NOTA_MIX_TRACK_SEND 8 /* a track's send level: device_index = return bus (0..3) */+```++`nota_mix_gesture_begin` accepts kind 8. The value read at begin/end is+`nota_track_get_send(track_id, device_index)`. A target with a missing track or a bus outside+0..3 is invalid (ignored; begin returns 0 if no target is valid).++## Automation++Target `5` = send level of bus `device_index` (`param_index` −1), values 0..1:++- `nota_track_add_automation_lane(e, track, 5, bus, -1)` → lane index (reused per bus).+- `nota_track_automation_lane_info` reports target 5 and `device_index` = bus.+- `nota_track_begin_automation_write / end_automation_write(e, track, 5, bus, -1, NULL, latch)`+ record / override like volume.+- Playback writes the send level read back by `nota_track_get_send`.+- `nota_engine_delete_track(s)` of a return: send lanes to that bus are removed and later+ buses' lanes renumbered, in the same undo step as the send-level remap.++## Managed mirror (`EngineContracts.cs`)++`AutomationTarget.Send = 5`, `MixKind.TrackSend = 8`, `MixTarget.Send(trackId, bus)`.++## MCP++`set_send` becomes one undo step. Automation tools accept / report target `"send"`+(bus in `device_index`).diff --git a/specs/072-arrangement-track-sends/data-model.md b/specs/072-arrangement-track-sends/data-model.mdnew file mode 100644index 00000000..c223bbd7--- /dev/null+++ b/specs/072-arrangement-track-sends/data-model.md@@ -0,0 +1,33 @@+# Data model: Send levels in the arrangement track headers++## Send level (existing)++| Field | Type | Notes |+|---|---|---|+| track | track id | audio, instrument or group track (returns and master have none) |+| bus | 0…3 | the return's bus slot (A–D), `kMaxReturns` = 4 |+| level | float 0…1 | post-fader; 0 = off. Atomic on the track; saved in the project (`Sends[4]`) |++## Send value-undo step (new kind)++`MixChange { kind = TrackSend, trackId, deviceIndex = bus, before, after }` — one per+target per gesture; skipped on undo/redo when the track is gone or the bus is out of range.++## Send automation lane (new target)++| Field | Value |+|---|---|+| target | `Send` (5) |+| deviceIndex | bus 0…3 |+| paramIndex | −1 |+| points | beat, value 0…1, curve |++Rules: one lane per (track, bus); not nested (`chainUid` 0). Deleting a return:+lanes to its bus are removed, lanes to later buses get `bus − 1` in step with send levels;+reordering/removing devices never touches send lanes; cross-track clip moves carry them.++## Arrangement view state (sidecar `track-view.json`)++| Field | Type | Default |+|---|---|---|+| `showSends` | bool? | absent = true |diff --git a/specs/072-arrangement-track-sends/mockup.html b/specs/072-arrangement-track-sends/mockup.htmlnew file mode 100644index 00000000..c3d75ff3--- /dev/null+++ b/specs/072-arrangement-track-sends/mockup.html@@ -0,0 +1,148 @@+<!-- SPDX-License-Identifier: AGPL-3.0-only -->+<!-- Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms. -->+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<title>specs/072 · Sends in the arrangement track headers — mockup</title>+<style>+ /* Studio Dark tokens (src/managed/Nota.App/Theme/Themes/studio-dark.json). */+ :root {+ --BgApp:#1E1F22; --BgSunken:#17181A; --LaneB:#222326; --SurfaceCard:#2B2D31; --SurfaceRaised:#34363B;+ --SelHeaderBg:#393C41; --Seam:#141517; --Rule:#45484E; --TextPrimary:#E8E9EB; --TextSecondary:#C0C4C9;+ --TextTertiary:#92969D; --TextDisabled:#82868C; --VizInk:#D7D8DA; --Accent:#FF9F1C; --TextOnAccent:#17181A;+ --Mute:#F2B53C; --Solo:#6A9FD8; --Record:#F06A6E; --Success:#6CC673;+ }+ body { margin:0; padding:24px; background:#101113; color:var(--TextPrimary); font:11px "Geist", system-ui, sans-serif; }+ h1 { font-size:14px; font-weight:600; margin:0 0 4px; }+ p.note { color:var(--TextTertiary); margin:0 0 18px; max-width:880px; line-height:1.45; }+ .row { display:flex; gap:28px; align-items:flex-start; flex-wrap:wrap; }+ .shot { display:flex; flex-direction:column; gap:6px; }+ .cap { color:var(--TextTertiary); font-size:10px; }+ .col { background:var(--BgApp); border:1px solid var(--Seam); }+ .mono { font-family:"Geist Mono", ui-monospace, monospace; }++ /* top strip of the header column: Zoom − + … Sends */+ .strip { height:24px; display:flex; align-items:center; gap:5px; padding:0 8px 0 14px; background:var(--SurfaceCard);+ border-bottom:1px solid var(--Seam); border-right:1px solid var(--Seam); box-sizing:border-box; }+ .label { color:var(--TextTertiary); font-size:9px; font-weight:600; margin-right:2px; }+ .zchip { width:24px; height:18px; display:grid; place-items:center; border:1px solid var(--Seam); border-radius:3px;+ background:var(--SurfaceRaised); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }+ .spacer { flex:1; }+ .toggle { height:18px; padding:0 7px; display:grid; place-items:center; border:1px solid var(--Seam); border-radius:3px;+ background:var(--SurfaceRaised); color:var(--TextSecondary); font-size:9px; }+ .toggle.on { background:var(--Accent); color:var(--TextOnAccent); font-weight:600; }++ /* a track header card */+ .card { position:relative; display:flex; border-bottom:1px solid var(--Seam); border-right:1px solid var(--Seam); background:var(--SurfaceCard);+ box-sizing:border-box; overflow:hidden; }+ .card.sel { background:var(--SelHeaderBg); }+ .spine { width:3px; flex:none; }+ .body { flex:1; display:flex; min-width:0; }+ .stack { flex:1; display:flex; flex-direction:column; padding:6px 8px; min-width:0; gap:0; }+ .meter { width:8px; margin:6px 3px 6px 0; background:var(--BgSunken); border-radius:1px; position:relative; }+ .meter i { position:absolute; left:0; right:0; bottom:0; background:var(--Success); border-radius:1px; }+ .name { display:flex; align-items:center; gap:6px; height:16px; }+ .name b { flex:1; font-size:11px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }+ .tag { font-family:"Geist Mono", monospace; font-size:7.5px; color:var(--TextTertiary); border:1px solid var(--Rule); border-radius:2px; padding:0 3px; }+ .r2 { display:flex; gap:3px; margin-top:5px; align-items:center; }+ .combo { flex:1; height:16px; border:1px solid var(--Rule); border-radius:3px; background:var(--BgSunken); color:var(--TextSecondary);+ font-size:9px; display:flex; align-items:center; padding:0 5px; }+ .chip { width:18px; height:16px; border-radius:2px; background:var(--SurfaceRaised); border:1px solid var(--Seam); display:grid; place-items:center;+ font-size:9px; font-weight:600; color:var(--TextSecondary); box-sizing:border-box; }+ .chip.s { background:var(--Solo); color:var(--TextOnAccent); }+ .vol { display:grid; gap:6px; margin-top:6px; align-items:center; }+ .fader { height:4px; background:var(--BgSunken); border-radius:2px; position:relative; }+ .fader i { position:absolute; left:0; top:0; bottom:0; background:var(--VizInk); border-radius:2px; }+ .fader u { position:absolute; top:-3px; width:3px; height:10px; background:var(--TextPrimary); border-radius:1px; }+ .db { font-size:9px; color:var(--TextTertiary); width:30px; text-align:right; }+ .pan { height:4px; background:var(--BgSunken); border-radius:2px; position:relative; }+ .pan i { position:absolute; top:0; bottom:0; background:var(--VizInk); }++ /* NEW: the send row — one inline knob per return */+ .sends { display:grid; margin-top:6px; height:24px; column-gap:4px; align-items:center; }+ .send { display:flex; align-items:center; gap:3px; min-width:0; }+ .send .lv { display:flex; flex-direction:column; line-height:10px; }+ .send .lt { font-size:8px; font-weight:500; color:var(--TextSecondary); }+ .send .vv { font-size:8px; color:var(--TextTertiary); }+ .send.hot .lt { color:var(--TextPrimary); }+ .send.hot .vv { color:var(--TextPrimary); }+ .tip { position:absolute; background:var(--SurfaceRaised); color:var(--TextPrimary); border:1px solid var(--Seam); border-radius:3px;+ font-size:10px; padding:3px 6px; white-space:nowrap; }+ .lanes { background:var(--BgApp); }+ ul { color:var(--TextSecondary); line-height:1.5; max-width:880px; padding-left:18px; }+</style>+</head>+<body>+<h1>Sends in the arrangement track headers (specs/072, nota-daw/nota#143)</h1>+<p class="note">Studio Dark, 1 : 1. The send row is new; everything else is today's header. One <b>inline knob (24)</b> per+return in bus order, each with its bus letter over a mono percent read-out. Arcs rest in <b>VizInk</b>; the accent+appears only on the knob under the pointer or in the hand (bus A below is being dragged). The <b>Sends</b> toggle sits at the+right end of the header column's top strip; on = the solid accent key.</p>++<div class="row" id="shots"></div>++<ul>+ <li><b>Standard row, ≥ 88 px</b>: name · routing + M/S/● · volume|pan (2 : 1) · <b>sends</b>. Below 88 px the standard header is unchanged.</li>+ <li><b>Large row</b>: with sends shown, volume and pan share one row (as on a standard row) so the send row fits the 128 px preset; with sends hidden the large layout is unchanged (pan on its own row).</li>+ <li><b>Narrow column</b>: when a cell can't hold knob + letter/value, the cells drop to knobs only; the letter, return name and value move to the tooltip and the ⌥-click value box.</li>+ <li>Tooltip: "Send A · Reverb · 42 %". Double-click resets to 0 %. Compact rows, return / master footer rows and the slim group bar get no send row.</li>+ <li>No returns → no send row and no Sends toggle.</li>+</ul>++<script>+const css = n => getComputedStyle(document.documentElement).getPropertyValue('--' + n).trim();+// The Studio knob on its 52-unit grid, drawn at 24 px (Knob.Inline).+function knob(v, live) {+ const S = 24, k = S / 52, cx = S / 2, cy = S / 2, R = 21 * k, sw = 5 * k;+ const a0 = 135, sweep = 270, a1 = a0 + sweep * v;+ const pt = (deg, r) => [cx + r * Math.cos(deg * Math.PI / 180), cy + r * Math.sin(deg * Math.PI / 180)];+ const arc = (from, to) => { const [x0, y0] = pt(from, R), [x1, y1] = pt(to, R);+ return `M${x0} ${y0} A${R} ${R} 0 ${to - from > 180 ? 1 : 0} 1 ${x1} ${y1}`; };+ const [px, py] = pt(a1, 14 * k);+ return `<svg width="${S}" height="${S}" viewBox="0 0 ${S} ${S}">+ <path d="${arc(a0, a0 + sweep)}" stroke="${css('BgSunken')}" stroke-width="${sw}" fill="none"/>+ ${v > 0.002 ? `<path d="${arc(a0, a1)}" stroke="${live ? css('Accent') : css('VizInk')}" stroke-width="${sw}" fill="none"/>` : ''}+ <circle cx="${cx}" cy="${cy}" r="${14 * k}" fill="${css('SurfaceRaised')}" stroke="${css('Seam')}" stroke-width="1"/>+ <line x1="${cx}" y1="${cy}" x2="${px}" y2="${py}" stroke="${css('TextPrimary')}" stroke-width="${2.4 * k}" stroke-linecap="round"/>+ </svg>`;+}+const pct = v => v <= 0.005 ? '–' : String(Math.round(v * 100));+function sendRow(vals, opts = {}) {+ const cells = vals.map((v, i) => {+ const hot = opts.hot === i, letter = 'ABCD'[i];+ const lv = opts.knobsOnly ? '' : `<span class="lv"><span class="lt">${letter}</span><span class="vv mono">${pct(v)}</span></span>`;+ return `<span class="send${hot ? ' hot' : ''}">${knob(v, hot)}${lv}</span>`;+ }).join('');+ return `<div class="sends" style="grid-template-columns:repeat(${vals.length},${opts.knobsOnly ? 'auto' : '1fr'});${opts.knobsOnly ? 'justify-content:space-between' : ''}">${cells}</div>`;+}+function strip(w, on, hasReturns = true) {+ return `<div class="strip" style="width:${w}px"><span class="label">Zoom</span><span class="zchip">−</span><span class="zchip">+</span>+ <span class="spacer"></span>${hasReturns ? `<span class="toggle${on ? ' on' : ''}">Sends</span>` : ''}</div>`;+}+function card({ w = 228, h, name, tag = 'MIDI', color = '#D77A8F', sends, sendOpts, large = false, sel = false, volPanShared = true, meter = .55 }) {+ const volRow = volPanShared+ ? `<div class="vol" style="grid-template-columns:2fr 1fr"><div style="display:flex;align-items:center"><div class="fader" style="flex:1"><i style="width:62%"></i><u style="left:62%"></u></div><span class="db mono">−3.2</span></div><div class="pan"><i style="left:50%;width:14%"></i></div></div>`+ : `<div class="vol" style="grid-template-columns:1fr"><div style="display:flex;align-items:center"><div class="fader" style="flex:1"><i style="width:62%"></i><u style="left:62%"></u></div><span class="db mono">−3.2</span></div><div class="pan"><i style="left:50%;width:14%"></i></div></div>`;+ const routing = large ? `<div class="r2"><span class="combo">All ins · Ch 1</span></div>` : '';+ const r2 = large+ ? `<div class="r2" style="justify-content:flex-end"><span class="chip">M</span><span class="chip s">S</span><span class="chip">●</span></div>`+ : `<div class="r2"><span class="combo">All ins · Ch 1</span><span class="chip">M</span><span class="chip">S</span><span class="chip">●</span></div>`;+ return `<div class="card${sel ? ' sel' : ''}" style="width:${w}px;height:${h}px">+ <div class="spine" style="background:${sel ? css('Accent') : color}"></div>+ <div class="body"><div class="stack">+ <div class="name"><b>${name}</b><span class="tag">${tag}</span></div>+ ${r2}${routing}${volRow}${sends ? sendRow(sends, sendOpts) : ''}+ </div><div class="meter"><i style="height:${meter * 100}%"></i></div></div></div>`;+}+const shots = [+ { cap: 'Standard row at 88 px · two returns · bus A in the hand', html: strip(228, true) + card({ h: 88, name: 'Lead vocal', tag: 'AUDIO', color: '#5FB3A8', sends: [0.42, 0.18], sendOpts: { hot: 0 } }) + card({ h: 64, name: 'Bass', color: '#6A9FD8' }) },+ { cap: 'Large row (128) · four returns · selected', html: strip(228, true) + card({ h: 128, name: 'Pad', large: true, sel: true, sends: [0.25, 0, 0.6, 0.1] }) },+ { cap: 'Large row · Sends toggle off (layout as today)', html: strip(228, false) + card({ h: 128, name: 'Pad', large: true, volPanShared: false }) },+ { cap: 'Narrowest column (160) · four returns · knobs only', html: strip(160, true) + card({ w: 160, h: 88, name: 'Drums', color: '#E0A84A', sends: [0.3, 0.05, 0, 0.7], sendOpts: { knobsOnly: true } })+ + `<div style="position:relative;height:26px"><div class="tip" style="left:22px;top:3px">Send B · Delay · 5 %</div></div>` },+];+document.getElementById('shots').innerHTML = shots.map(s => `<div class="shot"><div class="cap">${s.cap}</div><div class="col">${s.html}</div></div>`).join('');+</script>+</body>+</html>diff --git a/specs/072-arrangement-track-sends/plan.md b/specs/072-arrangement-track-sends/plan.mdnew file mode 100644index 00000000..bfc4fb61--- /dev/null+++ b/specs/072-arrangement-track-sends/plan.md@@ -0,0 +1,146 @@+# Implementation Plan: Send levels in the arrangement track headers++**Branch**: `feat/arrangement-track-sends` | **Date**: 2026-11-02 | **Spec**: [spec.md](spec.md)++**Input**: Feature specification from `specs/072-arrangement-track-sends/spec.md` (issue nota-daw/nota#143)++## Summary++Put one inline send knob per return in the arrangement track header, and make sends a+first-class mix value everywhere: undoable through the value-gesture mechanism (specs/009)+and automatable through a new track automation target. The engine gains `MixKind::TrackSend`+(value undo, bus in `deviceIndex`) and `AutomationTarget::Send` (lane per bus, played back by+writing the existing atomic send level at block rate). Return deletion remaps send lanes the+same way it remaps send levels. The managed side gains `MixTarget.Send` /+`AutomationTarget.Send`, routes every send control (header, Mixer window, Session mixer,+Sends card, MCP `set_send`) through a gesture + automation write, adds "Send A · <return>"+entries to the lane target menu, and draws the send row in standard (≥ 88 px) and large+headers behind a per-project "Sends" toggle. Visual design: [mockup.html](mockup.html) (rendered in the PR).++## Nota: Read Before Planning++Consulted: `ARCHITECTURE.md` (AR-4/5/6/7), `DESIGN.md` + `nota-design` (inline knob,+accent only while live, sentence-case labels, mono read-outs), `CONTRIBUTING.md`.++## Technical Context++**Language/Version**: C++20 (engine), C# / .NET 10 (managed app, Avalonia UI)++**Primary Dependencies**: Avalonia (existing). No new dependency.++**Storage**: project file — automation lanes are already saved generically (target ++device index + points), so a send lane round-trips with no format change; the Sends toggle+rides in the existing `track-view.json` sidecar (`showSends`, omitted when default).++**Audio-Thread Impact**: send automation is applied in `applyAutomation` (already on the+audio thread, block rate) by storing the track's existing `std::atomic<float>` send level —+the same pattern as volume/pan. No allocation, no lock, no new command. Lane add/remove and+return compaction stay structural edits that publish a new graph (AR-5) on the message+thread. Value undo stays message-thread only.++**Testing**: `tests/Nota.SmokeTest` — new `SendAutomationTests` (`--sends`): send gesture+undo/redo + no-change, MCP `set_send` one step, send lane playback moves the send level,+record-write creates a lane and undoes with the value, save/load keeps the lane on its bus,+deleting a return drops/remaps send lanes and undo restores them. Design token checks+(`RunStudio`, `RunLabels`, …) cover the new UI. UI verified by screenshots of the real app.++**Target Platform**: macOS, Windows, Linux desktop.++**Project Type**: desktop app (native engine + managed UI).++**Performance Goals**: header rebuild cost unchanged in order (≤ 4 extra knobs per card);+the live-follow refresher reads sends on the existing meter tick, skipping knobs in the hand.++**Constraints**: header widths 160–480 px, four returns max (`kMaxReturns`).++**Scale/Scope**: ~5 engine files + ABI header, ~9 managed files, 1 smoke-test file.++## Constitution Check++| Principle | Status |+|---|---|+| 0 Approved issue | #143 carries `approved` |+| I Real-time safety | Pass — atomic store from the existing automation pass; structural edits on the message thread |+| II Boundary | Pass — one new `NOTA_MIX_TRACK_SEND` kind and target value 5 documented in `nota_engine.h`; no new functions |+| III Licensing | Pass — new files carry the SPDX header; no dependency |+| IV Verification | Smoke test extended (`SendAutomationTests`) |+| V One change | One feature: sends from the arrangement, with the undo/automation it needs |+| VI Docs | CHANGELOG `[Unreleased]`, FEATURES.md (nota-features), user docs (nota-docs) |+| VII Spec-first | This spec / plan / tasks |+| VIII | No rule bent |++Post-design re-check: unchanged — pass.++## Design++### Engine (`src/native/nota.engine`)++- `EngineTypes.h`: `MixKind::TrackSend = 8` (7 stays internal `DeviceNotes`); `deviceIndex` = bus.+- `Engine.cpp` `mixValue` / `applyMix`: read / write `Track::send(bus)`; a bus outside+ `0..kMaxReturns-1` or a missing track → no value / skip.+- `nota_engine_core.cpp` `nota_mix_gesture_begin`: accept `NOTA_MIX_TRACK_SEND` (8) besides 0–6.+- `Automation.h`: `AutomationTarget::Send = 5` (`deviceIndex` = bus, `paramIndex` −1).+- `Engine_Automation.cpp`: `applyAutomation` → `t.setSend(bus, clamp(v, 0, 1))`;+ `currentTargetValue`, `sameTarget` and `findLaneFor` match Send by bus;+ `addAutomationLane` keeps the bus for Send (one lane per bus).+- `Engine_Tracks.cpp`: the "automation follows across tracks" filters treat Send like+ Volume/Pan (track-mix lanes); `compactReturns` drops Send lanes to a deleted bus and+ renumbers the rest along with the send levels (cloning the track when lanes change).+- `nota_engine.h`: document target 5 and `NOTA_MIX_TRACK_SEND`; drop "sends" from the+ "not covered by undo" sentence.++### Managed++- `EngineContracts.cs`: `AutomationTarget.Send = 5`; `MixKind.TrackSend = 8`;+ `MixTarget.Send(trackId, bus)`.+- `Nota.App/SendControl.cs` (new): one helper that wires any send control (knob or mini+ fader) — `MixGesture(MixTarget.Send)` + `Begin/EndAutomationWrite(Send, bus)` + value+ changes through the gesture — so header, Mixer window, Session mixer and Sends card+ behave alike.+- `ArrangementView.cs` `BuildTrackCard`: send row (`BuildSendRow`) for non-return cards when+ the project has returns, the toggle is on and the row is tall enough; large tier with+ sends puts volume and pan on one row; narrow cells fall back to knob-only. Live-follow in+ the existing refresher (skip `Dragging`). Top strip: "Sends" toggle chip, hidden without+ returns.+- `ArrangementView.Sizing.cs`: `showSends` in `TrackViewDto`; `SendsRowMinStandard = 88`.+- `ArrangementView.Automation.cs`: label / range (0..1) / current value / quick-access key /+ menu entries / `FirstAutomatedTarget` for Send; "Send A · <return>".+- `MixerView.cs`, `SessionView.Mixer.cs`, `DeviceChainView.cs`: send controls via `SendControl`.+- `Nota.Mcp/Tools/TrackTools.cs` `SetSend`: `MixEdit.Step(… MixTarget.Send)`;+ `AutomationTools.cs`: "send" target name (bus in `device_index`).+- Localization: new strings in the language tables the localization check requires.++## Project Structure++### Documentation (this feature)++```text+specs/072-arrangement-track-sends/+├── spec.md · plan.md · research.md · data-model.md · quickstart.md · tasks.md+├── contracts/abi.md+├── mockup.html+└── checklists/requirements.md+```++### Source Code (repository root)++```text+src/native/nota.engine/+├── include/nota/nota_engine.h # NOTA_MIX_TRACK_SEND, target 5 docs+└── src/+ ├── abi/nota_engine_core.cpp # accept the new mix kind+ └── engine/{EngineTypes.h, Engine.cpp, Automation.h, Engine_Automation.cpp, Engine_Tracks.cpp}+src/managed/+├── Nota.Application/Engine/EngineContracts.cs+├── Nota.App/{SendControl.cs (new), ArrangementView.cs, ArrangementView.Sizing.cs,+│ ArrangementView.Automation.cs, MixerView.cs, SessionView.Mixer.cs, DeviceChainView.cs}+└── Nota.Mcp/Tools/{TrackTools.cs, AutomationTools.cs}+tests/Nota.SmokeTest/{SendAutomationTests.cs (new), Program.cs}+CHANGELOG.md · FEATURES.md+```++**Structure Decision**: the existing engine / managed split; no new projects.++## Complexity Tracking++None.diff --git a/specs/072-arrangement-track-sends/quickstart.md b/specs/072-arrangement-track-sends/quickstart.mdnew file mode 100644index 00000000..d00dfbe7--- /dev/null+++ b/specs/072-arrangement-track-sends/quickstart.md@@ -0,0 +1,30 @@+# Quickstart: validate sends in the arrangement track headers++## Automated++```bash+scripts/build.sh # full build + smoke test+dotnet run --project tests/Nota.SmokeTest -- --sends # this feature's checks alone+```++Expected: `SENDS PASSED` — send undo/redo and no-change, MCP `set_send` one step, send+lane playback, record-write + undo, save/load, return delete remaps lanes, and the design+token checks in the full run.++## Manual (the app)++1. New project, add two return tracks (A Reverb, B Delay) and an instrument track; resize+ the instrument row to Large. The header shows knobs A and B under volume|pan.+2. Drag A to ~40 %: the Mixer window's A fader, the Session mixer and the Sends card show+ 40 %. Undo → 0 %; Redo → 40 %.+3. Toggle **Sends** in the header column's top strip off → the knob row disappears; the+ large header is back to its usual layout. On again. Set the row to Standard (64) → no+ sends; drag it to ~90 px → sends appear.+4. Automation mode → target menu → "Send A · Reverb"; draw a ramp; play → knob A turns.+5. Record on, play, move knob B → a "Send B · Delay" lane appears with the movement; one+ Undo removes the movement and the lane.+6. Save, reopen → lanes, levels and the toggle state are back.+7. Delete return A → lane B now reads "Send A · Delay" and still drives the delay; Undo+ restores the reverb return, its lane and the send levels.+8. Narrow the header column to its minimum with four returns → knobs only, tooltips name+ return and level.diff --git a/specs/072-arrangement-track-sends/research.md b/specs/072-arrangement-track-sends/research.mdnew file mode 100644index 00000000..268e94f2--- /dev/null+++ b/specs/072-arrangement-track-sends/research.md@@ -0,0 +1,55 @@+# Research: Send levels in the arrangement track headers++## R1 — How do sends become undoable?++- **Decision**: a new value-undo kind `MixKind::TrackSend` (ABI `NOTA_MIX_TRACK_SEND = 8`,+ bus in `device_index`), used through the existing gesture API (`nota_mix_gesture_begin/end`).+- **Rationale**: send levels are atomics outside the graph, exactly like volume/pan; a+ graph snapshot would not restore them. The gesture mechanism already gives one step per+ drag, no step for a no-change gesture, merging with automation-record checkpoints and+ skipping a step whose track is gone (specs/009).+- **Alternatives**: a structural snapshot per send change (wrong — atomics aren't in it, and+ a snapshot per drag tick bloats history); value 7 (taken by the internal `DeviceNotes`).++## R2 — How do sends become automatable?++- **Decision**: `AutomationTarget::Send = 5`, one lane per bus (`deviceIndex` = bus), played+ in `applyAutomation` by `Track::setSend`.+- **Rationale**: mirrors Volume/Pan (track-mix values written from the block-rate automation+ pass), so touch / latch / override / record and persistence work through the existing+ code paths with small switches. Lane storage already carries `deviceIndex`, and the+ project file saves target + device index generically, so no format bump is needed.+- **Alternatives**: four fixed targets Send A–D (5–8): clutters the enum and every switch;+ routing a send through a hidden utility device param: indirect, and breaks the Mixer sync.++## R3 — What happens to send lanes when a return is deleted?++- **Decision**: extend `compactReturns`: lanes to the deleted bus are dropped, lanes to later+ buses take the new bus index — in the same cloned track that remaps the send levels.+- **Rationale**: keeps a lane on the return it was drawn for; the delete is already one+ structural step, so undo restores lanes and levels together.++## R4 — Do send lanes follow clips moved across tracks?++- **Decision**: yes, like Volume/Pan (they are track-mix lanes, not tied to a device).++## R5 — Header layout and size++- **Decision**: a 24 px row of inline knobs (`Knob { Inline = true }`), each cell knob ++ letter over a mono percent; cells fall back to knob only when the column is too narrow.+ Standard rows show it from 88 px; large rows always (volume and pan then share a row so+ the 128 px preset fits); compact never. A per-project "Sends" toggle (default on) in the+ header column's top strip, hidden without returns, saved in `track-view.json`.+- **Rationale**: the inline knob is the design system's table-row knob; four mini faders+ don't fit 160 px with labels. Height thresholds follow the specs/015 tier logic (a+ layout shows when it fits). View state belongs in the sidecar with row heights.+- **Alternatives**: a Preferences option (rejected — row heights are per project, so is+ this); auto-growing rows when sends are on (rejected — changes the user's layout).++## R6 — One wiring for every send control++- **Decision**: a small `SendControl` helper (gesture + automation write + live follow+ guard) used by the header, Mixer window, Session mixer and Sends card; MCP `set_send` uses+ `MixEdit.Step`.+- **Rationale**: the spec requires the same undo/automation behaviour from every surface;+ one helper keeps them from drifting.diff --git a/specs/072-arrangement-track-sends/spec.md b/specs/072-arrangement-track-sends/spec.mdnew file mode 100644index 00000000..9f75d69e--- /dev/null+++ b/specs/072-arrangement-track-sends/spec.md@@ -0,0 +1,259 @@+# Feature Specification: Send levels in the arrangement track headers++**Feature Branch**: `feat/arrangement-track-sends`++**Created**: 2026-11-02++**Status**: Draft++**Input**: User description: "Issue nota-daw/nota#143 — Arrangement: edit send levels from the track headers. Set how much of a track goes to the return tracks while working in the Arrangement, without switching to Session / Mixer or opening the Devices panel. Send controls (small knobs or faders, one per return) in the arrangement track header, shown when the header is tall enough or via a toggle, like the volume/pan controls there. Undoable, automatable, kept in sync with the Mixer and the Sends card."++## Nota Context *(fill in — drives plan and tasks)*++**Feature area** *(pick the main one)*:++- [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.Presentation`) — follow `DESIGN.md` (Studio)+- [ ] Plugin hosting (`pluginhost/`) — the only place JUCE is allowed+- [ ] Build / packaging / CI (`scripts/`, `.github/`) — see `BUILD.md`+- [ ] Docs only++**Nota docs to keep in mind** *(links relative to `specs/<slug>/`, where this file lands)*:+[`ARCHITECTURE.md`](../../ARCHITECTURE.md) (AR rules),+[`CONTRIBUTING.md`](../../CONTRIBUTING.md) (licensing, dependency policy, PR+expectations), [`BUILD.md`](../../BUILD.md), [`DESIGN.md`](../../DESIGN.md),+[`FEATURES.md`](../../FEATURES.md).++**Existing behaviour this builds on**: a track can send post-fader to up to four return+buses (A–D). Send levels are set today in the Mixer window (A/B mini faders), the Session+view's mixer rows and the Devices panel's Sends card; all three follow one another (#138).+Send moves are **not** undoable and sends **cannot** be automated: the value-undo gestures+(specs/009, 016) cover volume, pan, master volume and device parameters only, and+automation lanes target volume, pan and device / plug-in parameters only. The arrangement+track header lays itself out by row height (specs/015): compact (one line), standard+(name · routing + M/S/arm · volume + pan) and large (a row each, pan on its own row).++## Clarifications++### Session 2026-11-02++*(Autonomous run: the user asked for no involvement; each answer is the recommended option.)*++- Q: How tall must a standard-height row be before it shows its send row? → A: 88 px or more (the standard layout's three rows plus one 24 px knob row); large rows always show it.+- Q: How does a send automation lane name itself in the lane header and target menu? → A: "Send A · <return name>" (bus letter, then the return's name); the target menu groups the sends after Pan.+- Q: Do sends gain MIDI-learn / Remote control as part of this change? → A: No — out of scope; the header knobs only follow such changes if another surface already makes them.++## User Scenarios & Testing *(mandatory)*++### User Story 1 - Set send levels from the track header (Priority: P1)++A producer arranging a song wants a bit more reverb on the vocal during the chorus. They+stay in the Arrangement: the vocal's header shows one small knob per return track (A, B,+…), they drag the "A" knob up, and the vocal goes to the reverb return. The Mixer window,+the Session mixer and the Sends card show the new level at once.++**Why this priority**: it is the request — edit sends without leaving the Arrangement.++**Independent Test**: a project with two returns and an instrument track at the large+height; drag the header's A knob, check the return's meter moves and the Mixer / Sends+card show the same level.++**Acceptance Scenarios**:++1. **Given** a project with returns and a track row tall enough for sends, **When** the+ user looks at its header, **Then** it shows one send knob per return, in bus order,+ each labelled with the bus letter and named by its return on hover.+2. **Given** a send knob, **When** the user drags it or types a value into it (the+ value-entry box, like the header's volume), **Then** the track's send to+ that return changes and the audio follows while dragging.+3. **Given** a send knob, **When** the user double-clicks it, **Then** the+ send resets to off (0 %).+4. **Given** a send changed in the header, **When** the user looks at the Mixer window,+ the Session mixer or the Devices panel's Sends card, **Then** they show the same level;+ and a change made there shows in the header within a refresh tick.+5. **Given** a return is added, deleted or renamed, **When** the headers redraw, **Then**+ the knobs match the returns that exist (a deleted return's knob goes and the later ones+ move down with their buses).++---++### User Story 2 - Undo a send change (Priority: P1)++The user overdoes the reverb send and presses Undo: the send returns to its old level.+Redo puts it back. One drag is one undo step.++**Why this priority**: the issue asks for it, and every other mix control in the header+already undoes; a header control that doesn't would surprise.++**Independent Test**: drag a send knob from 0 % to 60 %, Undo → 0 %, Redo → 60 %; the+History lists one step for the drag.++**Acceptance Scenarios**:++1. **Given** a send knob dragged from one value to another, **When** the user undoes,+ **Then** the send goes back to the value before the drag, in one step; redo reapplies it.+2. **Given** a send changed from the Mixer window, the Session mixer or the Sends card,+ **When** the user undoes, **Then** that change undoes too (all send controls share the+ same undo behaviour).+3. **Given** a drag that ends where it started, **When** it ends, **Then** no undo step+ is added.+4. **Given** a send undo step whose track was since deleted, **When** it is undone,+ **Then** it is skipped quietly, like a volume step.++---++### User Story 3 - Automate a send (Priority: P2)++The user wants the delay send to open only on the last word of each verse. They pick+"Send A" in the track's automation lane, draw a ramp, and on playback the send — and the+header knob, the Mixer and the Sends card — follow the lane. They can also record it: with+automation record on, moving the knob while playing writes the lane, as volume and pan do.++**Why this priority**: the issue asks for automatable sends; drawing comes with the lane+target, recording comes with the header control.++**Independent Test**: choose Send A in a track's automation lane, draw 0 → 100 % over two+bars, play; the return's level rises and the header knob turns with it. Save, reopen: the+lane is still there.++**Acceptance Scenarios**:++1. **Given** a track with returns, **When** the user opens its automation target menu,+ **Then** it offers one "Send" entry per return (named by bus letter and return name)+ next to Volume and Pan.+2. **Given** a send lane with points, **When** the transport plays, **Then** the send+ follows the lane and every send control shows the played value.+3. **Given** automation record on and the transport playing, **When** the user moves a+ send control, **Then** the send's lane is written (created if missing) and the write+ and the value undo as one step, as with volume.+4. **Given** automation record off and a send lane with points, **When** the user moves+ the send control, **Then** the hand overrides the lane until automation is re-enabled,+ as with volume.+5. **Given** a project with send automation, **When** it is saved and reopened, **Then**+ the lanes come back on the same buses.+6. **Given** a return with send lanes pointing at it is deleted, **When** the buses+ compact, **Then** lanes to the deleted bus go and lanes to later buses follow their bus;+ undo brings the return and its lanes back.++---++### User Story 4 - Choose when the sends show (Priority: P3)++The user wants tall headers without sends (or the opposite: sends on standard-height rows).+A "Sends" toggle in the header column's top strip shows or hides the send row on every+track header; with it on, a row shows its sends once it is tall enough for them.++**Why this priority**: keeps the headers uncluttered for those who don't use returns from+the Arrangement; secondary to the controls themselves.++**Independent Test**: toggle Sends off — the knob rows disappear from every header; on —+they come back on rows tall enough; the choice is still there after reopening the project.++**Acceptance Scenarios**:++1. **Given** a project with returns, **When** the user looks at the header column's top+ strip, **Then** a "Sends" toggle sits there, on by default; with no returns it is hidden.+2. **Given** the toggle on, **When** a track row is large, **Then** its header shows the+ send row; **when** a row is standard but at least as tall as the send row needs,+ **Then** it shows the send row too; **when** a row is shorter (or compact), **Then** it+ shows no send row.+3. **Given** the toggle off, **When** any header is drawn, **Then** no send row shows and+ the headers look exactly as before this feature.+4. **Given** the toggle changed, **When** the project is saved and reopened, **Then** the+ toggle keeps its state (it is arrangement view state, like row heights).++### Edge Cases++- No return tracks: no send row, no toggle, no Send entries in the automation menu.+- Return tracks themselves and the master have no sends: their footer rows are unchanged.+- Group tracks send like any track (the Mixer shows their sends): their full header card+ gets the send row; the slim collapsed group bar does not.+- Four returns in a narrow header column (minimum 160 px): the knobs still fit on one row+ (the read-out moves to the hover / value-entry box).+- A frozen track: sends still work (sends run after the frozen audio), as in the Mixer.+- Moving clips between tracks with "automation follows" moves send automation like+ volume/pan automation (track-mix lanes, not device lanes).+- Reordering or removing devices never touches send lanes.+- MIDI-learn and Remote control of sends are out of scope; any send change from+ another surface is reflected in the header knob (FR-003).++## Requirements *(mandatory)*++### Functional Requirements++- **FR-001**: The arrangement track header MUST show a send row — one knob per existing+ return, in bus order, labelled A–D — on audio, instrument and group track cards when+ the project has returns, the Sends toggle is on, and the row is tall enough (FR-007).+- **FR-002**: Each send knob MUST set the post-fader send level 0–100 % by drag or typed+ value entry (⌥-click), and reset to 0 % by double-click; a mono read-out beside it MUST+ show the level (whole percent, "–" when off) where the column has room, and its tooltip+ MUST name the return and show the level.+- **FR-003**: Send knobs MUST follow changes made anywhere else (Mixer window, Session+ mixer, Sends card, automation playback, Remote, MIDI mapping) within one UI refresh tick,+ and those surfaces MUST follow the header.+- **FR-004**: A send change made through any send control (header, Mixer window, Session+ mixer, Sends card) MUST be one undo step per gesture, restoring the previous level on+ undo and the new one on redo; a gesture that changes nothing MUST add no step.+- **FR-005**: The engine MUST support a send automation target per return bus: lanes can+ be added, drawn, played back, recorded from the send controls (touch / override /+ record, as for volume), saved and reloaded.+- **FR-006**: The track's automation target menu MUST offer one Send entry per return,+ after Pan, named "Send A · <return name>"; the lane header shows the same name.+- **FR-007**: The send row MUST show on large rows and on standard rows 88 px or taller+ (tall enough to hold it without clipping the other controls); never on compact rows. On a large row with+ sends, volume and pan MAY share one row (as on a standard row) to make room.+- **FR-008**: A "Sends" toggle in the header column's top strip MUST show/hide every+ header's send row; on by default; hidden when there are no returns; saved with the+ project's arrangement view state.+- **FR-009**: Deleting a return MUST drop send lanes to it and renumber lanes to later+ buses together with the send levels; undo MUST restore both.+- **FR-010**: Moving clips across tracks with their automation MUST carry send lanes the+ way it carries volume and pan lanes.+- **FR-011**: The audio thread MUST stay allocation- and lock-free: send automation+ writes the existing per-bus send level, as volume automation writes the volume.++### Key Entities++- **Send level**: a track's post-fader level into one return bus (0 … 1), already part of+ the track's mix state and the project file.+- **Send automation lane**: a track automation lane whose target is "send to bus N";+ points in the send's units (0 … 1).+- **Sends toggle**: arrangement view state (per project, beside row heights), not undoable.++## Success Criteria *(mandatory)*++### Measurable Outcomes++- **SC-001**: A send level can be changed from the Arrangement in one gesture, without+ opening another view or panel.+- **SC-002**: 100 % of send changes made through any send control undo and redo in one+ step each.+- **SC-003**: A drawn send lane is audible and visible (knob moves) on playback, and+ survives save / reopen with no loss.+- **SC-004**: With the Sends toggle off (or no returns), the arrangement headers are+ pixel-identical to the previous release.+- **SC-005**: The engine smoke test covers send undo, send automation playback and+ return-delete lane remapping, and passes on every platform build.++## Assumptions++- Knobs, not faders: four mini faders don't fit a 160 px column beside their labels;+ inline knobs match the Sends card.+- A send's value-undo uses the same gesture mechanism as volume/pan (specs/009), so+ the Mixer window, Session mixer and Sends card gain undo by switching to it.+- Mute, solo and bypass stay outside value undo (unchanged).+- The Session view, Mixer window and Sends card layouts are unchanged; only their send+ controls gain undo and automation recording.+- MCP / Remote surfaces gain the new automation target name ("send") where they list+ targets; no new Remote UI.++## Nota Compliance Checklist *(review before implementation; re-check in tasks.md)*++- [x] Every new source file will carry the AGPL-3.0-only SPDX header (two lines, see CONTRIBUTING.md)+- [x] No new dependency — or: license checked, AGPL-compatible, `LICENSES/third-party.md` row planned+- [x] Audio-thread impact considered: no alloc / lock / I/O on the audio thread (AR-6), command queue for data in (AR-4), immutable snapshots for structural edits (AR-5)+- [x] Managed/native crossings go through the pure C ABI in `nota_engine.h` only (AR-7); no JUCE outside `pluginhost/`+- [x] Smoke-test impact assessed: engine behaviour change → extend `tests/Nota.SmokeTest`+- [x] User-visible change → `CHANGELOG.md` `[Unreleased]` entry planned (and FEATURES.md / user docs via the nota-features / nota-docs skills when working with an agent that has them)+- [x] UI change → follows `DESIGN.md` (Studio design language)diff --git a/specs/072-arrangement-track-sends/tasks.md b/specs/072-arrangement-track-sends/tasks.mdnew file mode 100644index 00000000..dedc6322--- /dev/null+++ b/specs/072-arrangement-track-sends/tasks.md@@ -0,0 +1,58 @@+# Tasks: Send levels in the arrangement track headers++**Input**: [spec.md](spec.md), [plan.md](plan.md), [research.md](research.md),+[data-model.md](data-model.md), [contracts/abi.md](contracts/abi.md)++## Phase 1: Foundational — engine + contracts (blocks every story)++- [x] T001 `MixKind::TrackSend = 8` in `src/native/nota.engine/src/engine/EngineTypes.h`; `mixValue` / `applyMix` for it in `src/native/nota.engine/src/engine/Engine.cpp`+- [x] T002 Accept `NOTA_MIX_TRACK_SEND` in `nota_mix_gesture_begin` (`src/native/nota.engine/src/abi/nota_engine_core.cpp`); define and document it and target 5 in `include/nota/nota_engine.h`+- [x] T003 `AutomationTarget::Send = 5` in `src/native/nota.engine/src/engine/Automation.h`; apply / current value / `sameTarget` / `findLaneFor` / `addAutomationLane` in `Engine_Automation.cpp`+- [x] T004 Send lanes follow cross-track moves like Volume/Pan, and `compactReturns` drops / renumbers send lanes, in `src/native/nota.engine/src/engine/Engine_Tracks.cpp`+- [x] T005 [P] `AutomationTarget.Send`, `MixKind.TrackSend`, `MixTarget.Send(trackId, bus)` in `src/managed/Nota.Application/Engine/EngineContracts.cs`+- [x] T006 Smoke test `tests/Nota.SmokeTest/SendAutomationTests.cs` (+ `--sends` and the full run in `Program.cs`): gesture undo/redo + no-change, lane playback, record-write undo, save/load, return-delete remap + undo++## Phase 2: User Story 1 + 2 — send knobs in the header, undoable (P1)++- [x] T007 [US1] `src/managed/Nota.App/SendControl.cs`: wire a send control — gesture (`MixTarget.Send`), automation write, value change+- [x] T008 [US1] Send row in `BuildTrackCard` (standard ≥ 88 px, large with volume|pan shared; knob-only when narrow; tooltip "Send A · <return> · n %"; value entry; reset to 0) and live follow, in `src/managed/Nota.App/ArrangementView.cs`+- [x] T009 [US2] Mixer window, Session mixer and Sends card send controls through `SendControl` in `MixerView.cs`, `SessionView.Mixer.cs`, `DeviceChainView.cs`+- [x] T010 [P] [US2] MCP `set_send` as one undo step in `src/managed/Nota.Mcp/Tools/TrackTools.cs`++## Phase 3: User Story 3 — automate a send (P2)++- [x] T011 [US3] Send targets in the lane menu, quick-access, label "Send A · <return>", range 0..1, current value, first-automated target in `src/managed/Nota.App/ArrangementView.Automation.cs` (and any value-text helper the lane uses)+- [x] T012 [P] [US3] "send" target name in `src/managed/Nota.Mcp/Tools/AutomationTools.cs`++## Phase 4: User Story 4 — Sends toggle (P3)++- [x] T013 [US4] "Sends" toggle chip in the header column's top strip (hidden without returns), rebuilding the headers, in `src/managed/Nota.App/ArrangementView.cs`+- [x] T014 [US4] `showSends` in the `track-view.json` sidecar in `src/managed/Nota.App/ArrangementView.Sizing.cs`++## Phase 5: Polish++- [x] T015 Localization strings for the new labels (the tables the localization check reads)+- [x] T016 CHANGELOG `[Unreleased]` entry; FEATURES.md via nota-features; user manual (nota-docs, EN + RU) as a follow-up in that repo+- [x] T017 `scripts/build.sh` green (native + managed + smoke test incl. design-token checks)+- [x] T018 Real-app screenshots (standard 88, large, toggle off, narrow) for the PR via the headless harness++## Dependencies++T001–T005 before everything; T006 after T001–T004. T007 before T008/T009. T011 needs T003/T005.+US1/US2 is the MVP. T013 depends on T008.++## Nota Compliance (re-check)++- [x] SPDX header on `SendControl.cs` and `SendAutomationTests.cs`+- [x] No allocation / lock on the audio thread (send automation = atomic store in the existing pass)+- [x] ABI additions documented in `nota_engine.h` and covered by the smoke test+- [x] Studio design: inline knob, VizInk at rest, accent only live, sentence case, mono values++## Phase 6: Convergence++- [x] T019 Show the return's name in a send lane's header label ("Send A · Reverb", trimmed to fit) in `src/managed/Nota.App/ArrangementView.Automation.cs` per FR-006 (partial)+- [x] T020 Keep a track's shown send-lane target on its bus when a return is deleted (renumber with the engine, fall back to Volume when its bus went) in `src/managed/Nota.App/ArrangementView.Automation.cs` per US3/AC6 (partial)+- [x] T021 Re-run the timing-sensitive smoke checks (Consort stress, render pool) on an idle machine and confirm they pass per T017 / Constitution IV (partial)+ - 2026-11-03: the machine stayed loaded (load avg ~45, Rider + another Nota). Under the same load the+ base checkout's smoke test fails the same timing checks and more (6 vs 4); every functional check+ passes. CI on the PR is the clean-machine run.diff --git a/src/managed/Nota.App/ArrangementView.Automation.cs b/src/managed/Nota.App/ArrangementView.Automation.csindex 09aa618b..797236c2 100644--- a/src/managed/Nota.App/ArrangementView.Automation.cs+++ b/src/managed/Nota.App/ArrangementView.Automation.cs@@ -27,6 +27,7 @@ public sealed partial class ArrangementView{AutomationTarget.Volume => Loc.T("Vol"),AutomationTarget.Pan => Loc.T("Pan"),+ AutomationTarget.Send => Loc.F("Send {0} · {1}", SendLetter(t.AutoDeviceIndex), Short(SendBusName(t.AutoDeviceIndex))),AutomationTarget.PluginParam => _engine is { } e? Short(e.PluginParamName(t.Id, t.AutoDeviceIndex, ResolvePluginParamIndex(t))) : Loc.T("Param"),AutomationTarget.MidiDeviceParam => _engine is { } e@@ -41,6 +42,7 @@ public sealed partial class ArrangementView{AutomationTarget.Volume => (0f, 2f),AutomationTarget.Pan => (-1f, 1f),+ AutomationTarget.Send => (0f, 1f),AutomationTarget.PluginParam => (0f, 1f), // normalizedAutomationTarget.MidiDeviceParam => _engine is { } e? (e.MidiEffectParamMin(t.Id, t.AutoDeviceIndex, t.AutoParamIndex),@@ -57,6 +59,7 @@ public sealed partial class ArrangementView{AutomationTarget.Volume => t.Volume,AutomationTarget.Pan => t.Pan,+ AutomationTarget.Send => _engine is { } es ? es.GetTrackSend(t.Id, t.AutoDeviceIndex) : 0f,AutomationTarget.PluginParam => _engine is { } e ? e.PluginParamGet(t.Id, t.AutoDeviceIndex, ResolvePluginParamIndex(t)) : 0f,AutomationTarget.MidiDeviceParam => _engine is { } e ? e.MidiEffectGetParam(t.Id, t.AutoDeviceIndex, t.AutoParamIndex) : 0f,_ => _engine is { } e ? e.DeviceGetParam(t.Id, t.AutoDeviceIndex, t.AutoParamIndex) : 0f,@@ -92,6 +95,7 @@ public sealed partial class ArrangementViewinfo.DeviceIndex == t.AutoDeviceIndex && info.ParamIndex == t.AutoParamIndex,AutomationTarget.PluginParam => info.DeviceIndex == t.AutoDeviceIndex&& e.AutomationLaneParamId(t.Id, i) == t.AutoParamId,+ AutomationTarget.Send => info.DeviceIndex == t.AutoDeviceIndex, // one lane per bus_ => true,};if (match) return i;@@ -121,6 +125,7 @@ public sealed partial class ArrangementView{AutomationTarget.DeviceParam or AutomationTarget.MidiDeviceParam => t.AutoDeviceIndex == dev && t.AutoParamIndex == param,AutomationTarget.PluginParam => t.AutoDeviceIndex == dev && t.AutoParamId == (paramId ?? ""),+ AutomationTarget.Send => t.AutoDeviceIndex == dev,_ => true,};if (same) return;@@ -131,11 +136,12 @@ public sealed partial class ArrangementViewinternal void SetAutoTarget(TrackVM t, AutomationTarget target, int dev, int param){t.AutoTarget = target;- t.AutoDeviceIndex = target is AutomationTarget.DeviceParam or AutomationTarget.PluginParam or AutomationTarget.MidiDeviceParam ? dev : -1;+ t.AutoDeviceIndex = target is AutomationTarget.DeviceParam or AutomationTarget.PluginParam or AutomationTarget.MidiDeviceParam or AutomationTarget.Send ? dev : -1;t.AutoParamIndex = target is AutomationTarget.DeviceParam or AutomationTarget.MidiDeviceParam ? param : -1;t.AutoParamId = "";t.AutoChain = t.AutoSlot = t.AutoLane = -1;_autoTargets[t.Id] = (t.AutoTarget, t.AutoDeviceIndex, t.AutoParamIndex, t.AutoParamId, -1, -1, -1);+ NoteSendTarget(t);t.AutoLabel = AutoLabelFor(t);if (ReferenceEquals(_autoSelTrack, t)) _autoSelTrack = null; // selection was for the old laneLoadAutoPoints(t);@@ -165,7 +171,7 @@ public sealed partial class ArrangementView/// <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();+ public void ForgetAutoTargets() { _autoTargets.Clear(); _autoSendReturn.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@@ -404,6 +410,9 @@ public sealed partial class ArrangementViewkey = "V"; apply = () => SetAutoTarget(t, AutomationTarget.Volume, -1, -1); break;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; }case AutomationTarget.PluginParam:{ string pid = eA.AutomationLaneParamId(t.Id, i); int dv = info.DeviceIndex;key = $"P:{dv}:{pid}"; apply = () => SetAutoPluginTarget(t, dv, pid); break; }@@ -428,6 +437,11 @@ public sealed partial class ArrangementViewflyout.Items.Add(Leaf(Loc.T("Volume"), "V", () => SetAutoTarget(t, AutomationTarget.Volume, -1, -1), automated));flyout.Items.Add(Leaf(Loc.T("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("Send {0} · {1}", 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@@ -656,6 +670,7 @@ public sealed partial class ArrangementView{AutomationTarget.Volume => Loc.T("Volume"),AutomationTarget.Pan => Loc.T("Pan"),+ AutomationTarget.Send => Loc.F("Send {0} · {1}", SendLetter(info.DeviceIndex), SendBusName(info.DeviceIndex)),AutomationTarget.MidiDeviceParam => $"{e.MidiEffectName(t.Id, info.DeviceIndex)} · {e.MidiEffectParamName(t.Id, info.DeviceIndex, info.ParamIndex)}",AutomationTarget.PluginParam => $"{e.DeviceName(t.Id, info.DeviceIndex)} · {PluginParamNameById(e, t, info.DeviceIndex, e.AutomationLaneParamId(t.Id, laneIndex))}",_ => $"{e.DeviceName(t.Id, info.DeviceIndex)} · {e.DeviceParamName(t.Id, info.DeviceIndex, info.ParamIndex)}",diff --git a/src/managed/Nota.App/ArrangementView.Sends.cs b/src/managed/Nota.App/ArrangementView.Sends.csnew file mode 100644index 00000000..9b06086d--- /dev/null+++ b/src/managed/Nota.App/ArrangementView.Sends.cs@@ -0,0 +1,200 @@+// 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.++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;+using Nota.Application.Localization;++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.+ 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>+ private bool ShowSendsOn(TrackVM t, HeaderTier tier, double rowH)+ => _showSends && !t.IsReturn && _returns.Count > 0+ && (tier == HeaderTier.Large || (tier == HeaderTier.Standard && rowH >= SendsMinStandardHeight));++ // The returns in bus order, with their bus and name.+ private List<(int bus, string name)> SendBuses()+ {+ var buses = new List<(int bus, string name)>();+ if (_engine is not { } e) return buses;+ foreach (var r in _returns)+ {+ int bus = e.TrackReturnIndex(r.Id);+ if (bus >= 0) buses.Add((bus, r.Name));+ }+ buses.Sort((a, b) => a.bus.CompareTo(b.bus));+ return buses;+ }++ private static string SendLetter(int bus) => ((char)('A' + Math.Clamp(bus, 0, 25))).ToString();++ // The return each track's shown send lane points at, so the lane follows its bus when a+ // return before it is deleted (the engine renumbers the lanes the same way).+ private readonly Dictionary<int, int> _autoSendReturn = new();++ private int ReturnOnBus(int bus)+ {+ if (_engine is not { } e) return -1;+ for (int i = 0; i < e.TrackCount; i++)+ if (e.TryGetTrackInfo(i, out var ti) && ti.IsReturn && e.TrackReturnIndex(ti.Id) == bus) return ti.Id;+ return -1;+ }++ private void NoteSendTarget(TrackVM t)+ {+ if (t.AutoTarget != AutomationTarget.Send) { _autoSendReturn.Remove(t.Id); return; }+ int r = ReturnOnBus(t.AutoDeviceIndex);+ if (r > 0) _autoSendReturn[t.Id] = r; else _autoSendReturn.Remove(t.Id);+ }++ // Move a shown send lane to its return's current bus; its return gone → back to Volume.+ private void ResyncSendTarget(TrackVM t)+ {+ if (_engine is not { } e) return;+ if (!_autoSendReturn.TryGetValue(t.Id, out int r)) { NoteSendTarget(t); return; }+ int bus = e.TrackReturnIndex(r);+ if (bus == t.AutoDeviceIndex) return;+ if (bus < 0)+ {+ t.AutoTarget = AutomationTarget.Volume;+ _autoSendReturn.Remove(t.Id);+ }+ t.AutoDeviceIndex = bus;+ t.AutoParamIndex = t.AutoLane = -1;+ _autoTargets[t.Id] = (t.AutoTarget, t.AutoDeviceIndex, -1, "", -1, -1, -1);+ }++ // The name of the return on a bus ("" when none is there).+ // Reads the engine, not _returns: a Refresh labels the lanes before it rebuilds the returns.+ private string SendBusName(int bus)+ {+ if (_engine is not { } e) return "";+ for (int i = 0; i < e.TrackCount; i++)+ if (e.TryGetTrackInfo(i, out var ti) && ti.IsReturn && e.TrackReturnIndex(ti.Id) == bus) return TrackNames.Of(e, ti);+ return "";+ }+ private static string SendLevelText(double v) => v <= 0.005 ? "–" : NotaNum.Str(v * 100, "0");+ private static string SendTip(int bus, string name, double v) => Loc.F("Send {0} · {1}", SendLetter(bus), name) + " · " + NotaNum.Pct(v);++ /// <summary>The send row for a track card: one inline knob per return. <paramref name="contentW"/>+ /// is the width the card's controls have; cells drop their letter and level below it.</summary>+ private Control? BuildSendRow(TrackVM t, double contentW)+ {+ if (_engine is not { } e) return null;+ var buses = SendBuses();+ if (buses.Count == 0) return null;+ bool full = buses.Count * SendCellW + (buses.Count - 1) * SendCellGap <= contentW;+ var row = new Grid { Margin = new Thickness(0, SendRowTop, 0, 0), ColumnSpacing = SendCellGap, Height = Knob.SizeInline };+ for (int i = 0; i < buses.Count; i++) row.ColumnDefinitions.Add(new ColumnDefinition(full ? GridLength.Star : GridLength.Auto));+ if (!full) row.HorizontalAlignment = HorizontalAlignment.Left;+ for (int i = 0; i < buses.Count; i++)+ {+ var (bus, name) = buses[i];+ float level = e.GetTrackSend(t.Id, bus);+ var knob = new Knob(level, 1.0) { Inline = true, Accent = true, Default = 0, Format = v => NotaNum.Pct(v) };+ var cell = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 3, Background = Brushes.Transparent };+ cell.Children.Add(knob);+ TextBlock? value = null;+ if (full)+ {+ var letter = new TextBlock { Text = SendLetter(bus), FontSize = 8, FontWeight = FontWeight.Medium, Foreground = Brush("Brush.TextSecondary") };+ value = new TextBlock { Text = SendLevelText(level), FontSize = 8, Classes = { "Mono" }, Foreground = Brush("Brush.TextTertiary") };+ cell.Children.Add(new StackPanel { VerticalAlignment = VerticalAlignment.Center, Children = { letter, value } });+ }+ ToolTip.SetTip(cell, SendTip(bus, name, level));+ int b = bus;+ var shown = value;+ SendControl.Attach(knob, e, t.Id, b, v =>+ {+ if (shown is not null) shown.Text = SendLevelText(v);+ ToolTip.SetTip(cell, SendTip(b, name, v));+ });+ ValueEntry.Attach(knob, Loc.F("Send {0}", SendLetter(bus)), value);+ _sendKnobs.Add((t.Id, bus, knob, value, cell, name));+ Grid.SetColumn(cell, i);+ row.Children.Add(cell);+ }+ return row;+ }++ // Follow sends changed elsewhere — the Mixer, the Sends card, automation, MCP — unless in the hand.+ private void FollowSends(IAudioEngine e)+ {+ foreach (var (id, bus, knob, value, cell, name) in _sendKnobs)+ {+ if (knob.Dragging) continue;+ double v = e.GetTrackSend(id, bus);+ if (Math.Abs(knob.Value - v) <= 1e-3) continue;+ knob.Value = v;+ if (value is not null) value.Text = SendLevelText(v);+ 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("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("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.csindex 8c46450e..b1f7e5bf 100644--- a/src/managed/Nota.App/ArrangementView.Sizing.cs+++ b/src/managed/Nota.App/ArrangementView.Sizing.cs@@ -53,12 +53,20 @@ public sealed partial class ArrangementViewprivate readonly List<(Border grip, int trackId)> _rowSeamGrips = new();// Layout tier each live card was built at, so a drag rebuilds a card only when it crosses one.private readonly Dictionary<int, HeaderTier> _cardTiers = new();+ // Whether each live card was built with its send row (specs/072).+ private readonly Dictionary<int, bool> _cardSends = new();// Heights of the tracks last copied/cut, in order — the engine's track clipboard knows no view sizes.private List<double?>? _clipboardHeights;private Border _columnSeam = null!;internal enum HeaderTier { Compact, Standard, Large }+ // A live card was built for another layout than this height asks for: another tier, or the+ // send row (specs/072) coming or going inside one.+ private bool CardLayoutStale(TrackVM t, double h)+ => _cardTiers.TryGetValue(t.Id, out var built)+ && (built != TierFor(h) || (_cardSends.TryGetValue(t.Id, out var sends) && sends != ShowSendsOn(t, TierFor(h), h)));+// The standard header needs ~61 px of visible content (three rows), the large one ~106,// so each tier starts where its layout fits — below 62 a row is compact.internal static HeaderTier TierFor(double height)@@ -226,7 +234,7 @@ public sealed partial class ArrangementViewvar children = _headers.Children;int crossing = 0;for (int i = 0; i < _tracks.Count; i++)- if (!IsSlimRow(_tracks[i]) && _cardTiers.TryGetValue(_tracks[i].Id, out var b) && b != TierFor(ClipAreaHeightAt(i))) crossing++;+ if (!IsSlimRow(_tracks[i]) && CardLayoutStale(_tracks[i], ClipAreaHeightAt(i))) crossing++;bool rebuildTiers = crossing <= LiveTierRebuildLimit;for (int i = 0; i < _tracks.Count; i++){@@ -234,7 +242,7 @@ public sealed partial class ArrangementViewif (!_headerCards.TryGetValue(t.Id, out var hc)) continue;Control card = hc.card;double h = ClipAreaHeightAt(i);- if (rebuildTiers && !IsSlimRow(t) && _cardTiers.TryGetValue(t.Id, out var built) && built != TierFor(h))+ if (rebuildTiers && !IsSlimRow(t) && CardLayoutStale(t, h)){int at = children.IndexOf(card);var fresh = BuildHeaderCard(t);@@ -631,6 +639,8 @@ 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@@ -639,8 +649,8 @@ public sealed partial class ArrangementView[JsonPropertyName("height")] public double Height { get; set; }}- /// <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>+ /// <summary>Write the track, return and master heights, the header width, the folded groups and the Sends key+ /// 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){var path = System.IO.Path.Combine(bundleDir, TrackViewSidecar);@@ -660,7 +670,9 @@ public sealed partial class ArrangementViewif (_engine.TryGetTrackInfo(i, out var ti) && ti.IsGroup && _fold.IsFolded(ti.Id)) folded.Add(i);if (folded.Count > 0) dto.CollapsedGroups = folded;}- if (dto.HeaderWidth is null && dto.TrackHeights.Count == 0 && dto.MasterHeight is null && dto.CollapsedGroups is null)+ 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 (System.IO.File.Exists(path)) System.IO.File.Delete(path);return;@@ -693,6 +705,7 @@ public sealed partial class ArrangementViewif (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); }@@ -706,6 +719,8 @@ 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.csindex 65e96411..66af9ccf 100644--- a/src/managed/Nota.App/ArrangementView.cs+++ b/src/managed/Nota.App/ArrangementView.cs@@ -374,17 +374,27 @@ public sealed partial class ArrangementView : UserControlvar zoomIn = ZoomChip("+");zoomOut.Click += (_, _) => Zoom(1 / 1.25);zoomIn.Click += (_, _) => Zoom(1.25);- var zoomBar = new StackPanel+ var zoomKeys = new StackPanel{- Orientation = Orientation.Horizontal, Spacing = 5, Width = HeaderW,+ Orientation = Orientation.Horizontal, Spacing = 5,VerticalAlignment = VerticalAlignment.Center,- Margin = new Thickness(8, 0, 0, 0),Children ={new TextBlock { Text = Loc.T("Zoom"), Classes = { "SectionLabel" }, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(6, 0, 2, 0) },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);_headerColumnParts.Add(zoomBar);var topLeft = HeaderPanel(zoomBar);var topGrid = new Grid { Height = RulerH };@@ -919,7 +929,7 @@ public sealed partial class ArrangementView : UserControl}/// <summary>Pushes fresh per-track meter readings into the header meters (~30 Hz, M6-2),- /// and refreshes the volume/pan controls so automation (playback or scrub) moves them live.</summary>+ /// and refreshes the volume/pan/send controls so automation (playback or scrub) moves them live.</summary>public void UpdateMeters(){if (_engine is not { } eng) return;@@ -955,6 +965,7 @@ public sealed partial class ArrangementView : UserControlif (_footerPans.TryGetValue(ti.Id, out var rp) && !rp.Dragging && Math.Abs(rp.Pan - ti.Pan) > 1e-3)rp.Pan = ti.Pan;}+ FollowSends(eng);}// Moves a footer fader and its read-out to a volume changed elsewhere (Mixer, MST, MCP,@@ -1074,6 +1085,7 @@ public sealed partial class ArrangementView : UserControl{(tvm.AutoTarget, tvm.AutoDeviceIndex, tvm.AutoParamIndex, tvm.AutoParamId, tvm.AutoChain, tvm.AutoSlot, tvm.AutoLane) = sel;if (tvm.AutoChain >= 0) ResyncNestedTarget(tvm); // a rack edit may have moved its device+ if (tvm.AutoTarget == AutomationTarget.Send) ResyncSendTarget(tvm); // a return delete may have moved its bus}tvm.AutoLabel = AutoLabelFor(tvm);LoadAutoPoints(tvm);@@ -2097,6 +2109,9 @@ public sealed partial class ArrangementView : UserControl_volDb.Clear();_headerCards.Clear();_cardTiers.Clear();+ _cardSends.Clear();+ _sendKnobs.Clear();+ PaintSendsToggle();for (int i = 0; i < _tracks.Count; i++){var card = BuildHeaderCard(_tracks[i]);@@ -2201,6 +2216,9 @@ public sealed partial class ArrangementView : UserControldouble 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+ _cardSends[t.Id] = sends;+ _sendKnobs.RemoveAll(k => k.trackId == t.Id);// Row 1: [group ▸/▾] name (ellipsised) + type-tag chip.var name = new TextBlock@@ -2367,12 +2385,16 @@ public sealed partial class ArrangementView : UserControlstack.Children.Add(nameRow);break;case HeaderTier.Large:- // A row each: the fader takes the full width, the pan its own row below.- volRow.ColumnDefinitions = new ColumnDefinitions("*");- volRow.RowDefinitions = new RowDefinitions("Auto,Auto");- volRow.RowSpacing = 6;- Grid.SetColumn(pan, 0);- Grid.SetRow(pan, 1);+ // A row each: the fader takes the full width, the pan its own row below — unless+ // the send row needs that room, then volume and pan share a row as on a standard card.+ if (!sends)+ {+ volRow.ColumnDefinitions = new ColumnDefinitions("*");+ volRow.RowDefinitions = new RowDefinitions("Auto,Auto");+ volRow.RowSpacing = 6;+ Grid.SetColumn(pan, 0);+ Grid.SetRow(pan, 1);+ }stack.Children.Add(nameRow);stack.Children.Add(row2);if (routingRow is not null) stack.Children.Add(routingRow);@@ -2384,6 +2406,9 @@ public sealed partial class ArrangementView : UserControlstack.Children.Add(volRow);break;}+ // Room for the knobs: the card minus its group indent, spine, padding and meter.+ if (sends && BuildSendRow(t, HeaderW - Math.Max(0, t.Depth) * GroupIndent - 3 - 16 - 11) is { } sendRow)+ stack.Children.Add(sendRow);var meter = new MeterBar { VerticalAlignment = VerticalAlignment.Stretch, Width = 8, Margin = tier == HeaderTier.Compact ? new Thickness(0, 4, 3, 4) : new Thickness(0, 6, 3, 6) };_meters[t.Id] = meter;diff --git a/src/managed/Nota.App/DeviceChainView.cs b/src/managed/Nota.App/DeviceChainView.csindex e5aaa619..72e64508 100644--- a/src/managed/Nota.App/DeviceChainView.cs+++ b/src/managed/Nota.App/DeviceChainView.cs@@ -297,7 +297,7 @@ public sealed partial class DeviceChainView : UserControlvalue.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");var knob = new Knob(_engine.GetTrackSend(_trackId, bus), 1.0) { Accent = true, Default = 0, Format = v => Pct((float)v) };int b = bus;- knob.ValueChanged += v => { _engine.SetTrackSend(_trackId, b, (float)v); value.Text = Pct((float)v); };+ SendControl.Attach(knob, _engine, _trackId, b, v => value.Text = Pct((float)v)); // undoable, writes automation (specs/072)// Follow the Session / Mixer send faders and automation (#138)._deviceLiveRefreshers.Add(() =>{diff --git a/src/managed/Nota.App/Languages/fr.json b/src/managed/Nota.App/Languages/fr.jsonindex c293c2fd..75234636 100644--- a/src/managed/Nota.App/Languages/fr.json+++ b/src/managed/Nota.App/Languages/fr.json@@ -1564,6 +1564,7 @@"Monitor": "Écoute","Send {0} · {1}": "Envoi {0} · {1}","Send": "Envoi",+ "Show sends in track headers": "Afficher les envois dans les en-têtes de piste","All ins": "Toutes les entrées","MIDI input: every input, or another instrument track": "Entrée MIDI : toutes les entrées, ou une autre piste d’instrument","In: hear the input live through this track · Auto: only while recording": "Entrée : entendre l’entrée en direct à travers cette piste · Auto : seulement pendant l’enregistrement",diff --git a/src/managed/Nota.App/MixerView.Compact.cs b/src/managed/Nota.App/MixerView.Compact.csindex e34821fb..2b3b78fa 100644--- a/src/managed/Nota.App/MixerView.Compact.cs+++ b/src/managed/Nota.App/MixerView.Compact.cs@@ -112,7 +112,7 @@ public sealed partial class MixerView{var f = new MiniFader(_engine.GetTrackSend(id, bus), 1.0) { VerticalAlignment = VerticalAlignment.Center };int b = bus;- f.ValueChanged += v => _engine.SetTrackSend(id, b, (float)v);+ SendControl.Attach(f, _engine, id, b); // undoable, writes automation (specs/072)ValueEntry.Attach(f, f.EntryField(Loc.F("Send {0}", (char)('A' + b)), NotaNum.Pct));_sendFaders.Add((id, b, f));bar = f;diff --git a/src/managed/Nota.App/MixerView.cs b/src/managed/Nota.App/MixerView.csindex 1f33a8ad..f4857fef 100644--- a/src/managed/Nota.App/MixerView.cs+++ b/src/managed/Nota.App/MixerView.cs@@ -944,7 +944,7 @@ public sealed partial class MixerView : UserControl{var f = new MiniFader(_engine.GetTrackSend(id, bus), 1.0) { VerticalAlignment = VerticalAlignment.Center };int b = bus;- f.ValueChanged += v => _engine.SetTrackSend(id, b, (float)v);+ SendControl.Attach(f, _engine, id, b); // undoable, writes automation (specs/072)ValueEntry.Attach(f, f.EntryField(Loc.F("Send {0}", (char)('A' + b)), NotaNum.Pct));_sendFaders.Add((id, b, f));Grid.SetColumn(f, 1); grid.Children.Add(f);diff --git a/src/managed/Nota.App/SendControl.cs b/src/managed/Nota.App/SendControl.csnew file mode 100644index 00000000..ce90a5de--- /dev/null+++ b/src/managed/Nota.App/SendControl.cs@@ -0,0 +1,58 @@+// 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.++using System;+using Nota.Application;+using Nota.Application.Editing;++namespace Nota.App;++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;+ }++ /// <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();+ }+ }+}diff --git a/src/managed/Nota.App/SessionView.Mixer.cs b/src/managed/Nota.App/SessionView.Mixer.csindex efeba4dc..4919f89f 100644--- a/src/managed/Nota.App/SessionView.Mixer.cs+++ b/src/managed/Nota.App/SessionView.Mixer.cs@@ -122,7 +122,7 @@ public sealed partial class SessionViewvar f = new MiniFader(_engine.GetTrackSend(id, bus), 1.0) { Default = 0 };var read = ReadoutText();void Show() => read.Text = f.Value <= 0.005 ? "–" : NotaNum.Str(f.Value * 100, "0");- f.ValueChanged += v => { _engine.SetTrackSend(id, bus, (float)v); Show(); };+ SendControl.Attach(f, _engine, id, bus, _ => Show()); // undoable, writes automation (specs/072)ValueEntry.Attach(f, f.EntryField(Loc.T("Send"), v => v <= 0.005 ? "–" : NotaNum.Str(v * 100, "0")), read);Show();sendSyncs.Add(() =>diff --git a/src/managed/Nota.Application/Engine/EngineContracts.cs b/src/managed/Nota.Application/Engine/EngineContracts.csindex 1d830a7c..8f1c4cad 100644--- a/src/managed/Nota.Application/Engine/EngineContracts.cs+++ b/src/managed/Nota.Application/Engine/EngineContracts.cs@@ -266,8 +266,10 @@ public struct NotaMeterpublic readonly float Rms => RmsL > RmsR ? RmsL : RmsR;}-/// <summary>What a parameter-automation lane drives (M9). Matches native AutomationTarget.</summary>-public enum AutomationTarget { Volume = 0, Pan = 1, DeviceParam = 2, PluginParam = 3, MidiDeviceParam = 4 }+/// <summary>What a parameter-automation lane drives (M9). Matches native AutomationTarget.+/// <see cref="Send"/> (specs/072) is a track's send level into the return bus held in the+/// lane's device index (0..3), values 0..1.</summary>+public enum AutomationTarget { Volume = 0, Pan = 1, DeviceParam = 2, PluginParam = 3, MidiDeviceParam = 4, Send = 5 }/// <summary>What a device transfer (specs/043) moves: an audio effect, a MIDI effect or the/// track's instrument. Matches nota_track_transfer_device's family.</summary>@@ -335,7 +337,7 @@ public struct StereoMeasure/// <summary>What a value gesture targets (specs/009 volume / pan, specs/016 device/// parameters). Matches NOTA_MIX_*.</summary>-public enum MixKind { TrackVolume = 0, TrackPan = 1, MasterVolume = 2, DeviceParam = 3, MidiDeviceParam = 4, PluginParam = 5, PresetTag = 6 }+public enum MixKind { TrackVolume = 0, TrackPan = 1, MasterVolume = 2, DeviceParam = 3, MidiDeviceParam = 4, PluginParam = 5, PresetTag = 6, TrackSend = 8 }/// <summary>One value a gesture records for undo; laid out like native NotaMixTarget./// <see cref="TrackId"/> is ignored for the master volume; <see cref="DeviceIndex"/> /@@ -346,6 +348,8 @@ public readonly record struct MixTarget(MixKind Kind, int TrackId, int DeviceInd{public static MixTarget Volume(int trackId) => new(MixKind.TrackVolume, trackId);public static MixTarget Pan(int trackId) => new(MixKind.TrackPan, trackId);+ /// <summary>A track's send level into return bus <paramref name="bus"/> (specs/072).</summary>+ public static MixTarget Send(int trackId, int bus) => new(MixKind.TrackSend, trackId, bus);public static MixTarget Master => new(MixKind.MasterVolume, -1);/// <summary>A built-in audio effect's parameter (its own min..max range).</summary>public static MixTarget DeviceParam(int trackId, int deviceIndex, int paramIndex) => new(MixKind.DeviceParam, trackId, deviceIndex, paramIndex);diff --git a/src/managed/Nota.Mcp/Tools/AutomationTools.cs b/src/managed/Nota.Mcp/Tools/AutomationTools.csindex fbe2cddf..1c34e1a4 100644--- a/src/managed/Nota.Mcp/Tools/AutomationTools.cs+++ b/src/managed/Nota.Mcp/Tools/AutomationTools.cs@@ -20,7 +20,8 @@ public sealed class AutomationTools(IAudioEngine engine, IEngineDispatch dispatcprivate static string TargetName(AutomationTarget t) => t switch{ AutomationTarget.Volume => "volume", AutomationTarget.Pan => "pan", AutomationTarget.DeviceParam => "device_param",- AutomationTarget.PluginParam => "plugin_param", AutomationTarget.MidiDeviceParam => "midi_param", _ => t.ToString() };+ AutomationTarget.PluginParam => "plugin_param", AutomationTarget.MidiDeviceParam => "midi_param",+ AutomationTarget.Send => "send", _ => t.ToString() };[McpServerTool(Name = "list_automation"), Description("List a track's automation lanes (index, target, device/param index, point count).")]public Task<Lane[]> ListAutomation(int trackId) => Read(() =>@@ -41,12 +42,14 @@ 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). "+ + "\"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). "+ "Returns the lane index.")]public Task<int> AddAutomationLane(int trackId, string target, int deviceIndex = -1, int paramIndex = -1) => Mutate(() =>{var t = target.ToLowerInvariant() switch- { "pan" => AutomationTarget.Pan, "device_param" => AutomationTarget.DeviceParam, "midi_param" => AutomationTarget.MidiDeviceParam, _ => AutomationTarget.Volume };+ { "pan" => AutomationTarget.Pan, "device_param" => AutomationTarget.DeviceParam, "midi_param" => AutomationTarget.MidiDeviceParam,+ "send" => AutomationTarget.Send, _ => 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.csindex aa1fa6fe..94d9963f 100644--- a/src/managed/Nota.Mcp/Tools/TrackTools.cs+++ b/src/managed/Nota.Mcp/Tools/TrackTools.cs@@ -68,5 +68,5 @@ public sealed class TrackTools(IAudioEngine engine, IEngineDispatch dispatch, IApublic 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(() => E.SetTrackSend(trackId, returnBus, Math.Clamp(level, 0f, 1f)));+ 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}diff --git a/src/native/nota.engine/include/nota/nota_engine.h b/src/native/nota.engine/include/nota/nota_engine.hindex 5e9c4f3e..721e4ce1 100644--- a/src/native/nota.engine/include/nota/nota_engine.h+++ b/src/native/nota.engine/include/nota/nota_engine.h@@ -349,8 +349,10 @@ NOTA_API int32_t nota_engine_graph_retire_selftest(NotaEngine* engine);/* ---- parameter automation (M9) ------------------------------------------* Lanes are structural data on the track (snapshot + undo/redo, M6-6). A lane- * targets track volume (target 0), pan (1) or a built-in device param (2, with- * device_index/param_index); add/set/remove checkpoint undo. add returns the+ * targets track volume (target 0), pan (1), a built-in device param (2, with+ * device_index/param_index) or a send level (5, specs/072: device_index = the return bus+ * 0..3, values 0..1; deleting a return drops its bus's lanes and renumbers later buses);+ * add/set/remove checkpoint undo. add returns the* lane index (an existing lane on the same target is reused, not duplicated).* get_points with out=NULL returns the point count. */NOTA_API int32_t nota_engine_automation_selftest(NotaEngine* engine);@@ -964,9 +966,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 / master volume (009) and device-parameter (016) steps made through value+ * pan / sends / master volume (009, 072) 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, sends, bypass and the transport are not covered. */+ * to undo/redo. Mute, solo, 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);@@ -981,7 +983,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 / master volume and device-parameter changes become undo steps through+/* Volume / pan / send / 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@@ -995,6 +997,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 */typedef struct NotaMixTarget {int32_t kind; /* NOTA_MIX_* */diff --git a/src/native/nota.engine/src/abi/nota_engine_core.cpp b/src/native/nota.engine/src/abi/nota_engine_core.cppindex 58c8db02..407e9f01 100644--- a/src/native/nota.engine/src/abi/nota_engine_core.cpp+++ b/src/native/nota.engine/src/abi/nota_engine_core.cpp@@ -356,7 +356,7 @@ int32_t nota_mix_gesture_begin(NotaEngine* e, const NotaMixTarget* targets, int3int32_t n = 0;for (int32_t i = 0; i < count; ++i) {const int32_t k = targets[i].kind;- if (k < NOTA_MIX_TRACK_VOLUME || k > NOTA_MIX_PRESET_TAG) continue;+ if ((k < NOTA_MIX_TRACK_VOLUME || k > NOTA_MIX_PRESET_TAG) && k != NOTA_MIX_TRACK_SEND) continue; // 7 is internalt[n++] = {static_cast<nota::MixKind>(k), targets[i].track_id, targets[i].device_index, targets[i].param_index};}return n > 0 ? ENG(e)->beginMixGesture(t, n) : 0;diff --git a/src/native/nota.engine/src/engine/Automation.h b/src/native/nota.engine/src/engine/Automation.hindex 1d58a6ae..9dbfc91c 100644--- a/src/native/nota.engine/src/engine/Automation.h+++ b/src/native/nota.engine/src/engine/Automation.h@@ -16,7 +16,14 @@namespace nota {-enum class AutomationTarget : int32_t { Volume = 0, Pan = 1, DeviceParam = 2, PluginParam = 3, MidiDeviceParam = 4 };+// Send (specs/072): a track's send level into return bus `deviceIndex` (0..kMaxReturns-1).+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+// 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;+}// `curve` (M9-D) shapes the segment FROM this point TO the next: 0 = linear,// >0 = ease-out (fast start), <0 = ease-in (slow start), range [-1,1].@@ -28,7 +35,7 @@ struct AutomationPoint {struct AutomationLane {AutomationTarget target = AutomationTarget::Volume;- int32_t deviceIndex = -1; // DeviceParam / PluginParam (PluginParam: <0 = instrument)+ int32_t deviceIndex = -1; // DeviceParam / PluginParam (PluginParam: <0 = instrument); Send: the busint32_t paramIndex = -1; // DeviceParam; PluginParam: resolved from paramIdstd::string paramId; // PluginParam only: stable JUCE parameter ID (M9-B)bool suppressRead = false; // transient (M9-C): while this target is being written,diff --git a/src/native/nota.engine/src/engine/Engine.cpp b/src/native/nota.engine/src/engine/Engine.cppindex d97ec1ab..617d2ecc 100644--- a/src/native/nota.engine/src/engine/Engine.cpp+++ b/src/native/nota.engine/src/engine/Engine.cpp@@ -920,6 +920,11 @@ 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;+ }v = t.kind == MixKind::TrackVolume ? tr->volume() : tr->pan();return true;}@@ -951,6 +956,11 @@ 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::TrackVolume) tr->setVolume(v);elsetr->setPan(v);diff --git a/src/native/nota.engine/src/engine/EngineTypes.h b/src/native/nota.engine/src/engine/EngineTypes.hindex a392c7e5..76e4102e 100644--- a/src/native/nota.engine/src/engine/EngineTypes.h+++ b/src/native/nota.engine/src/engine/EngineTypes.h@@ -87,7 +87,7 @@ struct ControlEvent {int32_t value;};-// Value undo (specs/009, specs/016): volume / pan / master volume live in atomics outside the+// Value undo (specs/009, specs/016): volume / pan / sends / 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@@ -102,7 +102,8 @@ enum class MixKind : int32_t {MidiDeviceParam = 4,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_+ 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};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.cppindex 504c7831..e6c51334 100644--- a/src/native/nota.engine/src/engine/Engine_Automation.cpp+++ b/src/native/nota.engine/src/engine/Engine_Automation.cpp@@ -34,6 +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-guardedcase 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);@@ -278,6 +279,7 @@ bool sameTarget(int32_t t0, int32_t d0, int32_t p0, const std::string& id0, int3case AutomationTarget::DeviceParam:case AutomationTarget::MidiDeviceParam: return d0 == d1 && p0 == p1;case AutomationTarget::PluginParam: return d0 == d1 && id0 == id1;+ case AutomationTarget::Send: return d0 == d1; // the busdefault: return true; // Volume / Pan}}@@ -287,6 +289,7 @@ float Engine::currentTargetValue(const Track& t, int32_t target, int32_t deviceIswitch (static_cast<AutomationTarget>(target)) {case AutomationTarget::Volume: return t.volume();case AutomationTarget::Pan: return t.pan();+ case AutomationTarget::Send: return t.send(deviceIndex);case AutomationTarget::DeviceParam:if (deviceIndex >= 0 && deviceIndex < static_cast<int32_t>(t.devices.size()))if (auto* d = t.devices[deviceIndex].get()) return d->getParam(paramIndex);@@ -333,6 +336,9 @@ static int32_t findLaneFor(case AutomationTarget::PluginParam:if (l.deviceIndex != deviceIndex || l.paramId != paramId) continue;break;+ case AutomationTarget::Send:+ if (l.deviceIndex != deviceIndex) continue;+ break;default: break; // Volume / Pan: one lane per track}return static_cast<int32_t>(i);@@ -559,16 +565,19 @@ int32_t Engine::addAutomationLane(int32_t trackId, int32_t target, int32_t devicif (!old) return -1;const auto tgt = static_cast<AutomationTarget>(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)))+ if (!l.nested() && l.target == tgt && (!usesDev || (l.deviceIndex == deviceIndex && l.paramIndex == paramIndex)) &&+ (!send || l.deviceIndex == deviceIndex))return static_cast<int32_t>(i);}auto nt = cloneTrack(*old);TrackLane lane;lane.target = tgt;- lane.deviceIndex = usesDev ? deviceIndex : -1;+ lane.deviceIndex = usesDev || send ? 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/src/native/nota.engine/src/engine/Engine_Tracks.cpp b/src/native/nota.engine/src/engine/Engine_Tracks.cppindex ff7f52c6..d454dc69 100644--- a/src/native/nota.engine/src/engine/Engine_Tracks.cpp+++ b/src/native/nota.engine/src/engine/Engine_Tracks.cpp@@ -1543,7 +1543,7 @@ bool Engine::moveClipToTrack(int32_t srcTrackId, int32_t clipIndex, int32_t sour}// Automation follow across tracks (req 8.3.1/8.3.4). Identical device layout → everything- // follows, exactly like a same-track move. Otherwise only the common params (Volume/Pan)+ // follows, exactly like a same-track move. Otherwise only the mix lanes (volume, pan, sends)// move and device/plugin automation stays on the source (its indices are positional); we// flag that so the UI can tell the user.if (!automationLock_ && len > 1e-6) {@@ -1553,14 +1553,14 @@ bool Engine::moveClipToTrack(int32_t srcTrackId, int32_t clipIndex, int32_t sourapplyClipAutomation(*ndst, sourceTrackId, snips, newStartBeat, len, /*sameTrack*/ true);} else {for (const auto& s : snips)- if (s.target != AutomationTarget::Volume && s.target != AutomationTarget::Pan) {+ if (!isMixTarget(s.target)) {lastMoveKeptDeviceAuto_ = true;break;}- // Clear only Volume/Pan from the source span; leave device/plugin points in place.+ // Clear only the mix lanes from the source span; leave device/plugin points in place.constexpr double eps = 1e-6;for (auto& lane : nsrc->automation) {- if (lane.target != AutomationTarget::Volume && lane.target != AutomationTarget::Pan) continue;+ if (!isMixTarget(lane.target)) continue;auto& pts = lane.points;pts.erase(std::remove_if(pts.begin(), pts.end(),[&](const AutomationPoint& p) {@@ -1705,12 +1705,12 @@ bool Engine::moveClipBlock(const std::vector<ClipMoveReq>& moves) {continue;}for (const auto& s : it.snips)- if (s.target != AutomationTarget::Volume && s.target != AutomationTarget::Pan) {+ if (!isMixTarget(s.target)) {lastMoveKeptDeviceAuto_ = true;break;}for (auto& lane : src.automation) {- if (lane.target != AutomationTarget::Volume && lane.target != AutomationTarget::Pan) continue;+ if (!isMixTarget(lane.target)) continue;auto& pts = lane.points;pts.erase(std::remove_if(pts.begin(), pts.end(),[&](const AutomationPoint& p) {@@ -2559,7 +2559,7 @@ void Engine::applyClipAutomation(Track& nt, int32_t trackId, const std::vector<Tdouble placedStart, double len, bool sameTrack) const {const double s = placedStart, e = placedStart + len;for (const auto& snip : snips) {- if (!sameTrack && snip.target != AutomationTarget::Volume && snip.target != AutomationTarget::Pan) continue;+ if (!sameTrack && !isMixTarget(snip.target)) continue;// Find the matching lane on nt, or create one bound to the same target.TrackLane* lane = nullptr;for (auto& l : nt.automation) {@@ -2573,6 +2573,7 @@ void Engine::applyClipAutomation(Track& nt, int32_t trackId, const std::vector<Tcase AutomationTarget::PluginParam:match = l.deviceIndex == snip.deviceIndex && l.paramId == snip.paramId;break;+ case AutomationTarget::Send: match = l.deviceIndex == snip.deviceIndex; break; // one lane per busdefault: break; // Volume / Pan: single lane}if (match) {@@ -3379,7 +3380,8 @@ std::vector<std::shared_ptr<Track>> Engine::expandTrackSet(const int32_t* ids, i// Deleting a return leaves a hole in the bus slots, but the renderer only runs buses// 0..count-1 and addReturnTrack hands out slot `count` — so the survivors move down to-// 0..n-1 (in track order) and every send follows its bus; sends to a deleted bus go.+// 0..n-1 (in track order) and every send — level and lane — follows its bus; sends to a+// deleted bus go.// Changed tracks are cloned, never edited in place: the old graph is the undo snapshot.void Engine::compactReturns(Graph& g) const {int32_t remap[kMaxReturns];@@ -3406,9 +3408,21 @@ void Engine::compactReturns(Graph& g) const {bool changed = false;for (int32_t b = 0; b < kMaxReturns; ++b)if (sends[b] != t->send(b)) changed = true;+ // Send lanes (specs/072) follow their bus too; a lane to a deleted bus goes.+ auto busOf = [&](const TrackLane& l) {+ return l.deviceIndex >= 0 && l.deviceIndex < kMaxReturns ? remap[l.deviceIndex] : -1;+ };+ for (const auto& l : t->automation)+ if (l.target == AutomationTarget::Send && !l.nested() && busOf(l) != l.deviceIndex) changed = true;if (!changed) continue;auto nt = cloneTrack(*t);for (int32_t b = 0; b < kMaxReturns; ++b) nt->setSend(b, sends[b]);+ auto& lanes = nt->automation;+ for (auto& l : lanes)+ if (l.target == AutomationTarget::Send && !l.nested()) l.deviceIndex = busOf(l);+ lanes.erase(std::remove_if(lanes.begin(), lanes.end(),+ [](const TrackLane& l) { return l.target == AutomationTarget::Send && l.deviceIndex < 0; }),+ lanes.end());t = std::move(nt);}}diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex b66569ec..8e461561 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -398,6 +398,14 @@ 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.+if (args.Length >= 1 && args[0] == "--sends")+{+ Console.WriteLine("-- sends --");+ foreach (var (ok, label) in SendAutomationTests.Run()) Check(ok, label);+ Console.WriteLine(failures == 0 ? "SENDS PASSED" : $"SENDS FAILED ({failures})");+ return failures == 0 ? 0 : 1;+}// Return-track automation alone: `--return-automation`. Also part of the full run.if (args.Length >= 1 && args[0] == "--return-automation"){@@ -15440,6 +15448,9 @@ foreach (var (ok, label) in ReturnDeleteTests.Run()) Check(ok, label);Console.WriteLine("-- return automation --");foreach (var (ok, label) in ReturnAutomationTests.Run()) Check(ok, label);+Console.WriteLine("-- sends --");+foreach (var (ok, label) in SendAutomationTests.Run()) Check(ok, label);+Console.WriteLine("-- arrangement moves --");foreach (var (ok, label) in ArrangementMovesTests.Run()) Check(ok, label);diff --git a/tests/Nota.SmokeTest/SendAutomationTests.cs b/tests/Nota.SmokeTest/SendAutomationTests.csnew file mode 100644index 00000000..31aea1b1--- /dev/null+++ b/tests/Nota.SmokeTest/SendAutomationTests.cs@@ -0,0 +1,226 @@+// 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`.++using Nota.Application;+using Nota.Application.Editing;+using Nota.Infrastructure;++namespace Nota.SmokeTest;++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;+ }++ // ---- value undo -------------------------------------------------------------------++ private static IEnumerable<(bool, string)> Undo()+ {+ using var eng = new NotaEngine();+ int t = eng.AddInstrumentTrack();+ eng.AddReturnTrack();+ 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));+ g.Begin();+ for (int i = 1; i <= 10; i++) g.Change(i * 0.06f, v => eng.SetTrackSend(t, 1, 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})");++ // 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");++ // 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");++ // A step whose track is gone is skipped quietly (like volume).+ int gone = eng.AddAudioTrack();+ 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.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");+ }++ // ---- recording a send ---------------------------------------------------------------++ private static IEnumerable<(bool, string)> Record()+ {+ using var eng = new NotaEngine();+ eng.SetBpm(120);+ int t = eng.AddInstrumentTrack();+ eng.AddReturnTrack();+ eng.ClearUndoHistory();+ var buf = new float[512 * 2];+ 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.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;+ }+}