tpt-av-ui

Rust

Pure-Rust, GPU-accelerated media UI components — waveform renderers, timeline scrubbers, node graphs, and meters for building audio/video editors. Dual-licensed MIT/Apache-2.0.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust97.6%WGSL1.4%Liquid0.5%HTML0.4%
README
<h1 align="center">tpt-av-ui</h1> <p align="center"> <a href="#license"><img alt="License: MIT OR Apache-2.0" src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg"></a> <a href="https://github.com/tpt-solutions/tpt-av-ui/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/tpt-solutions/tpt-av-ui/actions/workflows/ci.yml/badge.svg"></a> <img alt="Status: Early-stage / Pre-1.0" src="https://img.shields.io/badge/status-pre--1.0-orange.svg"> </p> <p align="center"> <strong>A pure-Rust, GPU-accelerated media UI component library.</strong><br> Waveform renderers, timeline scrubbers, node graphs, and professional media editing widgets — the visual interface layer of the <a href="https://opensource.tptsolutions.co.nz/">TPT AV Stack</a>. </p>

tpt-av-ui provides the production-ready, GPU-accelerated widgets that general-purpose UI frameworks don't ship: zoomable waveform displays, multi-track timelines with clip dragging/snapping/trimming, node-based effect routing graphs, audio meters, and transport controls. Everything renders through wgpu (WebGPU, WGSL shaders, no C/C++ bindings) and integrates with egui, iced, or your own raw-wgpu renderer.

Components

CrateWhat you get
tpt-av-ui-coreShared types: Color, Rect, Transform2D, theming, UiEvent input model, wgpu device/texture/pipeline helpers, mesh builders
tpt-av-ui-waveformGPU waveform renderer with peak-cache integration, zoom/pan/scroll, selection, playhead
tpt-av-ui-timelineMulti-track timeline: clips, time ruler (timecode/beats/samples), drag + snap + trim, multi-selection
tpt-av-ui-nodeNode graph editor: nodes, typed ports, bezier connection wires, drag/pan/zoom, box selection
tpt-av-ui-meterLevel meters (VU/Peak/RMS with ballistics + peak hold), spectrum analyzer, vectorscope, real-time waveform display
tpt-av-ui-transportTransport state machine + callbacks, SMPTE/frames/samples/seconds timecode, tempo utilities
tpt-av-ui-eguiDrop-in egui widgets for waveform, timeline, node graph, and meters
tpt-av-ui-icediced canvas widgets (waveform, meters, transport)

Every crate has its own README.md (features, quick-start, API notes) and CHANGELOG.md; this file's changelog summarizes workspace-level changes.

Quick start (egui)

use std::sync::Arc;
use tpt_av_ui_egui::EguiWaveform;
use tpt_av_ui_waveform::{MemoryPeakSource, WaveformAction};

struct Viewer {
    waveform: EguiWaveform,
}

impl Viewer {
    fn show(&mut self, ui: &mut egui::Ui, state: &egui_wgpu::RenderState) {
        // allocate space, render on the GPU, and handle input in one call
        if let Some(action) = self.waveform.show(ui, state) {
            match action {
                WaveformAction::SetPlayhead { sample } => { /* seek */ }
                _ => {}
            }
        }
    }
}

Build a peak source from PCM samples, or enable the asset-cache feature to read tpt-av-asset-cache .peaks files directly:

use tpt_av_ui_waveform::MemoryPeakSource;

let samples: Vec<f32> = /* interleaved mono PCM in -1.0..=1.0 */;
let source = Arc::new(MemoryPeakSource::new(samples, 44_100, 1024));

Starting a project

Generate a ready-to-build waveform viewer with cargo-generate:

cargo generate tpt-solutions/tpt-av-ui templates/basic-egui-app

Demos

The examples workspace member contains runnable eframe apps:

cargo run -p tpt-av-ui-examples --example waveform_viewer
cargo run -p tpt-av-ui-examples --example timeline_editor
cargo run -p tpt-av-ui-examples --example node_graph
cargo run -p tpt-av-ui-examples --example full_daw_ui
cargo run -p tpt-av-ui-examples --example theme_playground

A zero-install WebGPU browser demo (waveform viewer compiled to WASM, deployable to GitHub Pages) lives in examples-wasm/waveform-viewer.

Design

See DESIGN.md for the full architecture: workspace layout, core APIs, the WGSL shader pipeline, performance strategy (instancing, LOD, atlasing, culling), and framework integration.

Contributing

Development is issues-only: bug reports, feature requests, reproduction testing, and design discussion are welcome — external pull requests are not accepted (see CONTRIBUTING.md for the reasoning and what makes a great issue).

License

Dual-licensed under MIT or Apache-2.0, at your option. The dependency tree is strictly permissive by policy — CI runs cargo deny check on every PR and rejects any GPL, LGPL, AGPL, or MPL code.