Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build precomputed_sine_table at compile time #321

Closed
orottier opened this issue Jul 15, 2023 · 1 comment
Closed

Build precomputed_sine_table at compile time #321

orottier opened this issue Jul 15, 2023 · 1 comment

Comments

@orottier
Copy link
Owner

orottier commented Jul 15, 2023

There's no need to use a OnceLock and compute the values at first use. This also incurs overhead for synchronization.
Better to compile the table into the library.
Unfortunately, f32 operations are not const, so we should either use a build.rs script (which I strongly dislike, way too much added complexity) or use something like include_bytes and a safe transmute.

orottier added a commit that referenced this issue Jul 19, 2023
This means #321 is obsolete anyway. We force pre-computation of the sine
table in control thread, and then pass a static array to the audio
processors. Hence the rendering is lock-free

Fixes #321
@orottier
Copy link
Owner Author

In retrospect, there is no overhead in the audio thread from the OnceLock because we ensure the sine table is built in the control thread, and then we hand the &'static [f32] to the renderer

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

No branches or pull requests

1 participant