Skip to content

editor.bpm Display-Only + Multi-Entry Tempo-Map Guard (#407)

Choose a tag to compare

@naomiaro naomiaro released this 11 Jun 00:09
· 34 commits to main since this release

Fixes #407editor.bpm silently corrupted variable-tempo sessions by overwriting the tick-0 entry of consumer-installed tempo maps. PR #410.

Published packages

Package Version
@dawcore/components 0.0.23
@dawcore/transport 0.0.12
@waveform-playlist/engine 13.4.0

What changed

editor.bpm is display-only when tick callbacks are set (@dawcore/components)

When a consumer provides both secondsToTicks and ticksToSeconds callbacks — the editor's "external tempo map is authoritative" signal — assigning editor.bpm no longer forwards to the engine or adapter. It updates the BPM readout and grid math only. Both clobber points are guarded: the bpm setter and _buildEngine's initial tempo forward, so installing a tempo curve before or after the first track load is equally safe. Without callbacks, editor.bpm behaves exactly as before.

Transport refuses defaulted tick-0 writes on multi-entry maps (@dawcore/transport)

Transport.setTempo(bpm) with no atTick now warns and returns false when the TempoMap has more than one entry, instead of silently overwriting the curve's tick-0 entry. Pass an explicit atTick: 0 to genuinely modify a multi-entry map. Single-entry maps — the ordinary "change the session tempo" path — are unchanged. New TempoMap.entryCount getter (always >= 1) backs the check.

Engine commits tempo only on adapter acceptance (@waveform-playlist/engine)

PlayoutAdapter.setTempo is now typed boolean | void; an explicit false means refused. PlaylistEngine.setTempo keeps its prior bpm, skips the clip recompute, and emits no statechange on refusal — previously a refused write froze engine._bpm at a phantom value and the no-op guard swallowed same-value retries. Void-returning adapters (e.g. TonePlayoutAdapter) count as accepted, so existing adapters work unchanged.

Example fixes

  • metronome.html: the tempo slider writes with an explicit tick 0 — a defaulted write is refused after the Accelerando sequence installs a 2-entry map.
  • beat-map-grid.html / automation.html: comments now document the ordering guarantees and the clearTempos() dependency.

Tests

18 new tests across the three layers (guard refusal/escape-hatch/release, engine refusal/retry/void-adapter, dawcore display-only incl. callbacks-assigned-after-build). Suites: transport 245, engine 199, dawcore 495, playout 234 — all passing.