diff --git a/CHANGELOG.md b/CHANGELOG.md index 630524a5..6e6320fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,3 +34,6 @@ Nothing has been released yet. The first release, 0.1.0, will cover what is on ` - Expanded windows for Tremolo, Auto-Panner, Chorus, Flanger, Phaser and Ring Mod: a large plot of the effect's motion or frequency response with a time or frequency axis, units and a legend, which you can drag to set its rate and depth (or feedback or bias), In and Out meters, and every control on one row. +- An expanded window for Character Mod: the circuit's motion in its own unit (delay, sweep, gain or pan) with the + band it travels and a legend, the circuit and LFO controls on one card, and a rack card with Input, the circuit's + artifacts, Depth-M and Depth-S, Seed (click for the next take), Mono and Output. diff --git a/README.md b/README.md index 4c409d56..71f45b65 100644 --- a/README.md +++ b/README.md @@ -122,8 +122,8 @@ framed by tools/art/render.mjs. Device comes with 44 devices of its own. Each one is a single declarative definition (parameters, panel layout and factory presets) that the model, undo, saving, automation, engine and panel all derive from, with a C++ DSP kernel behind it. Auto Filter, Channel EQ and Character EQ also open an expanded window with a large display and live analyser, -In and Out meters and every control laid out in rows, and so do Tremolo, Auto-Panner, Chorus, Flanger, Phaser and -Ring Mod, whose window plots their motion or response with a time or frequency axis and a legend; the other devices +In and Out meters and every control laid out in rows, and so do Tremolo, Auto-Panner, Chorus, Flanger, Phaser, +Ring Mod and Character Mod, whose window plots their motion or response with a time or frequency axis and a legend; the other devices open their card in a window for now. [docs/devices.md](docs/devices.md) explains how they work and how to add one. diff --git a/crates/dstudio-app/src/device_fields.rs b/crates/dstudio-app/src/device_fields.rs index 49f5fb7a..b1bab89a 100644 --- a/crates/dstudio-app/src/device_fields.rs +++ b/crates/dstudio-app/src/device_fields.rs @@ -13,9 +13,9 @@ //! gain or position over 3.35 LFO cycles (the span at the default 0.51 Hz). use dstudio_core::builtin::character_mod::{ - CIRCUITS, CROSSED, ENSEMBLE, FLANGER, MODE_PARAMS, PANNER, PHASER, PHOTOCELL, ROTARY, SINGLE, TAPE, TREMOLO, TWIN, + CHARACTER_MOD, CIRCUITS, CROSSED, ENSEMBLE, FLANGER, MODE_PARAMS, PANNER, PHASER, PHOTOCELL, ROTARY, SINGLE, TAPE, TREMOLO, TWIN, }; -use dstudio_core::builtin::{DIVISION_QUARTERS, synced_hz}; +use dstudio_core::builtin::{DIVISION_QUARTERS, MOD_NOTE_QUARTERS, synced_hz}; use std::f32::consts::{PI, TAU}; use std::sync::OnceLock; @@ -81,6 +81,8 @@ pub struct Axis { pub end: String, /// The legend sits at the right end of the caption row instead of under the axis. pub legend_in_caption: bool, + /// The window caption's label when the picture names it (Character Mod's circuit). + pub caption: String, } /// Legend glyph of a series. @@ -872,6 +874,17 @@ fn character_mod(i: &Input) -> Plot { let n = i.n.max(2); let values: Vec> = series.iter().map(|(f, _)| (0..n).map(|k| f(k as f32 / (n - 1) as f32 * SPAN)).collect()).collect(); let (lo, hi) = values.iter().flatten().fold((f32::MAX, f32::MIN), |(a, b), v| (a.min(*v), b.max(*v))); + if i.win { + let hz = i.lfo_hz("rate", "note", MOD_NOTE_QUARTERS); + let label = match MODE_PARAMS[circuit as usize] { + Some(mp) => { + let modes = CHARACTER_MOD.param(mp).map_or(&[][..], |p| p.choices); + format!("{} \u{00b7} {}", CIRCUITS[circuit as usize], modes.get(mode).copied().unwrap_or("")) + } + None => CIRCUITS[circuit as usize].to_string(), + }; + return character_mod_window(unit, &values, (lo, hi), charmod_names(circuit, mode, values.len()), SPAN, hz, label); + } // Axis, ticks, rest line and caption per unit; y_of maps a value to 0..1. let (y_of, ticks, rest, readout, band): (Box f32>, Vec<(f32, String)>, Option, String, bool) = match unit { Unit::Ms => { @@ -935,6 +948,108 @@ fn character_mod(i: &Input) -> Plot { } } +/// Names of Character Mod's series in the window legend. +fn charmod_names(circuit: u32, mode: usize, n: usize) -> Vec<&'static str> { + let names: &[&'static str] = match circuit { + ENSEMBLE => &["Voice 1", "Voice 2", "Voice 3"], + PHASER if mode == 4 => &["Voice 1", "Voice 2", "Voice 3"], + TAPE if mode > 0 => &["Left", "Right", "Dry"], + TREMOLO if mode == 2 => &["Low", "High"], + ROTARY => &["Horn", "Drum"], + PANNER => &["Pan"], + _ => &["Left", "Right"], + }; + names.iter().copied().take(n).collect() +} + +/// Character Mod's window picture: the circuit's ruler (delay in ms, a log sweep in Hz, +/// gain in dB or pan), one rule per LFO cycle along the time axis, the band its series +/// travel, and a legend naming each series. +fn character_mod_window( + unit: Unit, + values: &[Vec], + (lo, hi): (f32, f32), + names: Vec<&'static str>, + span: f32, + hz: f32, + caption: String, +) -> Plot { + let (y_of, ticks, rest, readout, foot, band): (Box f32>, Vec<(f32, String)>, Option, String, &str, bool) = + match unit { + Unit::Ms => { + let top = axis_top(hi); + let step = [0.5f32, 1.0, 2.0, 2.5, 5.0, 10.0, 20.0].into_iter().find(|s| top / s <= 6.0).unwrap_or(10.0); + let ticks = (0..=((top / (step / 2.0)) + 1e-4).floor() as usize) + .map(|k| { + let v = k as f32 * step / 2.0; + let label = if k % 2 == 0 { num(v) } else { String::new() }; + (1.0 - v / top, label) + }) + .collect(); + (Box::new(move |v| lin(v, top, 0.0)), ticks, Some(1.0), format!("{lo:.1} \u{2013} {hi:.1} ms"), "ms delay", true) + } + Unit::Hz => { + let (a, b) = (WIN_HZ.0.ln(), WIN_HZ.1.ln()); + let ticks = + [50.0f32, 100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0].iter().map(|f| ((b - f.ln()) / (b - a), hz_tick(*f))).collect(); + let rest = (b - 1000f32.ln()) / (b - a); + ( + Box::new(move |v| lin(v.max(1.0).ln(), b, a)), + ticks, + Some(rest), + format!("{} \u{2013} {}", khz_text(lo), khz_text(hi)), + "Hz sweep", + true, + ) + } + Unit::Db => { + let ticks = (0..=8) + .map(|k| { + let db = -3.0 * k as f32; + (db / -24.0, if k % 2 == 0 { rung(db) } else { String::new() }) + }) + .collect(); + let readout = if lo <= -90.0 { "\u{221e} dB".into() } else { format!("{:.1} dB", -lo) }; + (Box::new(|v| lin(v, 0.0, -24.0)), ticks, Some(0.0), readout, "dB gain", true) + } + Unit::Pos => { + let ticks = [(0.0, "L"), (0.25, ""), (0.5, "C"), (0.75, ""), (1.0, "R")].iter().map(|(y, l)| (*y, l.to_string())).collect(); + let readout = format!("\u{00b1}{}%", (lo.abs().max(hi.abs()) * 100.0).round()); + (Box::new(|v| lin(v, -1.0, 1.0)), ticks, Some(0.5), readout, "pan", true) + } + }; + let traces: Vec = values + .iter() + .enumerate() + .map(|(k, v)| Trace { ys: v.iter().map(|x| y_of(*x)).collect(), style: WIN_SERIES[k.min(WIN_SERIES.len() - 1)] }) + .collect(); + let mut legend: Vec<(Mark, String)> = + names.iter().enumerate().map(|(k, n)| (Mark::Line(WIN_SERIES[k.min(WIN_SERIES.len() - 1)]), n.to_string())).collect(); + if band && !values.is_empty() { + legend.push((Mark::Band, "Sweep".into())); + } + let mut axis = motion_axis(span, hz, foot); + axis.caption = caption; + Plot { readout, ticks, rest, traces, fill: if band { Fill::Band } else { Fill::None }, widths: (1.75, 2.5), live: None, axis, legend } +} + +/// Character Mod's window sweep ruler (Hz). +const WIN_HZ: (f32, f32) = (40.0, 8000.0); + +/// Character Mod's window series: the first voice solid, then dashed and dotted. +const WIN_SERIES: [Style; 3] = [Style::Solid, Style::Dash { on: 5.0, off: 4.0, alpha: 0.6 }, Style::Dash { on: 1.5, off: 3.0, alpha: 0.6 }]; + +/// A sweep's frequency with its unit: 144 Hz, 2.00 kHz, 12.0 kHz. +fn khz_text(f: f32) -> String { + if f >= 10_000.0 { + format!("{:.1} kHz", f / 1000.0) + } else if f >= 1000.0 { + format!("{:.2} kHz", f / 1000.0) + } else { + format!("{f:.0} Hz") + } +} + #[cfg(test)] mod tests { use super::*; @@ -987,6 +1102,22 @@ mod tests { assert!(plot_of("flanger", &[], None).axis.ticks.is_empty()); } + /// Character Mod's window names its circuit, reads the sweep in its own unit and + /// lists every series plus the band. + #[test] + fn character_mod_window_names_circuit_and_series() { + let p = window_plot_of("character-mod"); + assert_eq!(p.axis.caption, "Twin BBD \u{00b7} I"); + assert_eq!(p.axis.foot, "ms delay"); + assert!(p.readout.ends_with(" ms"), "{}", p.readout); + let names: Vec<&str> = p.legend.iter().map(|l| l.1.as_str()).collect(); + assert_eq!(names, ["Left", "Right", "Sweep"]); + assert_eq!(p.fill, Fill::Band); + assert_eq!(charmod_names(ENSEMBLE, 0, 3), ["Voice 1", "Voice 2", "Voice 3"]); + assert_eq!(khz_text(1265.0), "1.26 kHz"); + assert_eq!(khz_text(144.0), "144 Hz"); + } + #[test] fn window_time_labels() { assert_eq!(time_text(0.25), "250 ms"); diff --git a/crates/dstudio-app/src/device_window.rs b/crates/dstudio-app/src/device_window.rs index ca4f7d29..da4c0941 100644 --- a/crates/dstudio-app/src/device_window.rs +++ b/crates/dstudio-app/src/device_window.rs @@ -75,7 +75,11 @@ const DRIVE_STEPS: [f32; 4] = [0.0, 25.0, 50.0, 75.0]; pub(crate) const ACT_ANALYZER: i32 = 7; /// The analyser's Hold view latch. pub(crate) const ACT_HOLD: i32 = 8; +/// Character Mod: play the next take (seed). +pub(crate) const ACT_SEED: i32 = 9; const PILL_GHOST: i32 = 6; +/// Character Mod's Mode parameter of each circuit (Ensemble has none). +const CM_MODES: [Option<&str>; 11] = dstudio_core::builtin::character_mod::MODE_PARAMS; const PILL_GHOST_LATCH: i32 = 7; /// panel-menu code of the band picker (a menu of the EQ's bands). pub(crate) const MENU_BANDS: i32 = -3; @@ -89,7 +93,7 @@ pub(crate) fn has_window(def: &DeviceDef) -> bool { /// Windows of the plotted-field family (motion and response pictures). fn is_field_window(def: &DeviceDef) -> bool { - matches!(def.id, "tremolo" | "autopanner" | "chorus" | "flanger" | "phaser" | "ring-mod") + matches!(def.id, "tremolo" | "autopanner" | "chorus" | "flanger" | "phaser" | "ring-mod" | "character-mod") } /// The frame of a device's window: content width, display box (x, y, w, h), the @@ -122,6 +126,7 @@ pub(crate) fn kit(def: &DeviceDef) -> Kit { "chorus" | "flanger" => field_kit(WIN_W, 354.0, 56.0, 44.0), "phaser" => field_kit(WIN_W, 374.0, 56.0, 44.0), "ring-mod" => field_kit(860.0, 254.0, 40.0, 29.0), + "character-mod" => field_kit(WIN_W, 222.0, 60.0, 44.0), _ => eq(56.0, 394.0), } } @@ -381,6 +386,8 @@ fn pill_w(label: &str) -> f32 { "Tame" => 55.0, "Off" | "On" => 41.5, "2x" => 37.8, + "Lo" => 37.8, + "Hi" => 35.7, "4x" => 38.3, _ => (crate::text_measure::value_width(label) * 1.2 + 24.0).ceil(), } @@ -491,6 +498,10 @@ enum Item { Knob(&'static str, &'static str, i32, f32, bool), /// On / off toggle column (56 wide): parameter, name, inert. Toggle(&'static str, &'static str, bool), + /// On / off toggle column of a given width: parameter, name, width. + ToggleW(&'static str, &'static str, f32), + /// One lit pill that runs a window action: action, label, name, width. + Action(i32, String, &'static str, f32), /// Picker column: parameter (or a menu code), label, name, width, inert. Picker(i32, String, &'static str, f32, bool), /// Pill row column: parameter, labels with their values, name, width. @@ -506,6 +517,8 @@ impl Item { match self { Item::Knob(_, _, _, w, _) => *w, Item::Toggle(..) => 56.0, + Item::ToggleW(.., w) => *w, + Item::Action(.., w) => *w, Item::Picker(_, _, _, w, _) => *w, Item::Pills(.., w) => *w, Item::ActionPills(_, _, _, _, w, _) => *w, @@ -753,6 +766,19 @@ impl Controller { p.inert = inert; b.name(x, 56.0, row.name_y(), name, inert); } + Item::ToggleW(id, name, w) => { + let on = val(id) >= 0.5; + let label = if on { "On" } else { "Off" }; + let pw = pill_w(label); + b.rect(BOX_TRACK, x + (w - pw - 4.0) / 2.0, top + row.pill - 2.0, pw + 4.0, 28.0); + b.pill(PILL_TOGGLE, idx(id), 0, x + (w - pw) / 2.0, top + row.pill, pw, label, on); + b.name(x, w, row.name_y(), name, false); + } + Item::Action(action, label, name, w) => { + let pw = pill_w(&label); + b.pill(PILL_ACTION, action, 1, x + (w - pw) / 2.0, top + row.pill, pw, &label, true); + b.name(x, w, row.name_y(), name, false); + } Item::Picker(param, label, name, w, inert) => { let p = b.pill(PILL_PICKER, param, 0, x + w / 2.0, top + row.pill, 0.0, &label, false); p.inert = inert; @@ -893,6 +919,9 @@ impl Controller { /// (Ring Mod: its modulator), the device's own selector, then its secondary knobs. /// Returns the window's content height. fn field_window(&self, d: &Device, def: &'static DeviceDef, b: &mut Builder, y: f32) -> f32 { + if def.id == "character-mod" { + return self.character_mod_window(d, def, b, y); + } let val = |id: &str| def.param(id).map_or(0.0, |p| self.panel_value(d, def, p)); let rate = if val("sync") >= 0.5 { "rate_sync" } else { "rate" }; let lfo = || { @@ -949,6 +978,65 @@ impl Controller { y + row.h + 16.0 } + /// Character Mod's two cards: the circuit and its motion, then its rack (Input, the + /// circuit's artifacts, the mid / side depths, Seed and Mono, Output). A control the + /// circuit lacks leaves the row, and the gutters close up around it. + fn character_mod_window(&self, d: &Device, def: &'static DeviceDef, b: &mut Builder, y: f32) -> f32 { + let val = |id: &str| def.param(id).map_or(0.0, |p| self.panel_value(d, def, p)); + let idx = |id: &str| def.index_of(id).map_or(-1, |i| i as i32); + let label = |id: &str| def.param(id).map(|p| p.format(val(id))).unwrap_or_default(); + let circuit = (val("model").round().max(0.0) as usize).min(CM_MODES.len() - 1); + let mut character = vec![Item::Picker(idx("model"), label("model"), "Character", 112.0, false)]; + if let Some(mode) = CM_MODES[circuit] { + character.push(Item::Picker(idx(mode), label(mode), "Mode", 104.0, false)); + } + let rate = if val("sync") >= 0.5 { "note" } else { "rate" }; + let main = Row::main(y); + self.win_card( + d, + def, + b, + main, + vec![ + (character, 10.0), + ( + vec![ + Item::Pills("sync", vec![("Free", 0.0), ("Sync", 1.0)], "Timebase", 108.0), + Item::Knob(rate, "Rate", 2, 70.0, false), + Item::Knob("depth", "Depth", 2, 70.0, false), + Item::Knob("mix", "Mix", 1, 56.0, false), + ], + 10.0, + ), + ( + vec![ + Item::Knob("width", "Width", 1, 56.0, false), + Item::Knob("drift", "Drift", 1, 56.0, false), + Item::Knob("voice", "Voice", 1, 56.0, false), + ], + 10.0, + ), + ], + ); + let shown = |id: &str| def.is_shown(d, id); + let artifacts: Vec = [("art_hiss", "Hiss"), ("art_drive", "Drive"), ("art_darken", "Darken"), ("art_wow", "Wow")] + .into_iter() + .filter(|(id, _)| shown(id)) + .map(|(id, name)| Item::Knob(id, name, 1, 56.0, false)) + .collect(); + let mut clusters = vec![(vec![Item::Pills("input", vec![("Off", 0.0), ("Lo", 1.0), ("Hi", 2.0)], "Input", 120.0)], 10.0)]; + if !artifacts.is_empty() { + clusters.push((artifacts, 10.0)); + } + clusters.push((vec![Item::Knob("depth_m", "Depth-M", 1, 60.0, false), Item::Knob("depth_s", "Depth-S", 1, 60.0, false)], 10.0)); + let take = format!("Take {}", val("seed").round() as i32); + clusters.push((vec![Item::Action(ACT_SEED, take, "Seed", 96.0), Item::ToggleW("mono_audition", "Mono", 64.0)], 10.0)); + clusters.push((vec![Item::Knob("trim", "Output", 1, 56.0, false)], 10.0)); + let rack = Row::rack(y + main.h + 12.0); + self.win_card(d, def, b, rack, clusters); + rack.y + rack.h + 16.0 + } + // ------------------------------------------------------------ EQs /// Band pills of an EQ header: the selected band lit, bands out of the chain dimmed. @@ -1265,6 +1353,14 @@ impl Controller { self.devices.wins.analyzer.insert(device, view); let _ = self.engine.builtin_set_spectrum(device.0, view.engine_mode()); } + (ACT_SEED, _) => { + let Some(p) = def.param("seed") else { return }; + let span = (p.max - p.min + 1.0).round() as i32; + let cur = def.value(d, p).round() as i32 - p.min as i32; + let step = if value < 0 { -1 } else { 1 }; + let next = p.min + (cur + step).rem_euclid(span) as f32; + self.panel_commit(Command::SetDeviceParam { device, param: p.id.into(), value: next }); + } (ACT_HOLD, _) => { if !self.devices.wins.held.remove(&device) { self.devices.wins.held.insert(device); @@ -1416,7 +1512,7 @@ mod tests { #[test] fn field_windows_show_the_plot_and_every_control() { use slint::Model; - for id in ["tremolo", "autopanner", "chorus", "flanger", "phaser", "ring-mod"] { + for id in ["tremolo", "autopanner", "chorus", "flanger", "phaser", "ring-mod", "character-mod"] { let (c, did, def) = controller_with(id); assert!(has_window(def), "{id}"); let v = view(&c, did, def); @@ -1440,7 +1536,7 @@ mod tests { #[ignore] fn bench_field_windows() { let n = 500; - for id in ["tremolo", "autopanner", "chorus", "flanger", "phaser", "ring-mod"] { + for id in ["tremolo", "autopanner", "chorus", "flanger", "phaser", "ring-mod", "character-mod"] { let (c, did, def) = controller_with(id); let d = c.project().device(did).unwrap().clone(); let t0 = std::time::Instant::now(); @@ -1457,6 +1553,35 @@ mod tests { } } + /// Character Mod: two cards; the rack drops the artifacts a circuit lacks, and the + /// Seed pill plays the next take, wrapping at the end. + #[test] + fn character_mod_window_rows_follow_the_circuit() { + use slint::Model; + let (mut c, did, def) = controller_with("character-mod"); + let v = view(&c, did, def); + assert!((v.h / Z - 520.0).abs() < 0.5, "{}", v.h / Z); + assert_eq!( + knob_names(&v), + ["Rate", "Depth", "Mix", "Width", "Drift", "Voice", "Hiss", "Drive", "Darken", "Depth-M", "Depth-S", "Output"] + ); + let take = |c: &Controller| view(c, did, def).pills.iter().find(|p| p.param == ACT_SEED).map(|p| p.label.to_string()); + assert_eq!(take(&c).as_deref(), Some("Take 1")); + c.win_action(did, ACT_SEED, 1); + assert_eq!(take(&c).as_deref(), Some("Take 2")); + c.win_action(did, ACT_SEED, -1); + c.win_action(did, ACT_SEED, -1); + assert_eq!(take(&c).as_deref(), Some("Take 9999")); + // Panner has no artifacts but Wow-free circuits keep the rest; Ensemble has no Mode. + let model = def.index_of("model").unwrap() as i32; + c.win_choice(did, model, 10); + let names = knob_names(&view(&c, did, def)); + assert!(!names.iter().any(|n| n == "Hiss" || n == "Drive" || n == "Darken"), "{names:?}"); + c.win_choice(did, model, 3); + let modes = view(&c, did, def).texts.iter().filter(|t| t.text == "Mode").count(); + assert_eq!(modes, 0, "Ensemble has no Mode picker"); + } + /// Character EQ's lower card shows one section at a time. #[test] fn character_eq_sections_switch_the_lower_card() { diff --git a/crates/dstudio-app/src/device_window_fields.rs b/crates/dstudio-app/src/device_window_fields.rs index a38fc0cd..d37606b9 100644 --- a/crates/dstudio-app/src/device_window_fields.rs +++ b/crates/dstudio-app/src/device_window_fields.rs @@ -30,8 +30,9 @@ const STRONG: f32 = 0.13; const INK_LO: f32 = 0.3; const INK_HI: f32 = 0.92; const LEGEND_INK: f32 = 0.7; -/// The accent wash under a motion curve. +/// The accent wash under a motion curve, and the band a sweep travels. const WASH: f32 = 0.28; +const BAND: f32 = 0.16; /// Series widths: the subject, and a dashed second series. const W_MAIN: f32 = 1.75; const W_DASH: f32 = 1.25; @@ -78,10 +79,10 @@ impl Controller { // Caption: the name and the picture's one value, on the band above the plot. let base = (CAPTION_BASELINE - t) * Z; - let label = caption(def, &f); + let label: String = if plot.axis.caption.is_empty() { caption(def, &f).into() } else { plot.axis.caption.clone() }; let lx = if def.id == "ring-mod" { 0.0 } else { 2.0 * Z }; - texts.push(PanelText { weight: 700, ..text(lx, base - 4.4 * Z, 140.0 * Z, label, MUTE_TEXT, 12.0 * Z, 0) }); - let vx = lx + (label_w(label) + CAPTION_GAP) * Z; + texts.push(PanelText { weight: 700, ..text(lx, base - 4.4 * Z, 240.0 * Z, label.clone(), MUTE_TEXT, 12.0 * Z, 0) }); + let vx = lx + (label_w(&label) + CAPTION_GAP) * Z; texts.push(text(vx, base - 4.7 * Z, 260.0 * Z, plot.readout.clone(), white(INK_HI), 13.0 * Z, 0)); // The ladder: a rule per rung (the rest line stronger), numerals in the left margin. @@ -152,6 +153,15 @@ impl Controller { rgba(accent, WASH), )); } + if plot.fill == Fill::Band { + let ys = plot.traces.iter().flat_map(|t| t.ys.iter().copied()); + let (top, bottom) = ys.fold((f32::MAX, f32::MIN), |(a, b), y| (a.min(y), b.max(y))); + if top <= bottom { + let y0 = top.clamp(0.0, 1.0) * ph; + let y1 = (bottom.clamp(0.0, 1.0) * ph).max(y0 + 1.0); + paths.push(fill(format!("M0 {y0:.1} L{pw:.1} {y0:.1} L{pw:.1} {y1:.1} L0 {y1:.1} Z"), rgba(accent, BAND))); + } + } for tr in plot.traces.iter().skip(1) { if let Style::Dash { on, off, alpha } = tr.style { paths.push(stroke(dashed(&points(&tr.ys), on * Z, off * Z), white(alpha), W_DASH * Z)); @@ -171,8 +181,10 @@ impl Controller { for ((mark, name), w) in plot.legend.iter().zip(widths) { match mark { Mark::Band => { - paths - .push(fill(format!("M{x:.1} {:.1} h{glyph:.1} v{:.1} h{:.1} Z", y - 4.0 * Z, 8.0 * Z, -glyph), rgba(accent, WASH))); + paths.push(fill( + format!("M{x:.1} {:.1} h{glyph:.1} v{:.1} h{:.1} Z", y - 4.0 * Z, 8.0 * Z, -glyph), + rgba(accent, if plot.fill == Fill::Band { BAND } else { WASH }), + )); } Mark::Line(Style::Solid) => paths.push(stroke(format!("M{x:.1} {y:.1} L{:.1} {y:.1}", x + glyph), white(1.0), W_MAIN * Z)), &Mark::Line(Style::Dash { on, off, alpha }) => { @@ -202,7 +214,7 @@ impl Controller { paths: model(paths), texts: model(texts), zones: model(vec![zone]), - label: label.into(), + label: label.as_str().into(), value: plot.readout.into(), ..Default::default() } diff --git a/docs/devices.md b/docs/devices.md index 78a2ffe8..51b007d0 100644 --- a/docs/devices.md +++ b/docs/devices.md @@ -64,7 +64,7 @@ flowchart LR expanded window (`device_window.rs`, `ui/device_window.slint`) when the device has one (`device_window::has_window`; Auto Filter, Channel EQ, Character EQ and the plotted-field family: Tremolo, Auto-Panner, Chorus, - Flanger, Phaser and Ring Mod), otherwise the card itself in a window. A + Flanger, Phaser, Ring Mod and Character Mod), otherwise the card itself in a window. A window is a face 960 pt wide (Ring Mod 860): a top bar (power, presets, the device's header pills), a large display (the card's canvas drawn at window size with its axis and legend), In / Out meters, and rows of controls laid out with the same @@ -72,7 +72,10 @@ flowchart LR window's display (`device_window_fields.rs`) asks the card's curve model in `device_fields.rs` for its window form (`Input::win`): a taller ladder, a time or frequency axis with units under the plot, and a legend naming each - series; dragging the plot moves the card field's two parameters. The + series; dragging the plot moves the card field's two parameters. Character + Mod's picture reads in its circuit's own unit (ms delay, Hz sweep, dB gain or + pan) with the band its series travel, and its rack card drops the artifacts + a circuit lacks; its Seed pill plays the next take (`ACT_SEED`). The meters read `se_builtin_set_metering` / `se_builtin_levels` (`Engine::builtin_levels(id, &mut [f32; 4])`): while a window is open the audio thread keeps the input and output peak of each block, and the app