Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

perf(ui): waveforms at unity, scaled by the volume where they are drawn, a bar every four pixels

Jareer2430478e6742
diff --git a/src/crates/concat/src/format.rs b/src/crates/concat/src/format.rs
index b61f4dcc..f5ea1588 100644
--- a/src/crates/concat/src/format.rs
+++ b/src/crates/concat/src/format.rs
@@ -149,97 +149,88 @@ pub fn hex_of(colour: slint::Color) -> String {
)
}
-/// Where a bar goes hot: the peak level, as a fraction of full scale,
-/// above which the part of the bar that is over it is drawn in the hot
-/// colour. -6 dBFS. A mix that keeps its peaks under this has headroom; one
-/// that crosses it often is on its way to clipping, which is the thing a
-/// glance at the lane should catch.
-pub const WAVE_HOT: f32 = 0.5012;
-
-/// A drawn waveform: two sets of SVG path commands in a 1x1 box, drawn on
-/// top of each other. See [`wave_path`].
-#[derive(Clone, Debug, Default, PartialEq)]
-pub struct Wave {
- /// Every column's bar, from the floor up to its peak or to
- /// [`WAVE_HOT`], whichever is lower.
- pub body: String,
- /// The part of each bar over [`WAVE_HOT`], for the columns that reach
- /// it; empty when none does.
- pub hot: String,
-}
-
/// A waveform as SVG path commands in a 1x1 box: one column per slot, each
/// a bar standing on the floor, as tall as the loudest sample under it.
/// A level meter laid along the clip rather than the mirrored fish of a
-/// waveform: the height of a bar is a level, read from one edge, and the
-/// part of it above [`WAVE_HOT`] is a second path so it can be drawn in a
-/// colour that says so.
+/// waveform: the height of a bar is a level, read from one edge.
+///
+/// Drawn at unity gain, always. The clip's volume is applied where the
+/// path is drawn, as a scale on its height, so a drag on the volume knob
+/// moves the picture without asking for a new path: at two thousand bars
+/// a rebuild, a parse and a tessellation per knob tick was the lag in the
+/// lane. The part of a bar over the hot line is drawn there too, as the
+/// same bars again in the hot colour, clipped to the band above the line.
///
/// Built from the engine's real peaks at the level that fits the column:
/// each column takes the extremes of the buckets under it, so a trim shows
/// the material it kept and a zoom shows the buckets it reveals. `columns`
/// is how many the drawing has room for - the clip's width in pixels, held
-/// to a few thousand - and the paths are normalised so the Path that
-/// renders them stretches the box onto the clip's current width.
+/// to a few thousand - and the path is normalised so the Path that renders
+/// it stretches the box onto the clip's current width.
pub fn wave_path(
peaks: &concat_media::Pyramid,
source_start: f32,
duration: f32,
- gain: f32,
columns: usize,
-) -> Wave {
+) -> String {
/// Fewest columns worth drawing, and the most: enough that a clip a
/// screen wide reads a column a pixel, few enough that the string stays
/// under a few hundred kilobytes.
- const COLUMNS: std::ops::RangeInclusive<usize> = 8..=2048;
+ const COLUMNS: std::ops::RangeInclusive<usize> = 8..=512;
/// Silence still draws a sliver: a hairline along the floor of a clip
/// rather than a gap in it.
const FLOOR: f32 = 0.024;
if duration.is_nan() || duration <= 0.0 || peaks.finest().is_empty() {
- return Wave::default();
+ return String::new();
}
let columns = columns.clamp(*COLUMNS.start(), *COLUMNS.end());
- let gain = gain.max(0.0);
let level = peaks.level_for(duration / columns as f32);
- let mut body = String::with_capacity(columns * 56);
- let mut hot = String::new();
+ let mut path = String::with_capacity(columns * 56);
+ // Each bar is the peak of everything under its pitch, drawn on the
+ // leading three quarters of it: the last quarter is the gap that
+ // makes it a bar and not a run of columns.
+ let pitch = 1.0 / columns as f32;
for column in 0..columns {
- let left = column as f32 / columns as f32;
- let right = (column + 1) as f32 / columns as f32;
+ let left = column as f32 * pitch;
let (low, high) = level.extremes(
source_start + left * duration,
- source_start + right * duration,
+ source_start + (left + pitch) * duration,
);
- let amplitude = (high.max(-low) * gain).clamp(0.0, 1.0).max(FLOOR);
- let top = 1.0 - amplitude.min(WAVE_HOT);
- body.push_str(&format!(
+ let right = left + pitch * WAVE_BAR;
+ let top = 1.0 - high.max(-low).clamp(0.0, 1.0).max(FLOOR);
+ path.push_str(&format!(
"M {left:.4} {top:.4} L {right:.4} {top:.4} \
L {right:.4} 1.0000 L {left:.4} 1.0000 Z "
));
- if amplitude > WAVE_HOT {
- let (peak, limit) = (1.0 - amplitude, 1.0 - WAVE_HOT);
- hot.push_str(&format!(
- "M {left:.4} {peak:.4} L {right:.4} {peak:.4} \
- L {right:.4} {limit:.4} L {left:.4} {limit:.4} Z "
- ));
- }
}
- Wave { body, hot }
+ path
}
-/// How many columns a clip `seconds` long gets at `seconds_per_pixel`: one
-/// a pixel, rounded up to the next sixty-four so a zoom rebuilds the path
-/// at each step of that and not at every pixel, held to what `wave_path`
-/// draws.
+/// A bar's pitch on screen, in pixels: one bar, and the gap after it,
+/// every four. Fewer bars than pixels by that factor, and a rebuild, a
+/// parse and a tessellation a quarter the size: at a zoom where seconds
+/// of audio sit under a pixel, a bar a pixel was work that drew nothing
+/// a bar every four does not.
+pub const WAVE_PITCH: f32 = 4.0;
+
+/// How much of a pitch the bar takes; the rest is the gap.
+pub const WAVE_BAR: f32 = 0.75;
+
+/// How many bars a clip `seconds` long gets at `seconds_per_pixel`: one a
+/// [`WAVE_PITCH`], rounded up to the next sixteen so a zoom rebuilds the
+/// path at each step of that and not at every pixel, held to what
+/// `wave_path` draws - past the cap a bar is a little wider than its
+/// pitch, on a clip already wider than a screen.
pub fn wave_columns(seconds: f32, seconds_per_pixel: f32) -> usize {
if seconds.is_nan() || seconds <= 0.0 || seconds_per_pixel.is_nan() || seconds_per_pixel <= 0.0
{
return 8;
}
- let pixels = (seconds / seconds_per_pixel).ceil().max(1.0) as usize;
- pixels.div_ceil(64).max(1).saturating_mul(64).clamp(8, 2048)
+ let pixels = (seconds / seconds_per_pixel).ceil().max(1.0);
+ let bars = (pixels / WAVE_PITCH).ceil() as usize;
+ bars.div_ceil(16).max(1).saturating_mul(16).clamp(8, 512)
}
/// A moment in the past, in the words a recents row wants: "just now",
@@ -381,84 +372,40 @@ mod tests {
}
#[test]
- fn a_waveform_has_one_column_per_slot_and_follows_the_gain() {
+ fn a_waveform_has_one_floored_bar_per_column() {
let peaks = concat_media::Pyramid::of(concat_media::Peaks {
min: vec![-0.5; 2000],
max: vec![0.5; 2000],
buckets_per_second: 1000.0,
});
- let loud = wave_path(&peaks, 0.0, 2.0, 1.0, 128);
- let quiet = wave_path(&peaks, 0.0, 2.0, 0.25, 128);
- assert_eq!(loud.body.matches('M').count(), 128);
+ let wave = wave_path(&peaks, 0.0, 2.0, 128);
+ assert_eq!(wave.matches('M').count(), 128);
// A bar stands on the floor: its top is one less its height.
assert!(
- loud.body.contains(" 0.5000 L") && loud.body.contains(" 1.0000 Z"),
- "half amplitude at unity gain, floored: {}",
- loud.body
- );
- assert!(loud.hot.is_empty(), "half scale is under the hot line");
- assert!(
- quiet.body.contains(" 0.8750 L"),
- "an eighth at a quarter gain: {}",
- quiet.body
+ wave.contains(" 0.5000 L") && wave.contains(" 1.0000 Z"),
+ "half amplitude, floored: {wave}"
);
- assert_eq!(wave_path(&peaks, 0.0, 0.0, 1.0, 128), Wave::default());
- assert_eq!(wave_path(&peaks, 0.0, f32::NAN, 1.0, 128), Wave::default());
+ assert!(wave_path(&peaks, 0.0, 0.0, 128).is_empty());
+ assert!(wave_path(&peaks, 0.0, f32::NAN, 128).is_empty());
// The column count is held to what is worth drawing, either way.
+ assert_eq!(wave_path(&peaks, 0.0, 2.0, 0).matches('M').count(), 8);
assert_eq!(
- wave_path(&peaks, 0.0, 2.0, 1.0, 0)
- .body
- .matches('M')
- .count(),
- 8
+ wave_path(&peaks, 0.0, 2.0, 1_000_000).matches('M').count(),
+ 512
);
- assert_eq!(
- wave_path(&peaks, 0.0, 2.0, 1.0, 1_000_000)
- .body
- .matches('M')
- .count(),
- 2048
- );
- }
-
- /// A bar over the hot line is two bars: the body stops at the line,
- /// and the hot path carries what is over it, and nothing else. A bar
- /// under it has no hot part; a gain can push it over.
- #[test]
- fn only_the_part_of_a_bar_over_the_hot_line_goes_hot() {
- let peaks = concat_media::Pyramid::of(concat_media::Peaks {
- min: vec![-0.8; 1000],
- max: vec![0.8; 1000],
- buckets_per_second: 1000.0,
+ // A bar takes three quarters of its pitch; the rest is the gap.
+ let eight = wave_path(&peaks, 0.0, 2.0, 8);
+ assert!(eight.contains("M 0.0000 0.5000 L 0.0938 0.5000"), "{eight}");
+ assert!(eight.contains("M 0.1250 0.5000 L 0.2188 0.5000"), "{eight}");
+ // Silence is a sliver on the floor, never a gap.
+ let silence = concat_media::Pyramid::of(concat_media::Peaks {
+ min: vec![0.0; 100],
+ max: vec![0.0; 100],
+ buckets_per_second: 100.0,
});
- let wave = wave_path(&peaks, 0.0, 1.0, 1.0, 10);
- let limit = format!("{:.4}", 1.0 - WAVE_HOT);
- assert!(
- wave.body.contains(&format!(" {limit} L")),
- "the body stops at the line: {}",
- wave.body
- );
- assert!(
- !wave.body.contains(" 0.2000 "),
- "and never reaches the peak"
- );
- assert_eq!(wave.hot.matches('M').count(), 10, "every column is over");
- assert!(
- wave.hot.contains(" 0.2000 L") && wave.hot.contains(&format!(" {limit} Z")),
- "the hot part runs from the peak down to the line: {}",
- wave.hot
- );
-
- let under = wave_path(&peaks, 0.0, 1.0, 0.5, 10);
- assert!(under.hot.is_empty(), "at half gain nothing is over");
- assert!(under.body.contains(" 0.6000 L"), "{}", under.body);
- let pushed = wave_path(&peaks, 0.0, 1.0, 2.0, 10);
- assert_eq!(
- pushed.hot.matches('M').count(),
- 10,
- "a gain can push it over"
- );
- assert!(pushed.hot.contains(" 0.0000 L"), "clamped at full scale");
+ let flat = wave_path(&silence, 0.0, 1.0, 10);
+ assert_eq!(flat.matches('M').count(), 10);
+ assert!(flat.contains(" 0.9760 L"), "{flat}");
}
/// A zoomed-in clip reads the fine buckets: a single loud millisecond
@@ -476,39 +423,40 @@ mod tests {
max,
buckets_per_second: 1000.0,
});
- // A full-scale spike is a column whose hot part reaches the top.
- let fine = wave_path(&peaks, 0.0, 1.0, 1.0, 1000);
+ // A full-scale spike is a column whose bar reaches the top.
+ let fine = wave_path(&peaks, 0.0, 1.0, 1000);
assert_eq!(
- fine.hot.matches('M').count(),
+ fine.matches(" 0.0000 L").count(),
1,
- "one column carries the spike: {}",
- fine.hot
+ "one column carries the spike: {fine}"
);
- assert!(fine.hot.contains(" 0.0000 L"), "at full height");
- let coarse = wave_path(&peaks, 0.0, 1.0, 1.0, 10);
+ let coarse = wave_path(&peaks, 0.0, 1.0, 10);
assert_eq!(
- coarse.hot.matches('M').count(),
+ coarse.matches(" 0.0000 L").count(),
1,
"the spike survives the fold, in one column"
);
- assert!(coarse.hot.contains(" 0.0000 L"), "at full height");
- let trimmed = wave_path(&peaks, 0.6, 0.4, 1.0, 10);
+ let trimmed = wave_path(&peaks, 0.6, 0.4, 10);
assert!(
- trimmed.hot.is_empty(),
+ !trimmed.contains(" 0.0000 L"),
"a trim past the spike does not show it"
);
}
#[test]
- fn columns_follow_the_zoom_in_steps_of_sixty_four() {
- assert_eq!(wave_columns(10.0, 0.05), 256, "200 px rounds up to 256");
- assert_eq!(wave_columns(10.0, 0.01), 1024);
+ fn bars_follow_the_zoom_in_steps_of_sixteen() {
+ assert_eq!(
+ wave_columns(10.0, 0.05),
+ 64,
+ "200 px is 50 bars, rounds up to 64"
+ );
+ assert_eq!(wave_columns(10.0, 0.01), 256, "1000 px is 250 bars");
assert_eq!(
wave_columns(600.0, 0.01),
- 2048,
+ 512,
"held to the most worth drawing"
);
- assert_eq!(wave_columns(0.1, 0.05), 64, "never under a step");
+ assert_eq!(wave_columns(0.1, 0.05), 16, "never under a step");
assert_eq!(wave_columns(0.0, 0.05), 8);
assert_eq!(wave_columns(f32::NAN, 0.05), 8);
assert_eq!(wave_columns(10.0, 0.0), 8);
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index 8b718b04..4ec46c13 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -1311,7 +1311,7 @@ pub fn run() -> Result<(), slint::PlatformError> {
.peaks
.get(&plan.media)
.filter(|_| plan.kind == ClipKind::Audio)
- .map(|peaks| format::wave_path(peaks, 0.0, plan.duration, 1.0, 128).body)
+ .map(|peaks| format::wave_path(peaks, 0.0, plan.duration, 32))
.unwrap_or_default();
let document = chips::drag_chip_svg(
chips::chip_glyph(plan.kind),
diff --git a/src/crates/concat/src/panes/media_bin.rs b/src/crates/concat/src/panes/media_bin.rs
index 082c131f..6cab0823 100644
--- a/src/crates/concat/src/panes/media_bin.rs
+++ b/src/crates/concat/src/panes/media_bin.rs
@@ -295,13 +295,13 @@ impl MediaBin {
self.visible(studio.project())
.into_iter()
.map(|item| {
- // A card is a couple of hundred pixels: a column each is
- // all the detail it can show.
+ // A card is a couple of hundred pixels: a bar every few
+ // of them is all the detail it can show.
let wave = match studio.peaks.get(&item.id) {
Some(peaks) if item.kind == model::MediaKind::Audio => {
- wave_path(peaks, 0.0, item.duration.unwrap_or(0.0) as f32, 1.0, 256)
+ wave_path(peaks, 0.0, item.duration.unwrap_or(0.0) as f32, 64)
}
- _ => Default::default(),
+ _ => String::new(),
};
MediaItemData {
id: *self.rows.get(&item.id).unwrap_or(&0),
@@ -315,8 +315,7 @@ impl MediaBin {
.unwrap_or_default()
.into(),
thumbnail: self.thumbs.get(&item.id).cloned().unwrap_or_default(),
- wave: wave.body.as_str().into(),
- wave_hot: wave.hot.as_str().into(),
+ wave: wave.as_str().into(),
selected: self.selected.contains(&item.id),
}
})
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 7656a48e..30ff1f48 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -543,7 +543,7 @@ pub struct Studio {
window_pending: HashSet<String>,
/// Envelopes, keyed by the things they are computed from. A move
/// changes none of them, and a publish happens on every frame of one.
- waves: RefCell<HashMap<String, (SharedString, SharedString)>>,
+ waves: RefCell<HashMap<String, SharedString>>,
// ── the view ──
/// The timeline's view: scroll, zoom, tool, and what the lanes know
@@ -2107,29 +2107,27 @@ impl Studio {
/// whole body, a picture clip's band under its frames; a picture that
/// is muted, or whose file has no sound, shows the empty band.
///
- /// Two paths: the bars, and the part of each bar over the hot line -
- /// see `format::wave_path`.
- fn wave(&self, clip: &Clip) -> (SharedString, SharedString) {
+ /// At unity: the clip's volume scales the drawing in the lane, so a
+ /// volume drag never comes here - see `format::wave_path`.
+ fn wave(&self, clip: &Clip) -> SharedString {
if clip.muted == Some(true) {
- return Default::default();
+ return SharedString::new();
}
// The stream this clip plays; its peaks come when they are decoded,
// and until then the lane is bare rather than showing another
// track's shape.
let art = art_key(&clip.media_id, clip.audio_stream);
let Some(peaks) = self.peaks.get(&art) else {
- return Default::default();
+ return SharedString::new();
};
let step = |seconds: f32| (seconds * WAVE_STEPS).round() / WAVE_STEPS;
let (source_start, duration) = (step(clip.source_start as f32), step(clip.duration as f32));
- let gain = clip.volume as f32;
let columns = wave_columns(clip.duration as f32, self.lanes.seconds_per_pixel);
- let key = format!("{art}|{source_start:.3}|{duration:.3}|{gain:.3}|{columns}");
+ let key = format!("{art}|{source_start:.3}|{duration:.3}|{columns}");
if let Some(cached) = self.waves.borrow().get(&key) {
return cached.clone();
}
- let wave = wave_path(peaks, source_start, duration, gain, columns);
- let built = (SharedString::from(wave.body), SharedString::from(wave.hot));
+ let built = SharedString::from(wave_path(peaks, source_start, duration, columns));
self.waves.borrow_mut().insert(key, built.clone());
built
}
@@ -5008,8 +5006,7 @@ impl Studio {
.map(|text| text.content.as_str())
.unwrap_or_default()
.into(),
- wave: wave.0,
- wave_hot: wave.1,
+ wave,
strip: self.strip_of(clip),
}
})
diff --git a/src/crates/concat/ui/primitives/wave.slint b/src/crates/concat/ui/primitives/wave.slint
new file mode 100644
index 00000000..3cd834bd
--- /dev/null
+++ b/src/crates/concat/ui/primitives/wave.slint
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
+
+import { Theme } from "../theme/theme.slint";
+
+// A waveform drawn: the bars in `tint`, scaled by `gain` from the floor
+// up, and the part of them over the hot line drawn again in the hot colour
+// - the same path, clipped to the band above the line. The path is at
+// unity (see `format::wave_path`), so the gain is a layout property here
+// and a volume drag costs no rebuild; a gain over one pushes the bars past
+// the top and the box clips them, which is what full scale looks like.
+export component Wave inherits Rectangle {
+ in property <string> commands;
+ in property <float> gain: 1;
+ in property <brush> tint;
+
+ property <length> bars-h: root.height * Math.max(0, root.gain);
+
+ clip: true;
+
+ Path {
+ x: 0;
+ y: root.height - root.bars-h;
+ width: root.width;
+ height: root.bars-h;
+ commands: root.commands;
+ viewbox-width: 1;
+ viewbox-height: 1;
+ fit: fill;
+ fill: root.tint;
+ }
+
+ Rectangle {
+ x: 0;
+ y: 0;
+ width: root.width;
+ height: root.height * (1 - Theme.wave-hot-line);
+ clip: true;
+
+ Path {
+ x: 0;
+ y: root.height - root.bars-h;
+ width: root.width;
+ height: root.bars-h;
+ commands: root.commands;
+ viewbox-width: 1;
+ viewbox-height: 1;
+ fit: fill;
+ fill: Theme.wave-hot;
+ }
+ }
+}
+
diff --git a/src/crates/concat/ui/theme/theme.slint b/src/crates/concat/ui/theme/theme.slint
index 93bd3272..fb93cf83 100644
--- a/src/crates/concat/ui/theme/theme.slint
+++ b/src/crates/concat/ui/theme/theme.slint
@@ -158,6 +158,11 @@ export global Theme {
out property <color> wave: dark ? Dark.wave : Light.wave;
out property <color> wave-video: dark ? Dark.wave-video : Light.wave-video;
out property <color> wave-hot: dark ? Dark.wave-hot : Light.wave-hot;
+ /// Where a waveform's bar goes hot: the peak level, as a fraction of
+ /// full scale, above which the part of the bar over it is drawn in
+ /// `wave-hot`. -6 dBFS: a mix that keeps its peaks under it has
+ /// headroom, one that crosses it often is on its way to clipping.
+ out property <float> wave-hot-line: 0.5012;
// clip ink
out property <color> clip-ink: dark ? Dark.clip-ink : Light.clip-ink;
diff --git a/src/crates/concat/ui/timeline/lanes.slint b/src/crates/concat/ui/timeline/lanes.slint
index fef6af3a..0c5b0ef1 100644
--- a/src/crates/concat/ui/timeline/lanes.slint
+++ b/src/crates/concat/ui/timeline/lanes.slint
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
+import { Wave } from "../primitives/wave.slint";
import { Theme } from "../theme/theme.slint";
import { Fmt, Payload } from "../util.slint";
import { Glyph, Icon } from "../icons.slint";
@@ -208,28 +209,17 @@ component Clip inherits Rectangle {
// The bars stand on the clip's floor, as tall as the level under
// them, and the part of a bar over the hot line is drawn again in
// the hot colour on top: a level meter laid along the clip, so a
- // stretch that is too loud is seen without being heard.
- if root.item.wave != "" && !root.banded: Path {
+ // stretch that is too loud is seen without being heard. The path
+ // is at unity and the clip's volume scales its height here, so a
+ // volume drag moves the picture without a new path from Rust.
+ if root.item.wave != "" && !root.banded: Wave {
x: 0;
y: 0;
width: parent.width;
height: parent.height;
commands: root.item.wave;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: Theme.wave;
- }
- if root.item.wave-hot != "" && !root.banded: Path {
- x: 0;
- y: 0;
- width: parent.width;
- height: parent.height;
- commands: root.item.wave-hot;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: Theme.wave-hot;
+ gain: root.item.volume;
+ tint: Theme.wave;
}
// The floor the bars stand on.
@@ -328,27 +318,14 @@ component Clip inherits Rectangle {
background: Theme.line;
}
- if root.item.wave != "": Path {
+ if root.item.wave != "": Wave {
x: 0;
y: 1px;
width: parent.width;
height: parent.height - 1px;
commands: root.item.wave;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: Theme.wave-video;
- }
- if root.item.wave-hot != "": Path {
- x: 0;
- y: 1px;
- width: parent.width;
- height: parent.height - 1px;
- commands: root.item.wave-hot;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: Theme.wave-hot;
+ gain: root.item.volume;
+ tint: Theme.wave-video;
}
// The floor the bars stand on.
diff --git a/src/crates/concat/ui/timeline/model.slint b/src/crates/concat/ui/timeline/model.slint
index f6436e6e..9fb91c84 100644
--- a/src/crates/concat/ui/timeline/model.slint
+++ b/src/crates/concat/ui/timeline/model.slint
@@ -112,9 +112,6 @@ export struct ClipData {
/// that draws it is `fit: fill`, which stretches the box onto whatever
/// width the clip currently has. Built once in Rust, where the peaks are.
wave: string,
- /// The part of each bar over the hot line, on the same terms, drawn
- /// over `wave` in the hot colour; empty when no bar reaches it.
- wave-hot: string,
/// The frames a picture clip tiles along its body; `frames` is 0 when
/// there are none yet.
strip: StripData,
diff --git a/src/crates/concat/ui/workspace/media-pane.slint b/src/crates/concat/ui/workspace/media-pane.slint
index 1199002a..0235aa28 100644
--- a/src/crates/concat/ui/workspace/media-pane.slint
+++ b/src/crates/concat/ui/workspace/media-pane.slint
@@ -10,6 +10,7 @@ import { TextAlignment } from "../timeline/model.slint";
import { CatalogueEntryData, Library } from "../inspector/clip-inspector.slint";
import { SearchField } from "../inspector/controls.slint";
import { Select } from "../primitives/select.slint";
+import { Wave } from "../primitives/wave.slint";
// The library pane: a strip of pages across the top, then a narrow category
// sidebar and the browsing area beside it. Media is the bin; Text adds a
@@ -61,8 +62,6 @@ export struct MediaItemData {
/// Same shape, same source and same normalisation as a timeline clip's:
/// a file should look like itself wherever it is drawn.
wave: string,
- /// The part over the hot line, as on a clip.
- wave-hot: string,
selected: bool,
}
@@ -480,27 +479,13 @@ component MediaCard inherits Rectangle {
// them already say "this is an audio file", so there is no mark on
// top of them — a badge over a waveform is the same fact twice,
// and the one that costs the tile its whole middle.
- if root.item.wave != "": Path {
+ if root.item.wave != "": Wave {
x: 0;
y: 0;
width: parent.width;
height: parent.height;
commands: root.item.wave;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: root.mark;
- }
- if root.item.wave-hot != "": Path {
- x: 0;
- y: 0;
- width: parent.width;
- height: parent.height;
- commands: root.item.wave-hot;
- viewbox-width: 1;
- viewbox-height: 1;
- fit: fill;
- fill: Theme.wave-hot;
+ tint: root.mark;
}
// What everything else shows before its artwork exists. Large and