cpal icon indicating copy to clipboard operation
cpal copied to clipboard

Recommended way to init non-Send data that's needed in audio callback?

Open Boscop opened this issue 5 years ago • 4 comments

What's the recommended way to init non-Send data that's needed in the audio callback? I.e. initializing it in the audio thread but only once, before the loop starts running. And without the overhead of thread-local storage. This init code is also taking a long time (loading a bunch of VST plugins), and I don't want to block the audio callback on the first call.

Boscop avatar May 17 '20 08:05 Boscop

Assuming the newer managed-thread API, this kind of initialization is possible for Windows and Linux, but I think it's probably not possible on Apple platforms.

ishitatsuyuki avatar May 17 '20 11:05 ishitatsuyuki

Perhaps on Apple it could be emulated with once_cell?

Ralith avatar May 17 '20 18:05 Ralith

@ishitatsuyuki Where is the newer API available? On master? I'm using the crates.io version.

Boscop avatar Jun 13 '20 16:06 Boscop

Yes, it’s on master.

ishitatsuyuki avatar Jun 13 '20 23:06 ishitatsuyuki