# Version T — Routing Sets Guide

---

## What Are Routing Sets?

A Routing Set is a pre-wired signal path. It defines where a microphone channel goes — which mixes it feeds, at what level, and whether each send is pre or post fader.

Routing Sets are defined once. Per cue, each mic is simply assigned to a path. One value write per mic per cue.

### Musical Theatre Example

A show might define five sets:

| Set | Purpose |
|-----|---------|
| `Principal` | Solo dialogue and lead vocal — FOH position, IEM detail, program feed |
| `Ensemble 1` | Upstage chorus — FOH cluster, band feed, broadcast feed |
| `Ensemble 2` | Downstage chorus — different FOH position, separate monitor group |
| `Booth` | Offstage/booth mic — local PA only, no monitors |
| `Off` | Not in use this scene — all sends zero |

Any mic can go to any set. A principal's mic goes to `Principal` for a solo, switches to `Ensemble 1` when joining the chorus, and goes to `Off` between scenes. The operator assigns per cue — the DSP detail is already in the set.

### Why This Works

All the routing complexity — which groups, which FX sends, what levels, pre or post fader — lives inside the set definition. Assigning a mic to a path is a single operation. Version T immediately writes all the individual crosspoints to the console. The console stores the result in its own scene system.

Version T does not store or play back scenes. The console is always the source of truth. The Version T display reflects actual console state — if sends change directly on the desk, the UI updates automatically.

This also means the chorus levelling engine only sees the mics currently assigned to the chorus set for that scene. Mics on Principal or Off are invisible to it. No special casing needed.

---

## Routing Sets Are Not Just FOH

Routing sets apply across every destination simultaneously:

- **FOH** — PA position, cluster assignment
- **IEM mixes** — performers hear more detail on a Principal set (full solo processing) vs Ensemble (mixed into chorus send)
- **Band/conductor feeds** — may carry more detailed solo/dialogue treatment than FOH — a spoken word level that increases when a performer is singing
- **Broadcast/program feeds** — separate treatment per path
- **Monitors/wedges** — fold-back level and source differ per set

A single Principal set might define 12 or more sends, each with its own level and pre/post state, covering every destination in the system.

---

## The Three Concepts

### 1. Pool Mixes

The pool is the global list of mix buses that Routing Sets controls. Only buses in the pool are managed — everything outside is untouched.

Define the pool once. It is shared across all sets.

Example pool:

- `Group 1` — Principal 1 Talk (mono group)
- `Group 2` — Principal 2 Song (mono group)
- `Stereo Group 1` — Ensemble 1 Small (stereo group)
- `Stereo Group 2` — Ensemble 2 Large (stereo group)
- `Stereo Group 3` — Booth Offstage (stereo group)
- `FX Send 1` — Principal 1 send (FX send)
- `FX Send 2` — Principal 2 send (FX send)
- `FX Send 3` — Ensemble send (FX send)
- `FX Send 4` — Booth send (FX send)

### 2. Routing Sets (up to 8)

Each set defines, for every pool mix:
- **Enable** — is this mic fed to this mix?
- **Level** — send level in dB
- **Pre/Post** — pre-fader, post-fader, or group

Up to 8 sets. Each gets a name and a colour.

### 3. Tracked Inputs

The tracked input list defines which mic channels Routing Sets manages. Only these inputs are affected by assign and apply operations. All others are left untouched.

---

## A Mic Is in One Set at a Time

A mic channel belongs to exactly one routing set per cue. This is the design, not a limitation. It makes routing state deterministic — at any moment, every tracked mic has one known, auditable path. There is no ambiguity about where the signal is going.

If you need a mic to feed two different destination groups simultaneously, define a set that includes both.

---

## The Main Screen

Two zones:

**Upper third — DCA Panel**
Live operational view. Tracked DCAs shown as cards. Quick-action buttons for automation.

**Lower two-thirds — Routing Sets Grid**
All tracked inputs as cards. Each shows its current set assignment, colour-coded. Unassigned inputs shown in grey.

The console is the source of truth. The display reflects actual console state at all times — if sends change directly on the desk, the display updates automatically. Version T observes; it does not own the data.

---

## The DCA Panel

### DCA Cards

Each card shows DCA name, number, colour, and linked routing set (if configured).

Tap to select. Once selected, the glass mode buttons on the right become active.

### Glass Modes (right buttons)

| Mode | What tapping an input does |
|------|---------------------------|
| **Assign** | Adds/removes that input from the selected DCA group |
| **Mute** | Mutes/unmutes that input |
| **Name** | Opens the name keyboard for that input |

### Auto Buttons (left side)

| Button | Action |
|--------|--------|
| **ALL ✓** | Select all tracked inputs |
| **Auto Assign** | Assign inputs to selected DCA based on name history |
| **Apply** | Route each input to the set linked to its DCA |
| **Auto Routing** | Same as Apply — derives routing from current DCA membership |
| **Auto Colour** | Apply colour rules to all tracked DCAs from name state |

**Auto Active** — shown in the header when any automatic action is armed.

---

## The Routing Sets Grid

Tracked inputs shown as cards. Each shows name, number, and current set (colour-coded). Tap to select (used with glass modes).

