diff --git a/README.md b/README.md
index 5fb33f92..8261c953 100644
--- a/README.md
+++ b/README.md
@@ -183,7 +183,7 @@ The **strip** holds:
| --- | --- |
| LIVE | Watch the program while on air, and TAKE or AUTO a cued scene. |
| BUILD | Edit the scene on program, or the one open off air, shown in the middle, with its layers and what can be added on the left and the inspector on the right (see [BUILD](#build)). |
-| MIX | Add, rename, reorder, and remove audio scenes, pick the audio scene on program and the one to listen to and on which output, set each sound's gain, pan, mute, and delay, and send each sound and audio scene into audio scenes, with a meter on every one. The program shows small in the strip's place for the sound. |
+| MIX | Ride each sound's fader and mute it, open its strip for its pan and delay, and send each sound and audio scene into audio scenes, from dots under the strips or as a matrix under **Routes**. Add, rename, reorder, and remove audio scenes, put one on the stream, and listen to one on the output you pick (see [Audio scenes](#audio-scenes)). The program shows small in the strip's place for the sound. |
| REVIEW | Pick a stretch of the last 30 seconds of the program or a source from a strip of its pictures, and replay it in a replay source, slowed down if you like, or save it as a clip (see [Replay](#replay)). Beside it, this show's recordings and clips as cards with their length and size, one repaired after a crash marked so, and **Open the folder**. The program's card is the live picture. |
The layout follows the program's shape and the window's size, giving the
@@ -495,27 +495,46 @@ audio scene holding every microphone, which both a "Stream" audio scene (Mics,
without music you may not broadcast) and a "Headphones" one (Mics and the
music) hold. A sound an audio scene reaches more than one way plays in it
once, and an audio scene never holds itself, even through others. Add,
-rename, reorder, and remove audio scenes at the top of the MIX page.
-
-The MIX page is a mixer. Each sound has a strip, with its gain, pan, mute,
-delay, and meter, which apply in every audio scene holding it, and a send to
-each audio scene; each audio scene has a strip with its meter and a send to
-each other audio scene. A source added from BUILD's Add, or
-pasted, is sent to the audio scene on program, so it is heard at once.
-**On program** picks the audio scene the broadcast carries, and switching
-it, or editing an audio scene, never drops or repeats audio. A recording holds
-the audio scene on program unless Settings' Recording tab picks another, such as one
-keeping music the stream leaves out, and each published scene carries the one
-on program unless BUILD's inspector picks another beside its **Publish** switch;
-switching either while it runs never drops or repeats audio either. The audio
-scene on program cannot be removed; removing one a recording or published
-scene picks returns it to the one on program.
-
-**Listen** plays an audio scene to an audio output, from the `capture`
-feature's build, as the strip's **Listen** plays the audio scene on program: the system default, or the one picked under **Listen on**,
-which the studio remembers for you rather than in the scene file. Use
-headphones: a microphone that hears the speakers feeds its audio scene back
-into itself.
+rename, reorder, and remove audio scenes on the MIX page.
+
+The MIX page is a mixing desk. Each sound has a strip: its name, a meter, a
+fader for its gain in decibels (unity is marked, and a double click returns
+to it), its gain to read or type, and its mute, which turns amber while it
+is on. These apply in every audio scene holding the sound. Click a sound's
+name to open its strip to its gain, pan (a double click centers it), and
+delay, and the audio scenes it is heard in; the other strips narrow beside it
+rather than hide. Each audio scene has a strip after the sounds with its
+meter, on the same scale, and **Listen**. A meter's top is full scale, where
+its last segment turns red: the sound clips.
+
+Under each strip is a dot for each audio scene, marked with its initial:
+filled where the strip is sent into it, the accent's color for the one the
+stream carries; ringed where it is heard there only through another audio
+scene; and faint where it is not heard. A click sends it in or takes it out.
+An audio scene shows a dash under its own strip and under any it holds, which
+it cannot be sent back into. **Routes** shows the same sends as a matrix, a
+row for each sound and audio scene and a column for each audio scene, with
+what each one holds at its foot.
+
+A source added from BUILD's Add, or pasted, is sent to the
+audio scene on program, so it is heard at once. The audio scene on program is
+tagged **Stream hears this**; **Put on stream** on another's strip puts that
+one on program instead, and switching it, or editing an audio scene, never
+drops or repeats audio. **+** after the audio scenes adds one, holding
+nothing. Right-click an audio scene's strip, or its column under **Routes**,
+to rename it, move it left or right, or remove it. A recording holds the
+audio scene on program unless Settings' Recording tab picks another, such as one keeping music the stream leaves out, which is tagged
+**In the recording**, and each published scene carries the one on program
+unless BUILD's inspector picks another beside its **Publish** switch; switching
+either while it runs never drops or repeats audio either. The audio scene on
+program cannot be removed; removing one a recording or published scene picks
+returns it to the one on program.
+
+**Listen** on an audio scene's strip plays it to an audio output, from the
+`capture` feature's build: the system default, or the one picked from the tag
+on the strip while it plays, which the studio remembers for you rather than
+in the scene file. Use headphones: a microphone that hears the speakers feeds
+its audio scene back into itself.
A source's **delay** holds it back in every audio scene, up to 2 s, so a microphone
lines up with a camera that lags it. A broadcast's picture already follows its
diff --git a/quest/m0/pin-output-kind.md b/quest/m0/pin-output-kind.md
new file mode 100644
index 00000000..aa351b22
--- /dev/null
+++ b/quest/m0/pin-output-kind.md
@@ -0,0 +1,26 @@
+# [XS] moq-audio's output kind is pinned
+
+## Goal
+
+The `moq` submodule includes an output's kind on
+`moq_audio::playback::Device`: whether the system reports it as headphones
+or a headset, as speakers, or does not say.
+
+## Plan
+
+cpal 0.18, which moq-audio already uses, reports it as
+`DeviceDescription::device_type` on PipeWire and WASAPI, and as `Unknown`
+elsewhere. `playback::list` reads the description for the name already, so
+the change upstream is a field beside `name`, mapped from cpal's type so
+cpal stays out of moq-audio's API, with a test of the mapping.
+
+Once the wait clears, advance it with `just upgrade-moq` in its own PR,
+fixing whatever the new API breaks here.
+
+## Waiting
+
+- moq-dev/moq: `moq_audio::playback::Device` on moq's `main` reports an
+ output's kind. Check `rs/moq-audio/src/playback/device.rs` there. The
+ change has no quest in moq's tree yet; it was found by
+ [moq-dev/studio#178](https://github.com/moq-dev/studio/pull/178) and is
+ listed in its Follow-ups for `/quest-plan` there.
diff --git a/quest/m0/ux/README.md b/quest/m0/ux/README.md
index d609ceef..270c6ebc 100644
--- a/quest/m0/ux/README.md
+++ b/quest/m0/ux/README.md
@@ -140,7 +140,9 @@ quest links its own.
An agent can prove a page matches its mock-up's layout, that nothing clips at
any window size, and what a frame costs. It cannot judge these, so each child's
-PR hands them to the maintainer as `## Waiting` with what to look at:
+PR adds a follow-up quest for the maintainer to try the page, such as
+[Try the LIVE page](/quest/m0/ux/try-live.md), with a `Maintainer:` item saying
+what to look at, rather than waiting on it:
- **Taste:** whether the page reads as bold and calm at once. The PR shows its
screenshots beside the mock-up frames.
diff --git a/quest/m0/ux/listen-speakers.md b/quest/m0/ux/listen-speakers.md
new file mode 100644
index 00000000..14ef3a8e
--- /dev/null
+++ b/quest/m0/ux/listen-speakers.md
@@ -0,0 +1,25 @@
+# [S] Listen warns on speakers
+
+## Goal
+
+**Listen** on the MIX page warns, on the listened audio scene's strip and
+before it plays, when the output it plays on is not headphones and the audio
+scene carries a microphone: the one feedback loop the studio cannot prevent.
+Where the system cannot tell what an output is, it says nothing.
+
+## Plan
+
+Split from the MIX page, which landed Listen's output picker on the listened
+audio scene's strip (`Panels::listen_tag` in `rs/moq-studio/src/ui/mixer.rs`)
+but cannot tell headphones from speakers yet.
+
+- `mix::Speaker` carries the output's kind from
+ `moq_audio::playback::Device`, and the system default's kind is the
+ default device's.
+- The warning is amber, as everything that needs attention but is not an
+ error, and does not block Listen: a speaker in another room is fine.
+- A headset counts as headphones.
+
+## Required
+
+- [moq-audio's output kind is pinned](/quest/m0/pin-output-kind.md) - whether an output is headphones, where the system can tell
diff --git a/quest/m0/ux/mix.md b/quest/m0/ux/mix.md
deleted file mode 100644
index d22440d9..00000000
--- a/quest/m0/ux/mix.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# [L] The MIX page
-
-## Goal
-
-The MIX page of [`mock/mix.html`](/quest/m0/ux/mock/mix.html) replaces the
-Audio panel:
-
-- One strip per sound, with its icon and name, a tall meter, a fader, and a
- mute, and the audio scenes as master strips beside them.
-- Under each strip, where it is heard: one dot per audio scene. The audio
- scene the stream carries is marked as such, and any can be listened to
- with a headphone button.
-- A strip opens to its pan, its delay, and its filters.
-- The same sends as a matrix, for someone who thinks in routing.
-
-The LIVE page's sound strip is the same meters and mutes for the sounds the
-stream carries. On this page the bottom strip keeps the scene pads and the
-panic key and shows a small live picture where that sound strip sits
-elsewhere, so an operator riding a fader still sees what is on air.
-
-## Plan
-
-Nothing about mixing changes: gain, pan, mute, delay, sends, the audio scene
-on program, the recorded one, and Listen are as `README.md`'s Audio scenes
-section has them. "Audio scene" stays the word, since it was chosen over
-"mix" on 2026-11-06
-([moq-dev/studio#77](https://github.com/moq-dev/studio/pull/77)).
-
-- A strip opens in place and its neighbours narrow, so no meter is ever
- covered during a show. Strips and the matrix are two views of one page.
-- The output Listen plays on is picked on the listened audio scene's strip,
- not in Settings.
-- A fader is gain in decibels, with unity marked and a double click
- returning to it, as pan returns to center today.
-- The meter keeps the peak tick and the red at full scale of
- `rs/moq-studio/src/ui/levels.rs`, drawn as `kit::Meter`'s segments: red is
- a clip, an error. A muted sound's control is amber, as `kit.css` draws it.
-- A sound heard twice by construction cannot happen here, since an audio
- scene plays a sound once however it reaches it. Show that: a dot is filled
- when the sound reaches the audio scene by any route, and hollow-ringed when
- it does so only through another audio scene.
-- A microphone feeding the output it is heard on is the one loop the studio
- cannot prevent. Warn on Listen when the output is not headphones, where the
- system can tell.
-- [Audio filters](/quest/m0/audio-filters.md) and
- [clap to measure](/quest/m0/sync-clap.md) add their controls to the opened
- strip; this quest leaves their places.
-
-Human check: a real microphone and headphones, and whether the sends read at
-a glance to someone who has never seen an audio scene.
-
-## Related
-
-- [Audio filters](/quest/m0/audio-filters.md) - the filter chain an opened strip configures
-- [Clap-to-measure sync delay](/quest/m0/sync-clap.md) - the button beside a strip's delay
diff --git a/quest/m0/ux/mock/mix-mix.webp b/quest/m0/ux/mock/mix-mix.webp
index 7500c745..03ed8ddf 100644
Binary files a/quest/m0/ux/mock/mix-mix.webp and b/quest/m0/ux/mock/mix-mix.webp differ
diff --git a/quest/m0/ux/mock/mix-strip.webp b/quest/m0/ux/mock/mix-strip.webp
index 0c1a1698..7e4b4bb4 100644
Binary files a/quest/m0/ux/mock/mix-strip.webp and b/quest/m0/ux/mock/mix-strip.webp differ
diff --git a/quest/m0/ux/mock/mix.html b/quest/m0/ux/mock/mix.html
index 923acee7..3731ff88 100644
--- a/quest/m0/ux/mock/mix.html
+++ b/quest/m0/ux/mock/mix.html
@@ -67,12 +67,13 @@
/* masters: the audio scenes */
.strip.ms{width:auto;flex:1;background:linear-gradient(#1d1d27,#15151b);border-color:#3b3b4a}
.strip.ms .mt i{width:14px}
-.strip.ms .hd{gap:10px;justify-content:center}
+.strip.ms .hd{gap:6px;justify-content:center}
.strip.ms .nm2{font-size:18px;letter-spacing:.08em}
.strip.ms.pg{border-color:var(--accent);box-shadow:0 0 28px #4f8cff33}
.mtag{display:flex;align-items:center;gap:5px;height:18px;padding:0 7px;border-radius:4px;background:var(--p3);color:var(--dim);font:700 11px/1 var(--disp);letter-spacing:.1em;text-transform:uppercase;white-space:nowrap}
.mtag.air{background:var(--accent);color:#fff}
.mtag.sel{background:#4f8cff2b;color:#8db4ff}
+.mtag.ghost{background:var(--p2);box-shadow:inset 0 0 0 1px var(--line)}
.mtag svg.i{width:12px;height:12px}
.addms{width:40px;flex:none;border:2px dashed var(--line);border-radius:12px;display:grid;place-items:center;color:var(--dim)}
@@ -180,13 +181,15 @@
const dot=(c,i,l=1)=>`${c=='x'||!l?'':SC[i][0]}`;
const sends=s=>`
${[...s].map((c,i)=>dot(c,i)).join('')}
`;
const scale=`${[['+6',0],['0',14,'u'],['6',28],['12',42],['24',58],['36',72],['48',86],['60',100]].map(([t,y,c])=>`${t}`).join('')}
`;
-const fz=s=>`${s.db} dB`;
+const fz=s=>`${s.db} dB`;
+/* an audio scene has no gain or mute of its own: its meter on the same scale, and Listen */
+const mfz=s=>``;
const strip=s=>``;
const master=s=>`
-
${fz(s)}
-
${I('vol','sm')}
${I('phones','sm')}
${sends(s.s)}
`;
+ ${s.id}${s.n}
${s.pg?'':'
Put on stream'}${s.tag}
${mfz(s)}
+ ${sends(s.s)}`;
const legend=`Where each sound is heardsentthrough another audio scenenot heard
`;
const sub=v=>``;
const desk=(open)=>`
@@ -246,7 +249,7 @@
`;
const V={
- 'mix':{label:'MIX',cls:'M',note:'MIX. One strip per sound with a tall meter, a fader in decibels, and a mute; the audio scenes stand to the right as heavier master strips. The dots under a strip say where it is heard, one per audio scene: filled is sent, a ring arrives through another audio scene, and the accent is the one the stream hears. Any audio scene can be listened to with its headphone button. The dock stays underneath, so the scenes, the panic key, and the live picture stay on screen; the picture takes the slot where the sound strip sits on the other pages, since this page already is the sound.',
+ 'mix':{label:'MIX',cls:'M',note:'MIX. One strip per sound with a tall meter, a fader in decibels, and a mute; the audio scenes stand to the right as heavier master strips, with their meters on the same scale but no fader or mute, since an audio scene has no gain of its own. The dots under a strip say where it is heard, one per audio scene: filled is sent, a ring arrives through another audio scene, and the accent is the one the stream hears. Any audio scene can be listened to with its headphone button. The dock stays underneath, so the scenes, the panic key, and the live picture stay on screen; the picture takes the slot where the sound strip sits on the other pages, since this page already is the sound.',
html:()=>topbar('MIX')+sub('s')+desk()+mixdock(),
after:f=>{air(f,'game');const d=f.querySelector('.strip[data-id=mic] .sends .sd.v');d.classList.add('hov');
f.querySelector('.strip[data-id=mic]').insertAdjacentHTML('beforeend','Desk mic reaches Headphones through Stream
')}},
diff --git a/quest/m0/ux/settings.md b/quest/m0/ux/settings.md
index e1694e76..6b56dda0 100644
--- a/quest/m0/ux/settings.md
+++ b/quest/m0/ux/settings.md
@@ -25,7 +25,7 @@ bar.
## Plan
- The mock-up lists a Sound pane. Its one setting, the output Listen plays
- on, is on the [MIX page](/quest/m0/ux/mix.md) instead, so there is none.
+ on, is on the MIX page instead, so there is none.
The Guests pane has no frame; it follows the Stream pane's shape.
- Each setting keeps its home on disk: the scene file for what belongs to
the show (canvas, scene sizes, published scenes), per-user settings for
diff --git a/quest/m0/ux/try-mix.md b/quest/m0/ux/try-mix.md
new file mode 100644
index 00000000..ff6151c1
--- /dev/null
+++ b/quest/m0/ux/try-mix.md
@@ -0,0 +1,38 @@
+# [XS] Try the MIX page
+
+## Goal
+
+The maintainer tries the MIX page on their own machines and either signs it
+off or files what they find as quests: what the epic's
+[What a person must check](/quest/m0/ux/README.md) asks of it, which no
+headless run exercises.
+
+## Plan
+
+The MIX page (its strips, the audio scenes as master strips, the opened
+strip, and Routes) is on `main` (`cargo run -p moq-studio --features
+capture`; Listen and its output picker are disabled without `capture`).
+What to try, beside the [mock-up](/quest/m0/ux/mock/mix-mix.webp):
+
+- **Real devices:** a real microphone and headphones. **Listen** on an audio
+ scene, then pick the output from its **On …** tag; the meters moving with
+ real sound, the peak held, red only at a clip.
+- **Feel:** riding a fader with a mouse and a trackpad, whether the taper is
+ fine enough near unity, a double click returning to it; mute and unmute
+ during a show; opening a strip while the others narrow.
+- **Readability:** whether the send dots (filled, ringed when heard only
+ through another audio scene, faint when not heard) read at a glance to
+ someone who has never seen an audio scene. If they do not, **Routes** is
+ the fallback to point people at, and the legend's wording is the cheapest
+ thing to change.
+
+An agent then turns each finding into a quest, or an edit to the quest that
+owns that page, and deletes this one.
+
+## Waiting
+
+- Maintainer: try the MIX page as the Plan lists and report what to change,
+ or that nothing needs to. An agent cannot judge feel or taste, and the
+ agent hosts have no microphone or headphones; a kittest run already covers
+ the clicks (`shots::mix_sends_and_mutes`), and `just shots` the layout.
+ Check: a comment or quest records the result.
diff --git a/rs/moq-studio/shots/mix.toml b/rs/moq-studio/shots/mix.toml
new file mode 100644
index 00000000..a7d86266
--- /dev/null
+++ b/rs/moq-studio/shots/mix.toml
@@ -0,0 +1,96 @@
+# The show `just shots` renders the MIX views on: the shots' show with more
+# sounds, one muted and one turned down, and three audio scenes, one heard
+# through another.
+version = 1
+
+[canvas]
+width = 1920
+height = 1080
+framerate = 30
+
+[sources.host]
+kind = "image"
+path = "person.jpg"
+
+[sources.backdrop]
+kind = "color"
+color = "#101828"
+
+[sources.bar]
+kind = "color"
+color = "#2563ebe6"
+
+[sources.guest]
+kind = "broadcast"
+path = "room/guest"
+
+[sources.caller]
+kind = "broadcast"
+path = "room/caller"
+
+# Failed in a build without `capture`, which still gives it a strip.
+[sources.mic]
+kind = "microphone"
+
+[sources.music]
+kind = "broadcast"
+path = "room/music"
+
+[audio.mic]
+gain = 1.585 # +4 dB
+
+[audio.music]
+gain = 0.2 # -14 dB
+pan = -0.25
+
+[audio.caller]
+gain = 1.0
+muted = true
+
+[[scenes]]
+name = "Main"
+items = [
+ { source = "backdrop", rect = { x = 0, y = 0, width = 1920, height = 1080 } },
+ { source = "host", rect = { x = 0, y = 0, width = 1920, height = 1080 } },
+ { source = "bar", rect = { x = 80, y = 860, width = 900, height = 120 } },
+]
+
+[[scenes]]
+name = "Interview"
+items = [
+ { source = "backdrop", rect = { x = 0, y = 0, width = 1920, height = 1080 } },
+ { source = "host", rect = { x = 60, y = 270, width = 880, height = 495 } },
+ { source = "guest", rect = { x = 980, y = 270, width = 880, height = 495 } },
+]
+
+[[scenes]]
+name = "Break"
+safe = true # the scene the panic key cuts to
+items = [
+ { source = "backdrop", rect = { x = 0, y = 0, width = 1920, height = 1080 } },
+ { source = "bar", rect = { x = 460, y = 480, width = 1000, height = 120 } },
+]
+
+# A scene the program refuses, at a size of its own, whose pad says why.
+[[scenes]]
+name = "Vertical"
+size = { width = 1080, height = 1920 }
+items = [
+ { source = "backdrop", rect = { x = 0, y = 0, width = 1080, height = 1920 } },
+ { source = "host", rect = { x = 0, y = 656, width = 1080, height = 608 } },
+]
+
+[[audio_scenes]]
+name = "Stream"
+program = true
+sounds = ["caller", "guest", "mic", "music"]
+
+[[audio_scenes]]
+name = "Headphones"
+scenes = ["Stream"]
+sounds = ["caller"]
+
+[[audio_scenes]]
+name = "Recording"
+recorded = true
+sounds = ["guest", "mic"]
diff --git a/rs/moq-studio/src/kit/widgets.rs b/rs/moq-studio/src/kit/widgets.rs
index 25088a56..4ccd5b2a 100644
--- a/rs/moq-studio/src/kit/widgets.rs
+++ b/rs/moq-studio/src/kit/widgets.rs
@@ -87,6 +87,8 @@ pub struct IconButton<'a> {
/// The fill while lit, such as a mute while muted.
lit: Option,
size: f32,
+ /// How wide it is, if wider than tall, such as a strip's mute.
+ width: Option,
/// Said under the name, such as why it is disabled.
note: Option<&'a str>,
pose: Option,
@@ -102,11 +104,18 @@ impl<'a> IconButton<'a> {
look: Look::Plain,
lit: None,
size: 30.0,
+ width: None,
note: None,
pose: None,
}
}
+ /// Make it `width` wide, as a mixer strip's buttons fill the strip.
+ pub fn width(mut self, width: f32) -> Self {
+ self.width = Some(width);
+ self
+ }
+
/// The key that does the same, shown in the tooltip.
pub fn key(mut self, key: Option<&'a str>) -> Self {
self.key = key;
@@ -146,7 +155,8 @@ impl<'a> IconButton<'a> {
impl Widget for IconButton<'_> {
fn ui(self, ui: &mut Ui) -> Response {
- let (rect, response) = ui.allocate_exact_size(Vec2::splat(self.size), Sense::click());
+ let size = vec2(self.width.unwrap_or(self.size), self.size);
+ let (rect, response) = ui.allocate_exact_size(size, Sense::click());
response.widget_info(|| WidgetInfo::labeled(WidgetType::Button, ui.is_enabled(), self.name));
if ui.is_rect_visible(rect) {
let pose = self.pose.unwrap_or_else(|| Pose::of(&response));
@@ -503,35 +513,43 @@ impl Widget for Slider<'_> {
}
}
-/// A vertical fader over 0 to 1, as on a mixing desk: a slot and a cap.
-#[cfg_attr(
- not(test),
- expect(dead_code, reason = "the MIX page's strips draw with it: quest/m0/ux/mix.md")
-)]
+/// A vertical fader over 0 to 1, as on a mixing desk: a slot, a cap, and a
+/// line across the slot at a mark, such as unity gain.
pub struct Fader<'a> {
value: &'a mut f32,
height: f32,
+ mark: Option,
}
-#[cfg_attr(
- not(test),
- expect(dead_code, reason = "the MIX page's strips draw with it: quest/m0/ux/mix.md")
-)]
impl<'a> Fader<'a> {
+ /// How far in from its top and bottom the cap's center stops, so a scale
+ /// beside it lines up with its travel.
+ pub const INSET: f32 = 8.0;
+
pub fn new(value: &'a mut f32) -> Self {
- Self { value, height: 160.0 }
+ Self {
+ value,
+ height: 160.0,
+ mark: None,
+ }
}
pub fn height(mut self, height: f32) -> Self {
self.height = height;
self
}
+
+ /// Mark the value `at` across the slot, as unity on a gain fader.
+ pub fn mark(mut self, at: f32) -> Self {
+ self.mark = Some(at);
+ self
+ }
}
impl Widget for Fader<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let (rect, mut response) = ui.allocate_exact_size(vec2(28.0, self.height), Sense::drag());
- let travel = egui::Rangef::new(rect.top() + 8.0, rect.bottom() - 8.0);
+ let travel = egui::Rangef::new(rect.top() + Self::INSET, rect.bottom() - Self::INSET);
// The release too, so a move in its frame is kept.
if (response.dragged() || response.drag_stopped())
&& let Some(pos) = response.interact_pointer_pos()
@@ -548,6 +566,10 @@ impl Widget for Fader<'_> {
let painter = ui.painter();
let slot = Rect::from_center_size(rect.center(), vec2(8.0, rect.height()));
painter.rect_filled(slot, 4, Color32::BLACK);
+ if let Some(mark) = self.mark {
+ let y = egui::lerp(travel.max..=travel.min, mark);
+ painter.hline(rect.x_range().shrink(2.0), y, Stroke::new(2.0, FAINT));
+ }
let y = egui::lerp(travel.max..=travel.min, value);
let cap = Rect::from_center_size(pos2(rect.center().x, y), vec2(26.0, 16.0));
// A cap lit from above: light on top, darker below, and a groove.
@@ -567,7 +589,6 @@ impl Widget for Fader<'_> {
}
/// Fill `rect`, rounded by `corner`, from `top` down to `bottom`.
-#[cfg_attr(not(test), expect(dead_code, reason = "the fader's cap"))]
fn gradient(painter: &egui::Painter, rect: Rect, corner: u8, top: Color32, bottom: Color32) {
// The rounded body in the bottom color, its top half's gradient over it.
painter.rect_filled(rect, corner, bottom);
@@ -608,23 +629,31 @@ pub enum Run {
pub struct Meter {
level: f32,
peak: f32,
+ hot: f32,
run: Run,
size: Vec2,
}
-/// Where a meter turns from healthy to hot.
-const HOT: f32 = 0.7;
-
impl Meter {
+ /// Where a meter turns from healthy to hot, unless told otherwise.
+ pub const HOT: f32 = 0.7;
+
pub fn new(level: f32, peak: f32) -> Self {
Self {
level,
peak,
+ hot: Self::HOT,
run: Run::Across,
size: vec2(160.0, 9.0),
}
}
+ /// Turn hot from `at` along the run, for a meter on a scale of its own.
+ pub fn hot(mut self, at: f32) -> Self {
+ self.hot = at;
+ self
+ }
+
/// Run `run`, `size` points along it and across.
pub fn run(mut self, run: Run, along: f32, across: f32) -> Self {
self.run = run;
@@ -657,7 +686,7 @@ impl Widget for Meter {
for index in 0..count {
let at = (index as f32 + 0.5) / count as f32;
let lit = at <= self.level;
- let color = match (lit || index + 1 == peak, at >= HOT) {
+ let color = match (lit || index + 1 == peak, at >= self.hot) {
(false, _) => P3,
(true, false) => OK,
(true, true) if clipped && index + 1 == count => ERR,
@@ -1214,7 +1243,7 @@ impl<'a> TallyFrame<'a> {
}
/// Diagonal stripes of `color` filling `rect`, clipped to it.
-fn stripes(rect: Rect, color: Color32) -> Vec {
+pub fn stripes(rect: Rect, color: Color32) -> Vec {
let mut shapes = Vec::new();
let pitch = 24.0;
let rot = Rot2::from_angle(-std::f32::consts::FRAC_PI_4);
diff --git a/rs/moq-studio/src/shots.rs b/rs/moq-studio/src/shots.rs
index ac5d4dba..f38e1b2c 100644
--- a/rs/moq-studio/src/shots.rs
+++ b/rs/moq-studio/src/shots.rs
@@ -13,13 +13,14 @@ use std::sync::{Arc, OnceLock};
use std::time::Duration;
use eframe::egui_wgpu;
+use egui::accesskit::Role;
use egui_kittest::Harness;
-use egui_kittest::kittest::Queryable;
+use egui_kittest::kittest::{NodeT, Queryable};
use moq_scene::Source;
use moq_scene::source::Status;
use crate::fx::Effects;
-use crate::ui::{Inspect, Page, Setting, Side};
+use crate::ui::{Inspect, MixView, Page, Setting, Side};
use crate::{App, Window, autosave, engine, fx, hotkeys, setup};
/// The window's size, the mock-ups'.
@@ -49,6 +50,10 @@ enum Open {
/// Where a view turns the studio.
enum View {
Page(Page),
+ /// The MIX page in a view, with the strip of the sound named open.
+ Mix(MixView, Option<&'static str>),
+ /// MIX with Headphones' menu open, as a right click on its strip opens it.
+ MixMenu,
/// The BUILD page with `side` and `inspect` shown, and the layer of the
/// scene on program at `index`, front first, selected.
Build {
@@ -97,6 +102,16 @@ fn studio(view: View) -> Open {
}
}
+/// The studio on the MIX views' show, `size` large, turned to MIX in `view`
+/// with the strip of the sound called `opened` open.
+fn mixing(view: MixView, opened: Option<&'static str>, size: egui::Vec2) -> Open {
+ Open::Studio {
+ view: View::Mix(view, opened),
+ size,
+ show: "mix.toml",
+ }
+}
+
/// Whether a view draws the same picture every time.
#[derive(PartialEq)]
enum Motion {
@@ -167,11 +182,19 @@ views! {
build_off_air_refused: Still, studio(View::OffAir("Vertical"));
/// Too narrow for the banner beside the live picture, it goes under it.
build_off_air_compact: Still, Open::Studio { view: View::OffAir("Break"), size: HALF, show: "show.toml" };
- /// MIX holds the mixer, and a small live picture in the sound's place.
- mix: Still, studio(View::Page(Page::Mix));
- /// MIX in a stacked window, its live picture as tall as the sound's slot
- /// allows.
- mix_compact: Still, Open::Studio { view: View::Page(Page::Mix), size: HALF, show: "show.toml" };
+ /// MIX: a strip per sound and per audio scene, with their sends, and a
+ /// small live picture in the sound's place.
+ mix: Still, mixing(MixView::Strips, None, SIZE);
+ /// A sound's strip opened to its gain, pan, delay, and where it is heard,
+ /// its neighbours narrowed.
+ mix_strip: Still, mixing(MixView::Strips, Some("mic"), SIZE);
+ /// An audio scene's menu: rename, move, or remove it.
+ mix_menu: Still, Open::Studio { view: View::MixMenu, size: SIZE, show: "mix.toml" };
+ /// The same sends as a matrix.
+ mix_routes: Still, mixing(MixView::Routes, None, SIZE);
+ /// MIX in a stacked window, its strips scrolling, its live picture as
+ /// tall as the sound's slot allows.
+ mix_compact: Still, mixing(MixView::Strips, None, HALF);
/// REVIEW off air: without a relay the program keeps no past, which the
/// strip and both actions say, beside this show's recordings and clips.
review: Still, studio(View::Review { picked: false, replays: false });
@@ -538,6 +561,131 @@ fn studio_mode_cues_and_takes() {
quit(&engine, &runtime);
}
+/// MIX's send dots, an opened strip's switches, a mute, and the audio scene
+/// tags edit the show as a person clicking them does, each an edit undo
+/// names: on the MIX views' show, on a real engine. It draws no view.
+#[test]
+#[ignore = "draws on a GPU; run with `just shots`"]
+fn mix_sends_and_mutes() {
+ let (_show, runtime, gpu) = lavapipe();
+ let _entered = runtime.enter();
+ let fixture = Path::new(env!("CARGO_MANIFEST_DIR"));
+ std::fs::copy(fixture.join("shots/mix.toml"), "show.toml").unwrap();
+ let (mut harness, started, _) = window(start(launch(&gpu), &runtime), &gpu, &runtime, SIZE);
+ harness.step();
+ let App::Studio(studio) = &mut harness.state_mut().app else {
+ panic!("the studio starts on its first frame")
+ };
+ studio.mix(MixView::Strips, None);
+ let engine = started.get().expect("the studio started").clone();
+ runtime
+ .block_on(kio::clock::timeout(SETTLE, settle(&mut harness, &engine)))
+ .expect("the sources and pictures settle");
+ let scene = |name: &str| {
+ let state = engine.state.lock().unwrap();
+ state.collection().audio_scene(name).cloned().expect("the audio scene")
+ };
+ let undo = || {
+ let state = engine.state.lock().unwrap();
+ let history = state.history();
+ let at = history.position().checked_sub(1)?;
+ history.entries().nth(at).map(|edit| edit.label.clone())
+ };
+
+ // A dot sends a sound in, and again takes it out.
+ assert!(!scene("Recording").sounds.contains("music"));
+ harness.get_by_label("Send music to Recording").click();
+ harness.run_steps(2);
+ assert!(scene("Recording").sounds.contains("music"), "sent");
+ assert_eq!(undo().as_deref(), Some("Put `music` in `Recording`"));
+ harness.get_by_label("Send music to Recording").click();
+ harness.run_steps(2);
+ assert!(!scene("Recording").sounds.contains("music"), "taken out");
+
+ // A sound heard only through Stream, its dot a ring, is sent straight in.
+ harness.get_by_label("Send guest to Headphones").click();
+ harness.run_steps(2);
+ assert!(scene("Headphones").sounds.contains("guest"));
+
+ // An audio scene sends into another, but never into one it holds.
+ harness.get_by_label("Send Recording to Headphones").click();
+ harness.run_steps(2);
+ assert!(scene("Headphones").scenes.contains("Recording"));
+ assert!(
+ harness
+ .get_by_label("Send Headphones to Stream")
+ .accesskit_node()
+ .is_disabled(),
+ "Headphones holds Stream"
+ );
+
+ // A strip's name opens it to its controls, and again closes it.
+ assert!(harness.query_by_label("Delay").is_none());
+ harness.get_by_label("Open mic").click();
+ harness.run_steps(2);
+ assert!(harness.query_by_label("Delay").is_some(), "opened");
+ harness.get_by_label("Close mic").click();
+ harness.run_steps(2);
+ assert!(harness.query_by_label("Delay").is_none(), "closed");
+
+ // The mute, and putting another audio scene on the stream.
+ harness.get_all_by_label("Mute").next().expect("a mute").click();
+ harness.run_steps(2);
+ assert_eq!(undo().as_deref(), Some("Mute `guest`"));
+ harness
+ .get_all_by_label("Put on stream")
+ .next()
+ .expect("one off the stream")
+ .click();
+ harness.run_steps(2);
+ assert!(scene("Headphones").program && !scene("Stream").program);
+
+ // A new audio scene, with nothing in it.
+ harness.get_by_label("Add an audio scene").click();
+ harness.run_steps(2);
+ assert_eq!(scene("Audio scene 4").sounds.len(), 0);
+
+ // Its strip's menu renames it in a sheet, moves it, and removes it.
+ let names = || {
+ let state = engine.state.lock().unwrap();
+ let scenes = &state.collection().audio_scenes;
+ scenes.iter().map(|scene| scene.name.clone()).collect::>()
+ };
+ harness.get_by_label("Audio scene Audio scene 4").click_secondary();
+ harness.run_steps(2);
+ harness.get_by_label("Rename").click();
+ harness.run_steps(2);
+ harness.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
+ harness.get_by_role(Role::TextInput).type_text("Talkback");
+ harness.run_steps(2);
+ harness.get_by_label("Rename").click();
+ harness.run_steps(2);
+ assert_eq!(names(), ["Stream", "Headphones", "Recording", "Talkback"]);
+ assert_eq!(
+ undo().as_deref(),
+ Some("Rename audio scene `Audio scene 4` to `Talkback`")
+ );
+ harness.get_by_label("Audio scene Talkback").click_secondary();
+ harness.run_steps(2);
+ harness.get_by_label("Move left").click();
+ harness.run_steps(2);
+ assert_eq!(names(), ["Stream", "Headphones", "Talkback", "Recording"]);
+ harness.get_by_label("Audio scene Talkback").click_secondary();
+ harness.run_steps(2);
+ harness.get_by_label("Remove").click();
+ harness.run_steps(2);
+ assert_eq!(names(), ["Stream", "Headphones", "Recording"]);
+ // The one the stream hears cannot be removed.
+ harness.get_by_label("Audio scene Headphones").click_secondary();
+ harness.run_steps(2);
+ assert!(harness.get_by_label("Remove").accesskit_node().is_disabled());
+ harness.key_press(egui::Key::Escape);
+ harness.run_steps(2);
+
+ drop(harness);
+ quit(&engine, &runtime);
+}
+
/// Draw what `open` opens on a fresh engine, from a scene file in `shows`.
fn shoot(open: &Open, gpu: &engine::Gpu, runtime: &tokio::runtime::Runtime, shows: &Path) -> image::RgbaImage {
if let &Open::Kit { sheet } = open {
@@ -575,6 +723,8 @@ fn shoot(open: &Open, gpu: &engine::Gpu, runtime: &tokio::runtime::Runtime, show
};
match view {
View::Page(page) => studio.turn(*page),
+ View::Mix(view, opened) => studio.mix(*view, *opened),
+ View::MixMenu => studio.mix(MixView::Strips, None),
View::Build { side, inspect, index } => studio.build(*side, *inspect, *index),
View::Menu => studio.build(Side::Layers, Inspect::Layer, Some(1)),
View::Setting(setting) => studio.open(*setting),
@@ -602,6 +752,10 @@ fn shoot(open: &Open, gpu: &engine::Gpu, runtime: &tokio::runtime::Runtime, show
.expect("the sources and pictures settle");
match view {
View::Hover => hover(&mut harness),
+ View::MixMenu => {
+ harness.get_by_label("Audio scene Headphones").click_secondary();
+ harness.run_steps(4);
+ }
View::Menu => {
// The row comes before the inspector's tab of the same name.
harness.get_all_by_label("host").next().unwrap().click_secondary();
@@ -619,12 +773,31 @@ fn shoot(open: &Open, gpu: &engine::Gpu, runtime: &tokio::runtime::Runtime, show
}
_ => {}
}
+ fresh_glyphs(&mut harness);
let image = harness.render().unwrap();
drop(harness);
quit(&engine, runtime);
image
}
+/// Pack egui's glyphs anew from the frame about to be drawn. They are packed
+/// in the order text first appears, and a glyph's edge samples its
+/// neighbour's, so a view whose text changed while it settled, such as the
+/// health dot's on a show with a failed source, would otherwise draw a pixel
+/// differently from run to run. New font definitions repack the atlas.
+fn fresh_glyphs(harness: &mut Harness<'_, Window>) {
+ let ctx = harness.ctx.clone();
+ let fonts = ctx.fonts(|fonts| fonts.definitions().clone());
+ let mut other = fonts.clone();
+ other
+ .families
+ .insert(egui::FontFamily::Name("repack".into()), Vec::new());
+ ctx.set_fonts(other);
+ harness.step();
+ ctx.set_fonts(fonts);
+ harness.step();
+}
+
/// A window on `app`, `size` large, where the studio it starts is kept, and
/// whether it was asked to close.
fn window<'a>(
diff --git a/rs/moq-studio/src/ui.rs b/rs/moq-studio/src/ui.rs
index c6f1aa00..4f4ba85c 100644
--- a/rs/moq-studio/src/ui.rs
+++ b/rs/moq-studio/src/ui.rs
@@ -41,7 +41,9 @@ mod review;
mod settings;
mod shell;
-use levels::{Levels, meter};
+use levels::Levels;
+#[cfg(test)]
+pub(crate) use mixer::View as MixView;
/// The smallest the window gets, at which every part still has room.
pub const MIN_SIZE: egui::Vec2 = layout::MIN;
@@ -206,13 +208,13 @@ impl Studio {
duration: Transition::default().duration().unwrap_or_default(),
cut: STINGER_CUT,
drag: None,
- new_scene: String::new(),
renaming: None,
title_needs: 0.0,
renaming_audio: None,
renaming_pad: None,
speaker: None,
- speakers: Speakers::default(),
+ speakers: mixer::Speakers::default(),
+ desk: mixer::Desk::default(),
canvas: None,
sizes: BTreeMap::new(),
add: AddSource::default(),
@@ -247,6 +249,13 @@ impl Studio {
self.panels.page = page;
}
+ /// Turn to MIX in `view`, with the strip of the sound called `opened`
+ /// open, as clicking its name would.
+ pub(crate) fn mix(&mut self, view: mixer::View, opened: Option<&str>) {
+ self.panels.page = Page::Mix;
+ self.panels.desk = mixer::Desk::new(view, opened);
+ }
+
/// Open Settings at `setting`, as the gear would.
pub(crate) fn open(&mut self, setting: Setting) {
self.panels.setting = Some(setting);
@@ -504,20 +513,22 @@ struct Panels {
drag: Option,
/// The layer row being dragged to a new place, by its index.
moving: Option,
- new_scene: String,
/// The scene being renamed, by index, and the name typed so far.
renaming: Option<(usize, String)>,
/// The width the title bar's full controls took when last drawn, past
/// which it draws them compact.
title_needs: f32,
- /// The audio scene being renamed, by its name, and the name typed so far.
+ /// The audio scene its strip's sheet renames, by name, and the name typed
+ /// so far.
renaming_audio: Option<(String, String)>,
/// The scene its pad's sheet renames, by name, and the name typed so far.
renaming_pad: Option<(String, String)>,
/// The output Listen plays on, by [`mix::Speaker::id`], or `None` for the
/// system default. Saved per user, not in the shared scene file.
speaker: Option,
- speakers: Speakers,
+ speakers: mixer::Speakers,
+ /// The MIX page's view and the strip open on it.
+ desk: mixer::Desk,
/// The canvas the Show tab's form holds until it is applied, or `None`
/// while it shows the collection's.
canvas: Option