- ui_features.remove();
- LV2_Handle lilv_handle = lilv_instance_get_handle(inst);
- ui_features.append(new Lv2Feature(NS_EXT "instance-access", lilv_handle));
- const LV2_Descriptor *lilv_desc = lilv_instance_get_descriptor(inst);
- ext_data = new LV2_Extension_Data_Feature();
- ext_data->data_access = lilv_desc->extension_data;
- ui_features.append(new Lv2Feature(LV2_DATA_ACCESS_URI, ext_data));
- ui_features.append(new Lv2Feature(LV2_UI__parent, parent));
- ui_features.append(new Lv2Feature(LV2_UI__idleInterface, 0));
- ui_features.append(0);
-
- const char* bundle_uri = lilv_node_as_uri(lilv_ui_get_bundle_uri(ui));
- char* bundle_path = lilv_file_uri_parse(bundle_uri, NULL);
- const char* binary_uri = lilv_node_as_uri(lilv_ui_get_binary_uri(ui));
- char* binary_path = lilv_file_uri_parse(binary_uri, NULL);
- sinst = suil_instance_new(ui_host, this, gtk_type,
- lilv_node_as_uri(lilv_plugin_get_uri(lilv)),
- lilv_node_as_uri(lilv_ui_get_uri(ui)),
- lilv_node_as_uri(ui_type),
- bundle_path, binary_path, ui_features);
-
- lilv_free(binary_path);
- lilv_free(bundle_path);
-}
-
-bool PluginLV2GUI::lv2ui_resizable()
-{
- if( !ui ) return false;
- const LilvNode* s = lilv_ui_get_uri(ui);
- LilvNode *p = lilv_new_uri(world, LV2_CORE__optionalFeature);
- LilvNode *fs = lilv_new_uri(world, LV2_UI__fixedSize);
- LilvNode *nrs = lilv_new_uri(world, LV2_UI__noUserResize);
- LilvNodes *fs_matches = lilv_world_find_nodes(world, s, p, fs);
- LilvNodes *nrs_matches = lilv_world_find_nodes(world, s, p, nrs);
- lilv_nodes_free(nrs_matches);
- lilv_nodes_free(fs_matches);
- lilv_node_free(nrs);
- lilv_node_free(fs);
- lilv_node_free(p);
- return !fs_matches && !nrs_matches;
-}
-
-int PluginLV2GUI::update_lv2(float *vals, int force)
-{
- int ret = 0;
- float *ctls = (float *)config.ctls;
- for( int i=0; i<config.size(); ++i ) {
- int idx = config[i]->idx;
- float val = vals[idx];
- if( !force && ctls[idx] == val ) continue;
- update_control(idx, sizeof(val), 0, &val);
- ++ret;
- }
- for( int i=0; i<config.nb_ports; ++i ) ctls[i] = vals[i];
- return ret;