---

## Preferences (gear icon)

Three pages.

### Page 1 — Sets and Pool

**Routing Sets** — up to 8 tiles (numbered). Tap to select. Pencil to rename. Add creates a new set.

**Pool Mixes** — mix buses in the pool. Pencil opens the mix picker. Reset clears to defaults.

**Per-set configuration** — when a set is selected, each pool mix shows:
- Enable toggle
- Level (dB, drag to adjust)
- Pre/Post tap (Post → Pre → Group)

### Page 2 — Tracked Inputs and DCAs

**Tracked Inputs** — which inputs are managed. Pencil opens the input picker.

**Tracked DCAs** — which DCAs appear in the DCA panel. Pencil to add/remove. Up to 16.

**DCA → Set links** — each tracked DCA can be linked to a routing set. When Auto Routing runs, each input is routed to the set linked to its current DCA. Tap a DCA card, then a set tile to link.

**Name history locks** — Lock Solo History freezes single-input name learning. Lock Group History freezes group name learning.

### Page 3 — Cast Map

Each tracked input shows its name history:

- **Solo names** — names learned when this input was the sole DCA member (performer names)
- **Group names** — names learned when grouped with others

Tap an input to expand. Tap a name to edit. Names drive Auto Assign — when a performer is patched to any input, Auto Assign reconnects them to their DCA automatically.

Tap **Edit** (pencil) to delete names. Import button loads a cast map from CSV to pre-populate before rehearsals begin.

---

## Assigning a Routing Set to Inputs

**Manual — one input:**
Tap input card to select, then tap the target set tile.

**Apply — all tracked inputs:**
Tap **Apply**. All tracked inputs routed to the set linked to their DCA. Inputs in DCAs with no linked set go to Off (0).

**Auto Routing:**
Tap **Auto Routing**. Derives each input's set from its current DCA membership and applies.

---

## Routing Set Matching

Version T continuously reads the console's live crosspoint enables for all tracked inputs and pool mixes. It compares each input's live enable pattern against all defined sets. The first matching set is shown as that input's current assignment.

The console is the source of truth — matching reflects what the console actually has. Matching is enable-pattern only; levels and pre/post are not used.

If no set matches, the input shows as unassigned.

---

## Pre/Post Values

| Display | Meaning | Wire |
|---------|---------|------|
| Post | Post-fader send | 1 |
| Pre | Pre-fader send | 0 |
| Group | Subgroup tap | 2 (AHNet/dLive, WING, X32) |

---

## Limits

| Item | Limit |
|------|-------|
| Routing Sets | 8 |
| Pool Mixes | Console maximum |
| Tracked Inputs | Console maximum |
| Tracked DCAs | 16 |

---

## Technical Reference

### Data Model

```
RoutingPreferences
  mixes: [MixReference]           ← pool (global, shared across sets)
  trackedInputs: [InputReference] ← managed inputs
  trackedDCAs: [Int16]            ← managed DCAs (1-based)
  sets: [RoutingSet]              ← up to 8
    name: String
    enables: [Bool]               ← parallel to pool mixes
    levels: [Float]               ← dB, parallel to pool mixes
    preFader: [Int]               ← 0=PRE 1=POST 2=GRP
    color: RGBColor
  dcaRoutingSetLink: [String: UUID]  ← "DCA_n" → set UUID
  dcaAssignmentHistory: [String: Set<BroadwayPAIR>]  ← name → input set
```

### Matching Engine (BridgeRoutingManager)

For each tracked input, the bridge receives a live `[Bool]` enable row (one Bool per pool mix). It compares against each set's `enables` array. First match wins.

Levels and pre/post are write-only — not used for matching.

### Wire Flow

**Reading (continuous):**
```
Adaptor subscribes input × mix enable crosspoints
→ builds [Bool] row per input on change
→ BridgeRoutingManager.handleInputEnables()
→ recomputes matchedSetIndex[pair]
→ UI reads bridgeManager.routingSetNames[]
```

**Writing (assign/apply):**
```
UI triggers assign for tracked input → target set index
→ address: [pair.token, .routingPool, .input, .routingSet]
           [pair.index, 1, channelIndex]
→ value: .int32(setIndex)   (0 = Off)
→ bridgeRouter.set()
→ adaptor writes all enable/level/pre crosspoints for that set
```

### BroadwayOSC Addresses

| Operation | Address | Value |
|-----------|---------|-------|
| Assign input to set | `/RoutingPool/1/Input/n/RoutingSet` | `i` set index (0 = Off) |
| Pool mix list | `/RoutingPool/1/Mix` | `[PP]` pairs array |
| Pool input list | `/RoutingPool/1/Input` | `[PP]` pairs array |
| Set enables | `/RoutingPool/1/RoutingSet/n/Enable` | `[TTF…]` per mix |
| Set levels | `/RoutingPool/1/RoutingSet/n/Level` | `[fff…]` dB per mix |
| Set pre/post | `/RoutingPool/1/RoutingSet/n/Pre` | `[iii…]` per mix |
| Set name | `/RoutingPool/1/RoutingSet/n/Name` | `s` |
