-
Ignoring the special case of in-place processing, are there any requirements or restrictions imposed on the host/plugin regarding whether or not the plugin can modify the input buffer? For example, is a plugin allowed to use the input buffer as a sort of scratch space to help with processing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
No, the plugin must not modify the input buffers, that's indicated by the const in |
Beta Was this translation helpful? Give feedback.
-
It's convenient to have compatible types for the frame buffer, for instance when using the output of one plugin as the input of another by just switching the memory pointed to by data32/64. My personal take on the const here is "this aggregate and all of it's members and nested members are read only". const is commonly used as a hint to the programmer like this rather than compiler optimization. That said, easy to fix the documentation by adding "Input buffer is read only". As a footnote, |
Beta Was this translation helpful? Give feedback.
No, the plugin must not modify the input buffers, that's indicated by the const in
const clap_audio_buffer_t *audio_inputs;
, part of clap_process_t. If a plugin needs scratch space for processing, allocate that space in clap_plugin_t->activate() and release the memory in ->deactivate(). That's what the parameter
max_frames_count
is for.