Skip to content

Add Instant guard for audio worklets#133

Merged
BillyDM merged 1 commit into
BillyDM:mainfrom
CorvusPrudens:worklet-time
May 16, 2026
Merged

Add Instant guard for audio worklets#133
BillyDM merged 1 commit into
BillyDM:mainfrom
CorvusPrudens:worklet-time

Conversation

@CorvusPrudens
Copy link
Copy Markdown
Contributor

This PR provides a function that returns bevy_platform::time::Instant::now in contexts where it's available. Notably, an audio worklet is not such a context, meaning we can't currently run a FirewheelProcessor in a worklet.

The check simply tests whether sampleRate, a property on the AudioWorkletGlobalContext, is defined. The result is stored in a thread local, meaning we'll generally only call into JS once.

@CorvusPrudens CorvusPrudens changed the title Add Instant guard for audio worklets Add Instant guard for audio worklets May 15, 2026
@BillyDM
Copy link
Copy Markdown
Owner

BillyDM commented May 16, 2026

Looks good, thanks!

@BillyDM BillyDM merged commit 9cdd717 into BillyDM:main May 16, 2026
3 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