update shortcuts, rework update_lv2 for jitter bug, override LV2_PATH
authorGood Guy <[email protected]>
Fri, 5 Apr 2019 01:54:08 +0000 (19:54 -0600)
committerGood Guy <[email protected]>
Fri, 5 Apr 2019 01:54:08 +0000 (19:54 -0600)
cinelerra-5.1/cinelerra/audioalsa.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/pluginlv2.C
cinelerra-5.1/cinelerra/pluginlv2.h
cinelerra-5.1/cinelerra/pluginlv2client.C
cinelerra-5.1/cinelerra/pluginlv2client.h
cinelerra-5.1/cinelerra/pluginlv2gui.C
cinelerra-5.1/cinelerra/pluginlv2ui.C
cinelerra-5.1/doc/shortcuts.html

index 07afaa7900f88670f70b631dc102889b81ef9bd3..f256a506057900187921c2d08a799bd1e8b2d39a 100644 (file)
@@ -234,18 +234,10 @@ snd_pcm_format_t AudioALSA::translate_format(int format)
 {
        switch(format)
        {
-       case 8:
-               return SND_PCM_FORMAT_S8;
-               break;
-       case 16:
-               return SND_PCM_FORMAT_S16_LE;
-               break;
-       case 24:
-               return SND_PCM_FORMAT_S24_LE;
-               break;
-       case 32:
-               return SND_PCM_FORMAT_S32_LE;
-               break;
+       case  8: return SND_PCM_FORMAT_S8;
+       case 16: return SND_PCM_FORMAT_S16_LE;
+       case 24: return SND_PCM_FORMAT_S24_LE;
+       case 32: return SND_PCM_FORMAT_S32_LE;
        }
        return SND_PCM_FORMAT_UNKNOWN;
 }
index 546444fe2bbd6b053ca1450298e2e4fc3ecdd9ad..14d06c93d7ce38e60a5ec28eb9f4cb9384071367 100644 (file)
@@ -939,14 +939,7 @@ void MWindow::init_preferences()
 {
        preferences = new Preferences;
        preferences->load_defaults(defaults);
-       const char *lv2_path = getenv("LV2_PATH");
-       if( lv2_path && strcmp(lv2_path, preferences->lv2_path) ) {
-               strncpy(preferences->lv2_path, lv2_path, sizeof(preferences->lv2_path));
-               remove_plugin_index();
-       }
-       else if( !lv2_path && preferences->lv2_path[0] ) {
-               File::setenv_path("LV2_PATH",preferences->lv2_path, 0);
-       }
+       File::setenv_path("LV2_PATH",preferences->lv2_path, 0);
        session = new MainSession(this);
        session->load_defaults(defaults);
        // set x11_host, screens, window_config
index d1c5a8c4022e7362ba613d70d94fed5b5e3a425d..7b7dc678e717b2dd1578bfb3f4f3cad2092852e4 100644 (file)
@@ -22,6 +22,7 @@ PluginLV2::PluginLV2()
 
        samplerate = 44100;
        refreshrate = 30.;
+       min_block_length = 1;
        block_length = 4096;
        midi_buf_size = 8192;
 
@@ -189,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);
@@ -218,6 +220,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;
 }
 
index 075816a70173fa9fa7c1438499a58c512f3c87a1..ac99d2535dfc3015ba23ba910db6b28f8016ba53 100644 (file)
@@ -90,7 +90,8 @@ public:
        LV2_Atom_Sequence  seq_in[2];
        LV2_Atom_Sequence  *seq_out;
        float samplerate, refreshrate;
-       int block_length, midi_buf_size;
+       int min_block_length, block_length;
+       int midi_buf_size;
 
        LilvInstance *inst;
        SuilInstance *sinst;
