dynamic keyframes, textbox rework, andrea ffmpeg.opts, perpetual chkpt undo, lv2...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginaclientlad.C
index f6228c3b96d354d1f10559512449aad6160ab336..15ff05ed0e6ab8b3d542511c1dd45b3c5a2bfc93 100644 (file)
 
 #include "clip.h"
 #include "bchash.h"
+#include "filesystem.h"
 #include "filexml.h"
 #include "language.h"
+#include "mwindow.h"
 #include "pluginaclientlad.h"
 #include "pluginserver.h"
 #include "samples.h"
@@ -450,12 +452,11 @@ char* PluginAClientLAD::lad_to_upper(char *string, const char *input)
 
 void PluginAClientLAD::save_data(KeyFrame *keyframe)
 {
-       FileXML output;
-       char string[BCTEXTLEN];
        if( !config.port_data ) config.initialize(server);
-
+       FileXML output;
 // cause data to be stored directly in text
-       output.set_shared_output(keyframe->get_data(), MESSAGESIZE);
+       output.set_shared_output(keyframe->xbuf);
+       char string[BCTEXTLEN];
        output.tag.set_title(lad_to_upper(string, plugin_title()));
 
        const LADSPA_Descriptor *lad_desc = server->lad_descriptor;
@@ -479,14 +480,13 @@ void PluginAClientLAD::save_data(KeyFrame *keyframe)
 
 void PluginAClientLAD::read_data(KeyFrame *keyframe)
 {
-       FileXML input;
-       char string[BCTEXTLEN];
-
-       input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data()));
        if( !config.port_data ) config.initialize(server);
+       FileXML input;
+       input.set_shared_input(keyframe->xbuf);
 
        while(! input.read_tag() ) {
 //printf("PluginAClientLAD::read_data %s\n", input.tag.get_title());
+               char string[BCTEXTLEN];
                if(! input.tag.title_is(lad_to_upper(string, plugin_title())) ) continue;
                const LADSPA_Descriptor *lad_desc = server->lad_descriptor;
                const LADSPA_PortDescriptor *port_desc = lad_desc->PortDescriptors;
@@ -505,12 +505,14 @@ void PluginAClientLAD::read_data(KeyFrame *keyframe)
 
 void PluginAClientLAD::delete_buffers()
 {
-       if(in_buffers)
-               for(int i = 0; i < total_inbuffers; i++) delete [] in_buffers[i];
-       if(out_buffers)
-               for(int i = 0; i < total_outbuffers; i++) delete [] out_buffers[i];
-       in_buffers = 0;
-       out_buffers = 0;
+       if( in_buffers ) {
+               for( int i=0; i<total_inbuffers; ++i ) delete [] in_buffers[i];
+               delete [] in_buffers;  in_buffers = 0;
+       }
+       if( out_buffers ) {
+               for( int i=0; i<total_outbuffers; ++i ) delete [] out_buffers[i];
+               delete [] out_buffers;  out_buffers = 0;
+       }
        total_inbuffers = 0;
        total_outbuffers = 0;
        buffer_allocation = 0;
@@ -650,5 +652,15 @@ int PluginAClientLAD::process_realtime(int64_t size,
        return size;
 }
 
-
+int MWindow::init_ladspa_index(MWindow *mwindow, Preferences *preferences,
+       FILE *fp, const char *plugin_dir)
+{
+       char plugin_path[BCTEXTLEN], *path = FileSystem::basepath(plugin_dir);
+       strcpy(plugin_path, path);  delete [] path;
+       printf("init ladspa index: %s\n", plugin_dir);
+       fprintf(fp, "%d\n", PLUGIN_FILE_VERSION);
+       fprintf(fp, "%s\n", plugin_dir);
+       init_plugin_index(mwindow, preferences, fp, plugin_path);
+       return 0;
+}