oops - now add termux/android DV patch
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / pluginlv2ui.C
index 17f072a2c6bf63b6c5960f21d7c364aa10e5199c..2b0c9926bf65034d9fc7898e8c63138eab7af25f 100644 (file)
@@ -114,6 +114,7 @@ bool PluginLV2UI::lv2ui_resizable()
        return !fs_matches && !nrs_matches;
 }
 
+//force= 1:ctls(all),gui(all)  0:changed(ctls)  -1:gui(all)
 int PluginLV2UI::update_lv2_input(float *vals, int force)
 {
        int ret = 0;
@@ -122,9 +123,12 @@ int PluginLV2UI::update_lv2_input(float *vals, int force)
                int idx = config[i]->idx;
                float val = vals[idx];
                if( !force && ctls[idx] == val ) continue;
-               ctls[idx] = val;
-               update_control(idx, sizeof(ctls[idx]), 0, &ctls[idx]);
-               ++ret;
+               if( force >= 0 ) {
+                       ctls[idx] = val;
+                       ++ret;
+               }
+               if( force )
+                       update_control(idx, sizeof(val), 0, &val);
        }
        return ret;
 }
@@ -164,28 +168,7 @@ void PluginLV2ChildUI::start_gui()
        update_lv2_input(config.ctls, 1);
        connect_ports(config, PORTS_CONTROL | PORTS_ATOM);
        int n = 0;
-#if 1
-// some plugins must have pointers, or they crash
-       float inp[nb_inputs], out[nb_outputs];
-       memset(&inp, 0, nb_inputs*sizeof(float));
-       memset(&out, 0, nb_outputs*sizeof(float));
-       int ich = 0, och = 0;
-       for( int i=0; i<config.nb_ports; ++i ) {
-               const LilvPort *lp = lilv_plugin_get_port_by_index(lilv, i);
-               if( !lp ) continue;
-               int port = config.ports[i];
-               if( !(port & PORTS_AUDIO) ) continue;
-               if( (port & PORTS_INPUT) ) {
-                       lilv_instance_connect_port(inst, i, &inp[ich++]);
-                       continue;
-               }
-               if( (port & PORTS_OUTPUT) ) {
-                       lilv_instance_connect_port(inst, i, &out[och++]);
-                       continue;
-               }
-       }
-       n = 1;
-#endif
+
        updates = 0;
        run_lilv(n);
        if( gui ) {
@@ -328,10 +311,14 @@ int PluginLV2ChildUI::child_iteration(int64_t usec)
                        float *vals = (float *)child_data;
                        update_lv2_input(vals, 1);
                        break; }
-               case LV2_UPDATE: {
+               case LV2_CONFIG: {
                        float *vals = (float *)child_data;
                        update_lv2_input(vals, 0);
                        break; }
+               case LV2_UPDATE: {
+                       float *vals = (float *)child_data;
+                       update_lv2_input(vals, -1);
+                       break; }
                case LV2_SHOW: {
                        start_gui();
                        break; }