@@ -146,6 +147,7 @@ typedef struct { int sample_rate, bfrsz;  char path[1]; } open_bfr_t;
 enum { NO_COMMAND,
        LV2_OPEN,
        LV2_LOAD,
+       LV2_CONFIG,
        LV2_UPDATE,
        LV2_SHOW,
        LV2_HIDE,
index 289eed4ea98541b06a3df7198e537a0a787628ea..d416987f7d92b88113d400171837a2d398b6ce87 100644 (file)
@@ -182,6 +182,7 @@ int PluginLV2Client::load_configuration()
 {
        int64_t src_position =  get_source_position();
        KeyFrame *prev_keyframe = get_prev_keyframe(src_position);
+       if( prev_keyframe->is_default ) return 0;
        PluginLV2ClientConfig curr_config;
        curr_config.copy_from(config);
        read_data(prev_keyframe);
@@ -198,16 +199,16 @@ void PluginLV2Client::update_gui()
        load_configuration();
        if( config.update() > 0 ) {
                gui->update_selected();
-               update_lv2();
+               update_lv2(LV2_UPDATE);
        }
        gui->unlock_window();
 }
 
-void PluginLV2Client::update_lv2()
+void PluginLV2Client::update_lv2(int token)
 {
        PluginLV2ParentUI *ui = find_ui();
        if( !ui ) return;
-       ui->send_child(LV2_UPDATE, config.ctls, sizeof(float)*config.nb_ports);
+       ui->send_child(token, config.ctls, sizeof(float)*config.nb_ports);
 }
 
 
@@ -295,27 +296,54 @@ void PluginLV2Client::process_buffer(int size)
 }
 
 int PluginLV2Client::process_realtime(int64_t size,
-       Samples *input_ptr, Samples *output_ptr)
-{
-       if( load_configuration() )
-               update_lv2();
-       init_buffer(size);
-       load_buffer(size, &input_ptr, 1);
-       process_buffer(size);
-       return unload_buffer(size, &output_ptr, 1);
+       Samples **input_ptr, Samples **output_ptr, int chs)
+{
+       int64_t pos = get_source_position();
+       int64_t end = pos + size;
+       int64_t samples = 0;
+       while( pos < end ) {
+               KeyFrame *prev_keyframe = get_prev_keyframe(pos);
+               if( !prev_keyframe->is_default ) {
+                       read_data(prev_keyframe);
+                       update_lv2(LV2_CONFIG);
+               }
+               KeyFrame *next_keyframe = get_next_keyframe(pos);
+               int64_t next_pos = next_keyframe->position;
+               if( pos >= next_pos || next_pos > end )
+                       next_pos = end;
+               int64_t len = next_pos - pos;
+               if( len > block_length )
+                       len = block_length;
+               if( pos + len > end )
+                       len = end - pos;
+               init_buffer(len);
+               for( int i=chs; --i>=0; ) {
+                       input_ptr[i]->set_offset(samples);
+                       output_ptr[i]->set_offset(samples);
+               }
+               load_buffer(len, input_ptr, chs);
+               process_buffer(len);
+               unload_buffer(len, output_ptr, chs);
+               samples += len;
+               pos += len;
+       }
+       for( int i=chs; --i>=0; )
+               output_ptr[i]->set_offset(0);
+       return samples;
 }
 
 int PluginLV2Client::process_realtime(int64_t size,
        Samples **input_ptr, Samples **output_ptr)
 {
-       if( load_configuration() )
-               update_lv2();
-       init_buffer(size);
-       load_buffer(size, input_ptr, PluginClient::total_in_buffers);
-       process_buffer(size);
-       return unload_buffer(size, output_ptr, PluginClient::total_out_buffers);
+       return process_realtime(size, input_ptr, output_ptr,
+               PluginClient::total_out_buffers);
 }
 
+int PluginLV2Client::process_realtime(int64_t size,
+       Samples *input_ptr, Samples *output_ptr)
+{
+       return process_realtime(size, &input_ptr, &output_ptr, 1);
+}
 
 PluginLV2BlackList::PluginLV2BlackList(const char *path)
 {
index 1f5f3b356b426b6d962c287e61d27a567d804ca1..80654ef557121d9d1f593aa8fe2d756792bd3698 100644 (file)
@@ -69,11 +69,11 @@ public:
        ~PluginLV2Client();
 
        int process_realtime(int64_t size,
-               Samples *input_ptr,
-               Samples *output_ptr);
+               Samples **input_ptr, Samples **output_ptr, int chs);
        int process_realtime(int64_t size,
-               Samples **input_ptr,
-               Samples **output_ptr);
+               Samples *input_ptr, Samples *output_ptr);
+       int process_realtime(int64_t size,
+               Samples **input_ptr, Samples **output_ptr);
 // Update output pointers as well
        int is_realtime();
        int is_multichannel();
@@ -86,7 +86,7 @@ public:
        int unload_buffer(int samples, Samples **output, int och);
        void process_buffer(int size);
        void update_gui();
-       void update_lv2();
+       void update_lv2(int token);
        int init_lv2();
        PluginLV2ParentUI *find_ui();
        PluginLV2ParentUI *get_ui();
index 9ae3ba39a9bf95834baa40503a963fec335b7fb2..cbd5b67f4ce432e00338e9043ba3caea039ce72d 100644 (file)
@@ -72,7 +72,7 @@ int PluginLV2ClientReset::handle_event()
        PluginLV2Client *client = gui->client;
        client->config.init_lv2(client->lilv, client);
        client->config.update();
-       client->update_lv2();
+       client->update_lv2(LV2_LOAD);
        gui->update(0);
        client->send_configure_change();
        return 1;
index 17f072a2c6bf63b6c5960f21d7c364aa10e5199c..80bf250f1e2c7921c8ac23c9ac2fc1bb8f46deab 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;
 }
@@ -328,10 +332,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; }
index f55a469d2a28320656b087d03125f4f61bcdeabe..22ece8084972c66809e8a94e8acdfb8ed96c7c09 100644 (file)
        <tr>
                <td height="26" align="right"><font face="Liberation Serif" size=4> </font></td>
                <td align="left"><font face="Liberation Serif" size=4>DVD Render…</font></td>
-               <td align="left"><font face="Liberation Serif" size=4>'Shift-D'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Alt-d'</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Open create dvd disk window</font></td>
        </tr>
        <tr>
                <td align="left"><font face="Liberation Serif" size=4>'d'</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Delete last track</font></td>
        </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Delete first track</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Shift-D'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Delete first track</font></td>
+       </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Concatenate trks</font></td>