Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ Nothing has been released yet. The first release, 0.1.0, will cover what is on `
for a new instrument track; double-clicking an instrument with no instrument track selected adds one.
- Expanded windows for Auto Filter, Channel EQ and Character EQ, with a large display, a live analyser (Pre, Post or
Off, and Hold view), In and Out meters and every control laid out in rows, including Character EQ's band Drive.
- 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.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ framed by <code>tools/art/render.mjs</code>.</sub>
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; the other devices open their card in a window for now.
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
open their card in a window for now.
[docs/devices.md](docs/devices.md) explains how they work and how to add one.

| Kind | Devices |
Expand Down
16 changes: 8 additions & 8 deletions crates/dstudio-app/src/device_canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ fn model<T: Clone + 'static>(v: Vec<T>) -> ModelRc<T> {
ModelRc::from(Rc::new(VecModel::from(v)))
}

fn rgba(c: Color, a: f32) -> Color {
pub(crate) fn rgba(c: Color, a: f32) -> Color {
Color::from_argb_u8((a.clamp(0.0, 1.0) * 255.0).round() as u8, c.red(), c.green(), c.blue())
}

fn white(a: f32) -> Color {
pub(crate) fn white(a: f32) -> Color {
rgba(Color::from_rgb_u8(255, 255, 255), a)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ impl Plot {
}
}

fn path(pts: &[(f32, f32)]) -> String {
pub(crate) fn path(pts: &[(f32, f32)]) -> String {
use std::fmt::Write;
let mut out = String::with_capacity(pts.len() * 16);
for (i, (x, y)) in pts.iter().enumerate() {
Expand All @@ -171,7 +171,7 @@ fn area(pts: &[(f32, f32)], base: f32) -> String {
}

/// A polyline as dashes of `on` px with `off` px gaps along its length.
fn dashed(pts: &[(f32, f32)], on: f32, off: f32) -> String {
pub(crate) fn dashed(pts: &[(f32, f32)], on: f32, off: f32) -> String {
use std::fmt::Write;
let mut out = String::new();
let mut phase = 0.0f32; // distance into the current on + off period
Expand Down Expand Up @@ -211,16 +211,16 @@ fn hline(y: f32, x0: f32, x1: f32) -> String {
format!("M{x0:.1} {y:.1} L{x1:.1} {y:.1}")
}

fn stroke(commands: String, color: Color, width: f32) -> PanelPath {
pub(crate) fn stroke(commands: String, color: Color, width: f32) -> PanelPath {
PanelPath { commands: s(commands), stroke: color, width, fill: Color::from_argb_u8(0, 0, 0, 0), fill2: Color::from_argb_u8(0, 0, 0, 0) }
}

fn fill(commands: String, color: Color) -> PanelPath {
pub(crate) fn fill(commands: String, color: Color) -> PanelPath {
PanelPath { commands: s(commands), stroke: Color::from_argb_u8(0, 0, 0, 0), width: 0.0, fill: color, fill2: color }
}

/// Text whose x is its left (align 0), centre (1) or right (2) edge and y its centre line.
fn text(x: f32, y: f32, w: f32, t: impl Into<SharedString>, color: Color, size: f32, align: i32) -> PanelText {
pub(crate) fn text(x: f32, y: f32, w: f32, t: impl Into<SharedString>, color: Color, size: f32, align: i32) -> PanelText {
let left = match align {
0 => x,
1 => x - w / 2.0,
Expand Down Expand Up @@ -404,7 +404,7 @@ fn win_legend(p: &Plot, entries: &[(Legend, &str)], accent: Color, paths: &mut V
}
}

const MUTE_TEXT: Color = Color::from_rgb_u8(0xa6, 0xa8, 0xad);
pub(crate) const MUTE_TEXT: Color = Color::from_rgb_u8(0xa6, 0xa8, 0xad);

// ---------------------------------------------------------------- EQ

Expand Down
Loading
Loading