Skip to content

Standalone: zero the clap_process and give it a steady_time - #587

Merged
defiantnerd merged 1 commit into
free-audio:nextfrom
baconpaul:standalone-steady-time
Oct 8, 2026
Merged

defiantnerd merged 1 commit into
free-audio:nextfrom
baconpaul:standalone-steady-time

Conversation

@baconpaul

Copy link
Copy Markdown
Collaborator

The standalone passed an uninitialised clap_process to every process() call. Anything not set explicitly, including steady_time, was stack garbage on every block. That breaks timestamping, phase sync and any monotonicity asserts in the plugin.

This PR zero-initialises the struct and sets steady_time from a running sample counter. The counter is never reset, so it stays monotonic across restarts and device changes.

This is P0-1 of the standalone-revisited list.

Tested on macOS with two-filters. Under lldb, the plugin is active at 48 kHz, and at the 51st block steady_time is 12800 (50 × 256). The next block it is 13056.

The standalone handed every process() call an uninitialised clap_process, so
steady_time (and anything else not explicitly set) was stack garbage on every
block. It is now zeroed and steady_time counts processed samples, never
reset, so it stays monotonic across restarts.

Assisted-by: Claude Opus 5.5
}

clap_process process;
clap_process process{};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always :)

@defiantnerd defiantnerd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes completely sense!

@defiantnerd
defiantnerd merged commit 8f47439 into free-audio:next Oct 8, 2026
28 checks passed
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.

2 participants