Skip to content

ExternalPlugin: Add playhead tracking for external plugins#474

Open
gijzelaerr wants to merge 7 commits intospotify:masterfrom
gijzelaerr:fix/playhead-tracking-301
Open

ExternalPlugin: Add playhead tracking for external plugins#474
gijzelaerr wants to merge 7 commits intospotify:masterfrom
gijzelaerr:fix/playhead-tracking-301

Conversation

@gijzelaerr
Copy link
Copy Markdown
Member

Summary

  • Adds playhead position tracking (currentPositionInfo) for external VST3/AU plugins, reporting the current time in samples during processing
  • Reports time position for both audio and MIDI plugin processing paths
  • Notifies plugins when rendering has stopped

This is a rebased version of @psobot's PR #301. All credit for the implementation goes to @psobot.

Fixes #295

Test plan

  • Verify external plugins receive correct playhead position during audio processing
  • Verify MIDI plugins also receive time position information
  • Run existing external plugin test suite (tests/test_external_plugins.py)

🤖 Generated with Claude Code

psobot and others added 7 commits March 18, 2026 13:56
The currentPositionInfo member was never explicitly initialized, leaving
its fields with undefined values. Plugins that query the playhead during
initialization (e.g., VST3 preset loading) would read garbage values,
causing issues like incorrect gain (0.5 instead of 1.0). Initialize all
fields to standard defaults (120 BPM, 4/4 time, position 0, not playing)
before any plugin loading or setPlayHead(this) calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues fixed:
1. getPreset() now flushes pending parameter changes by calling processBlock
   with a minimal buffer before reading preset data. VST3 plugins defer
   parameter state synchronization until the audio processing callback,
   so without this flush, preset_data would contain stale parameter values.

2. Removed the extra processBlock "pump" from the audio effect processing
   path. This empty-buffer pump was clearing the internal state of effects
   like CHOWTapeModel's tape delay, breaking the reset=False behavior
   where tail audio should persist between calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add support for playhead tracking

2 participants