api: conditionally define callbacks

This commit is contained in:
Stefano D'Angelo 2025-01-20 11:55:09 +01:00
parent f942ed5dbb
commit 1af0fb6261
2 changed files with 5 additions and 8 deletions

View File

@ -26,10 +26,14 @@ typedef struct {
const char * format;
const char * (*get_bindir)(void *handle);
const char * (*get_datadir)(void *handle);
{{?it.product.state && it.product.state.dspCustom}}
int (*write_state)(void *handle, const char *data, size_t length);
{{?it.product.parameters.find(x => x.direction == "input")}}
void (*load_parameter)(void *handle, size_t index, float value);
{{?}}
void (*lock_state)(void *handle);
void (*unlock_state)(void *handle);
{{?}}
} plugin_callbacks;
typedef struct {

View File

@ -212,16 +212,9 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s
/* .write_state = */ write_state_cb,
# if DATA_PRODUCT_CONTROL_INPUTS_N > 0
/* .load_parameter = */ load_parameter_cb,
# else
/* .load_parameter = */ NULL,
# endif
/* .lock_state = */ lock_state_cb,
/* .unlock_state = */ unlock_state_cb
# else
/* .write_state = */ NULL,
/* .load_parameter = */ NULL,
/* .state_lock = */ NULL,
/* .state_unlock = */ NULL
/* .unlock_state = */ unlock_state_cb,
# endif
};
plugin_init(&instance->p, &cbs);