Store the runtime descriptor passed during initialization so we can access the get_raw_input() API later during rendering.
// Runtime descriptor for background effect support
// Provides access to get_raw_input() API which returns audio input unaffected by effect on/off state
// This enables the effect to run continuously without requiring HOLD (XY Freeze) to be pressed
static unit_runtime_desc_t s_runtime_desc;Store Descriptor in unit_init()
// Store runtime descriptor for background effect support
// This is needed to access get_raw_input() API in unit_render()
// which provides raw audio input bypassing the effect on/off routing
s_runtime_desc = *desc;Capture the runtime descriptor during initialization to make it available throughout the effect's lifetime.
Modified unit_render()
__unit_callback void unit_render(const float *in, float *out, uint32_t frames)
{
// Use get_raw_input() instead of 'in' parameter to enable background operation
// This allows the effect to run continuously without requiring HOLD (XY Freeze)
//
// Background vs Normal effects:
// - Normal: Uses 'in' parameter, which is affected by effect on/off state
// When pad is not touched (and HOLD is off), input is bypassed
// - Background: Uses get_raw_input(), which provides unaffected raw audio input
// Effect runs continuously regardless of touch pad state
const unit_runtime_genericfx_context_t *ctxt =
static_cast<const unit_runtime_genericfx_context_t *>(s_runtime_desc.hooks.runtime_context);
const float *raw_input = ctxt->get_raw_input();
s_effect_instance.process(raw_input, out, frames);
}Instead of using the in parameter (which is affected by effect on/off state), we now access the raw input buffer via get_raw_input(). This makes the effect run continuously in the background without requiring the HOLD button to be pressed.
- Uses
inparameter inunit_render() - Input is controlled by touch pad state and effect on/off routing
- Requires HOLD (XY Freeze) to keep processing when pad is not touched
- Uses
ctxt->get_raw_input()which provides raw, unaffected audio - Processes audio continuously regardless of touch pad state
- Effect runs in the background without needing HOLD