cmajor-lang / cmajor

The Cmajor public repository
https://cmajor.dev
Other
522 stars 31 forks source link

Providing an `external` audio buffer at runtime #50

Closed vitreo12 closed 5 months ago

vitreo12 commented 5 months ago

By looking at the C++ API, I can see that externals are resolved at compile time of a Cmajor program within the Engine::load() method. Is this correct?

If that's the case, is it instead somehow possible to provide them at runtime to a cmaj::Performer instance? I'm mainly thinking about audio buffers, not other kinds of more complex externals.

julianstorer commented 5 months ago

For how-to questions, maybe choose discord rather than make an "issue" out of it! If you're asking about dynamically streaming to a running processor, then no, that can't be done via the externals, they're compile-time constants. You'd use events to send chunks to the processor. In the longer term, a feature that we'll add will be large random-access buffers, which under-the-hood will be implemented with a system of hidden events, but at the client level will look like what you're imagining here - callback functions that can read chunks dynamically.