From baa8cd1b5222f2773f365fdb5ef9d19d7616624e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 16 Jul 2020 15:57:42 +0200 Subject: [PATCH] Fix LV2 buffersize option interface https://lv2plug.in/doc/html/group__options.html specifies a NULL terminated array of options (not a single option). Since the call is the "instantiation" LV2 threading class, and a single fixed value is passed with a direct call into the plugin, using a stack-allocated LV2_Options_Option is sufficient. --- libs/ardour/lv2_plugin.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 3e1e079296..6f02c43c76 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -954,11 +954,12 @@ LV2Plugin::set_block_size (pframes_t nframes) if (_impl->opts_iface) { LV2_URID atom_Int = _uri_map.uri_to_id(LV2_ATOM__Int); _impl->block_length = nframes; - LV2_Options_Option block_size_option = { - LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id ("http://lv2plug.in/ns/ext/buf-size#nominalBlockLength"), - sizeof(int32_t), atom_Int, (void*)&_impl->block_length + LV2_Options_Option block_size_option[] = { + { LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id ("http://lv2plug.in/ns/ext/buf-size#nominalBlockLength"), + sizeof(int32_t), atom_Int, (void*)&_impl->block_length}, + { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL } }; - _impl->opts_iface->set (_impl->instance->lv2_handle, &block_size_option); + _impl->opts_iface->set (_impl->instance->lv2_handle, block_size_option); } return 0;