web-audio-api-rs
web-audio-api-rs copied to clipboard
Maintain `AudioParamEventTimeline` in control thread
trafficstars
rationale
- no
panic!in render thread (see https://github.com/orottier/web-audio-api-rs/pull/62#discussion_r764294272) - requires av1 milestoneflag? - performance
solution to explore
ArcSwaphttps://docs.rs/arc-swap/latest/arc_swap/
For the record, I tested a naive solution with <Arx<Mutex<AudioParamEventTimeline>>> here: https://github.com/b-ma/web-audio-api-rs/commit/4f30721828104dc7bf337f27a5398a6541f70c78 (I know it is controversial :), but you will be happy this didn't change anything on the benchmarks (except for "Baseline (silence)"... a bit disappointing...)
Another option would be to keep a copy of every AudioParamEventTimeline in the control thread. Insert the event first locally in the control side copy. Reject if it will 'panic', otherwise ship to render thread.