Add Waveform overview widget with playhead and loop region - #514
Merged
Merged
Conversation
Draws a caller-supplied min/max peak overview, reduced to the box's pixel width without dropping peaks. Click or drag seeks the playhead, loop edges drag through HandleTrackState, and Shift-drag draws a new loop. ComputeWaveformPeaks builds the overview from samples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018eaHgBMKfrdgMk4HbgrL22
Replaces the exact == checks flagged by code quality with a helper that compares against float.Epsilon, keeping the same exact-change behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018eaHgBMKfrdgMk4HbgrL22
|
1 similar comment
|
Closed
8 tasks
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before:
ktsu.ImGui.Widgetscould plot one short audio block (Scope), but it had nothing for showing a whole clip with a playhead and a loop region.After:
ImGuiWidgets.Waveformdraws a waveform overview of a whole clip. Click or drag to seek, drag either loop edge to move it, and Shift-drag to draw a new loop. The return value is aWaveformChangeflag that says whether the playhead or the loop moved.The widget takes a min/max peak overview rather than the samples themselves, the same way
Histogramtakes bins, so a full scan of the audio never runs on the render thread.ImGuiWidgets.ComputeWaveformPeaksbuilds the overview from samples.How.
WaveformStateholds the gestures (scrub, loop-edge drag, loop creation) with no ImGui dependency. It passes the loop edges toHandleTrackState, so they stay ordered, inside the timeline and at leastminLoopLengthapart by the same rules as aHandleTrack. When the overview has more columns than the box has pixels, each pixel draws every column it covers, so a spike narrower than a pixel still shows. A loop whose start equals its end counts as no loop: it isn't drawn, its edges can't be grabbed, and a press there seeks.Also in this PR:
tests/ImGui.Widgets.UITests/WaveformTests.cs.Refs #504. Zoom and scroll across long clips, with a peak cache per zoom level, aren't in this PR. This PR only shows the whole clip at once, so #504 stays open for that follow-up.
🤖 Generated with Claude Code
https://claude.ai/code/session_018eaHgBMKfrdgMk4HbgrL22
Generated by Claude Code