X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginlv2.C;h=8b52aa61f98a5f42bb0b1bf943387aae3ee2483e;hb=07a0e1f6f49dc7c4229a3a296b722a0571c17e81;hp=c6ef09cbe2125257a6dc07c004b9402f11b750fd;hpb=3643286e2dbb3002604a62e3e6fd834716b4ae63;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/pluginlv2.C b/cinelerra-5.1/cinelerra/pluginlv2.C index c6ef09cb..8b52aa61 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2.C +++ b/cinelerra-5.1/cinelerra/pluginlv2.C @@ -1,3 +1,23 @@ +/* + * CINELERRA + * Copyright (C) 2016-2020 William Morrow + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + #ifdef HAVE_LV2 #include "bctrace.h" @@ -170,6 +190,12 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) } } + if( !nb_inputs || !nb_outputs ) { + printf(": Unsupported lv2 plugin, missing audio input or output\n"); + reset_lv2(); + return 1; + } + uri_map.handle = (LV2_URID_Map_Handle)this; uri_map.map = map_uri; features.append(new Lv2Feature(LV2_URID__map, &uri_map)); @@ -209,7 +235,15 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) printf("lv2: lilv_plugin_instantiate failed\n"); return 1; } + +// After instantiate, some plugins require fields to be filled in before +// activate is called. This is done via ConnectPort, which connects a +// port to a data structure in the host (CinGG). So these have to be +// allocated first. + init_buffer(bfrsz); + connect_ports(conf, PORTS_ALL); + const LV2_Descriptor *lilv_desc = inst->lv2_descriptor; worker_iface = !lilv_desc->extension_data ? 0 : (LV2_Worker_Interface*)lilv_desc->extension_data(LV2_WORKER__interface); @@ -222,7 +256,7 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) (lilv_plugin_has_feature(lilv, powerOf2BlockLength) || lilv_plugin_has_feature(lilv, fixedBlockLength) || lilv_plugin_has_feature(lilv, boundedBlockLength)) ? 4096 : 0; - init_buffer(bfrsz); + return 0; }