Skip to content

v0.2.7 — TD timeline pause pauses audio

Choose a tag to compare

@hthillman hthillman released this 02 Jun 17:47
· 51 commits to main since this release

Scoped, single-fix release. Reapplied incrementally on top of the confirmed-working v0.2.6 after an earlier bundled v0.2.7 attempt regressed pod connection. This release touches only the pause path — nothing in source resolution or the WebSocket/queue protocol changed, so connection behaves exactly as v0.2.6.

TD timeline pause now actually pauses audio

User report: "It doesn't seem to pause if you pause your touch designer."

Root cause: the frame_exec Execute DAT has a separate toggle parameter for each callback, and they're all OFF by default. Defining onPlayStateChange(state) in the DAT text without enabling the playstatechange toggle is a silent no-op — so the handler never fired.

Fix:

  • build/build_tox.py: enable the playstatechange toggle on frame_exec (alongside the existing framestart + active), and dispatch onPlayStateChange(state)DemonExt.OnPlayStateChange.
  • src/demon_ext.py: new OnPlayStateChange(state) sets a _paused flag on SpeakerOut.
  • src/audio.py: set_paused() + _paused + a pause fast-path in _pa_callback — when paused it emits silence and does not advance the LoopBuffer playhead, so un-pause resumes from the exact same sample. One bool read per PortAudio callback, GIL-atomic, no lock.

The WebSocket + queue heartbeats keep running through the pause — pausing the timeline is a "stop hearing audio" gesture, not a session teardown (that's Disconnect).

Verification

  • Connect behaves exactly as v0.2.6 (no source/WS code changed).
  • Hit Space / timeline pause during a session: audio cuts within one PortAudio callback (~85 ms); un-pause resumes from the same sample. With Debug ON: OnPlayStateChange: state=False → PAUSE.

Deferred to later (individually-verified) increments

  • Removing the Source Audio File par — needs a detection fix first (on some patches _has_source_audio() only passes because the par is set).
  • Feeding Audio Analyze at audio rate — still open; a Debug numSamples diagnostic will drive the fix.

Tests: 71 passed. Drift: clean against demon-public-demo @ f2be73b. BUILD_MARKER = v0.2.7-pause-only