Skip to content

0.7.0 — Detail, Metal, Selection, and RTL

Choose a tag to compare

@GRimAce11 GRimAce11 released this 27 Nov 06:28
· 10 commits to main since this release

Phase 4 and the first half of Phase 5: zoomed waveforms gain real detail, bar styles get an opt-in Metal backend, and the view gains region selection and right-to-left timelines.

Read this before upgrading

Three changes are not drop-in:

  • Bar heights shift slightly for decoded files. WaveformView now draws from the new summary pyramid at every zoom level, so heights stay on one scale through a pinch. At 1× the bars pool fine-grained bins rather than 200 coarse ones: .peak bars look a little spikier and .mean bars a little lower. Decode with pyramidResolution: 0 to keep the 0.6.0 look exactly.
  • The disk cache is re-decoded once. The cache format moves to version 2 and pyramidResolution is part of the key. Version-1 entries are ignored and age out through normal LRU eviction. The default 32 MB budget now holds about 700 summaries instead of about 10 000.
  • In right-to-left layouts, time now runs right to left by default, following Apple's HIG guidance to flip progress controls. Apply .waveformTimelineDirection(.leftToRight) to keep the old behaviour.

Real detail at high zoom

  • New WaveformSummaryPyramid: a fine base level (16 384 bins by default) plus a ladder of coarser levels, kept for both .peak and .mean pooling. Codable and lossless at 16-bit precision; only the base level is encoded (~44 KB).
  • AudioDecoder builds it in the same pass as the bars — no second read of the file. pyramidResolution: is threaded through AudioDecoder, WaveformLoader and WaveformCache; 0 skips it.
  • WaveformSummary.pyramid is optional, so older caches and server JSON without it still load.

Metal rendering backend

  • .waveformRenderingBackend(.metal) or .automatic(minimumBarCount:) draws .bars and .mirroredBars in one instanced draw call per view, redrawn only when inputs change.
  • Defaults to .canvas, so nothing changes unless you opt in. Falls back to Canvas without a Metal device or while the shader compiles on first use.
  • The shader is compiled at runtime from source, so the package needs no Metal Toolchain to build.

Region selection

  • WaveformView(... selection:selectionOptions:) binds a plain ClosedRange<TimeInterval>?.
  • Create a range with long-press-then-drag (default) or a plain drag (.editor), adjust either edge through a 44-point target, clear it with a tap outside. Snapping, minimum length and tint are configurable.
  • VoiceOver gets Select from playhead / Clear selection actions and adjustable start and end elements. Works while zoomed.

Right-to-left timelines

  • WaveformTimelineDirection (.automatic, .leftToRight, .rightToLeft) via .waveformTimelineDirection(_:).
  • Bars, played colouring, seeking, panning, pinch anchoring, markers, selection and VoiceOver positions all follow it. Marker labels move but are not mirrored; .circular stays clockwise.
  • WaveformView.snapshot(... layoutDirection:), since a snapshot has no environment to read.

Fixed

  • Markers ignored the viewport. While zoomed, they were drawn, hit-tested and placed for VoiceOver at their full-duration positions. They now follow the visible range, and off-screen markers are skipped.

Not included

The Metal spectrogram and ProMotion 120 Hz .dancingBars are deferred. tvOS still needs a focus-engine interaction model. watchOS support landed on main after this tag and will ship in the next release.


186 tests passing. Full detail in CHANGELOG.md.