X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginlv2.C;h=7b7dc678e717b2dd1578bfb3f4f3cad2092852e4;hp=f4f1f7946df4ce9bf77b35e5dea84aa298f900aa;hb=c857b2fb7965d27d86d5785fb9f1b8957a871a1a;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/pluginlv2.C b/cinelerra-5.1/cinelerra/pluginlv2.C index f4f1f794..7b7dc678 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2.C +++ b/cinelerra-5.1/cinelerra/pluginlv2.C @@ -22,6 +22,7 @@ PluginLV2::PluginLV2() samplerate = 44100; refreshrate = 30.; + min_block_length = 1; block_length = 4096; midi_buf_size = 8192; @@ -167,16 +168,12 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) } } - - uri_map.callback_data = (LV2_URI_Map_Callback_Data)this; - uri_map.uri_to_id = uri_to_id; - features.append(new Lv2Feature(NS_EXT "uri-map", &uri_map)); - map.handle = (void*)&uri_table; - map.map = uri_table_map; - features.append(new Lv2Feature(LV2_URID_MAP_URI, &map)); - unmap.handle = (void*)&uri_table; - unmap.unmap = uri_table_unmap; - features.append(new Lv2Feature(LV2_URID_UNMAP_URI, &unmap)); + uri_map.handle = (LV2_URID_Map_Handle)this; + uri_map.map = map_uri; + features.append(new Lv2Feature(LV2_URID__map, &uri_map)); + uri_unmap.handle = (LV2_URID_Unmap_Handle)this; + uri_unmap.unmap = unmap_uri; + features.append(new Lv2Feature(LV2_URID__unmap, &uri_unmap)); features.append(new Lv2Feature(LV2_BUF_SIZE__powerOf2BlockLength, 0)); features.append(new Lv2Feature(LV2_BUF_SIZE__fixedBlockLength, 0)); features.append(new Lv2Feature(LV2_BUF_SIZE__boundedBlockLength, 0)); @@ -193,9 +190,10 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) ui_updateRate = uri_table.map(LV2_UI__updateRate); samplerate = sample_rate; - block_length = bfrsz; options.add(param_sampleRate, sizeof(float), atom_float, &samplerate); - options.add(bufsz_minBlockLength, sizeof(int), atom_int, &block_length); + if( min_block_length > bfrsz ) min_block_length = bfrsz; + options.add(bufsz_minBlockLength, sizeof(int), atom_int, &min_block_length); + block_length = bfrsz; options.add(bufsz_maxBlockLength, sizeof(int), atom_int, &block_length); options.add(bufsz_sequenceSize, sizeof(int), atom_int, &midi_buf_size); options.add(ui_updateRate, sizeof(float), atom_float, &refreshrate); @@ -222,24 +220,20 @@ 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; } -LV2_URID PluginLV2::uri_table_map(LV2_URID_Map_Handle handle, const char *uri) -{ - return ((PluginLV2UriTable *)handle)->map(uri); -} - -const char *PluginLV2::uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid) +uint32_t PluginLV2::map_uri(LV2_URID_Map_Handle handle, const char *uri) { - return ((PluginLV2UriTable *)handle)->unmap(urid); + PluginLV2 *the = (PluginLV2 *)handle; + return the->uri_table.map(uri); } -uint32_t PluginLV2::uri_to_id(LV2_URI_Map_Callback_Data callback_data, - const char *map, const char *uri) +const char *PluginLV2::unmap_uri(LV2_URID_Unmap_Handle handle, LV2_URID urid) { - PluginLV2 *the = (PluginLV2 *)callback_data; - return the->map.map(the->uri_table, uri); + PluginLV2 *the = (PluginLV2 *)handle; + return the->uri_table.unmap(urid); } void PluginLV2::connect_ports(PluginLV2ClientConfig &conf, int ports) @@ -576,6 +570,7 @@ PluginLV2UI::PluginLV2UI() title[0] = 0; memset(&uri_map, 0, sizeof(uri_map)); + memset(&uri_unmap, 0, sizeof(uri_unmap)); memset(&extui_host, 0, sizeof(extui_host)); wgt_type = LV2_EXTERNAL_UI_URI__KX__Widget; gtk_type = LV2_UI__GtkUI;