remove cruft - don't pollute global namespace
authorRobin Gareus <robin@gareus.org>
Fri, 16 Sep 2016 20:05:43 +0000 (22:05 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 16 Sep 2016 20:05:43 +0000 (22:05 +0200)
* remove unused functions
* don't globally export C functions that are only used locally

libs/ardour/ardour/linux_vst_support.h
libs/ardour/linux_vst_support.cc

index 954a465c054e1ea85408a10172c89baaf81d677d..c8724b4ce5d48f21da7dd89823717e9471eaf141 100644 (file)
 /******************************************************************************************/
 
 LIBARDOUR_API extern void (*vstfx_error_callback)(const char *msg);
-
-LIBARDOUR_API void vstfx_set_error_function (void (*func)(const char *));
-
 LIBARDOUR_API void  vstfx_error (const char *fmt, ...);
 
 /*API to vstfx*/
 
-LIBARDOUR_API extern int         vstfx_launch_editor (VSTState *);
+LIBARDOUR_API extern int          vstfx_launch_editor (VSTState *);
 LIBARDOUR_API extern int          vstfx_init (void *);
 LIBARDOUR_API extern void         vstfx_exit ();
 LIBARDOUR_API extern VSTHandle *  vstfx_load (const char*);
@@ -54,14 +51,5 @@ LIBARDOUR_API extern int          vstfx_run_editor (VSTState *);
 LIBARDOUR_API extern void         vstfx_destroy_editor (VSTState *);
 
 LIBARDOUR_API extern void         vstfx_event_loop_remove_plugin (VSTState *);
-LIBARDOUR_API extern int          vstfx_call_dispatcher (VSTState *, int, int, int, void *, float);
-
-/** Load a plugin state from a file.**/
-
-LIBARDOUR_API extern int vstfx_load_state (VSTState* vstfx, char * filename);
-
-/** Save a plugin state to a file.**/
-
-LIBARDOUR_API extern bool vstfx_save_state (VSTState* vstfx, char * filename);
 
 #endif /* __vstfx_h__ */
index 9f2ab0ab3babf75cb45d587f942bb842df8a8041..0314fa8d5779d798718921ffe1ba702c2e5bef4f 100644 (file)
@@ -59,7 +59,7 @@ void vstfx_error (const char *fmt, ...)
 
 /*default error handler callback*/
 
-void default_vstfx_error_callback (const char *desc)
+static void default_vstfx_error_callback (const char *desc)
 {
        PBD::error << desc << endmsg;
 }
@@ -70,7 +70,7 @@ void (*vstfx_error_callback)(const char *desc) = &default_vstfx_error_callback;
 
 /*Create and return a pointer to a new VSTFX handle*/
 
-VSTHandle *
+static VSTHandle *
 vstfx_handle_new ()
 {
        VSTHandle* vstfx = (VSTHandle *) calloc (1, sizeof (VSTHandle));
@@ -79,7 +79,7 @@ vstfx_handle_new ()
 
 /*Create and return a pointer to a new vstfx instance*/
 
-VSTState *
+static VSTState *
 vstfx_new ()
 {
        VSTState* vstfx = (VSTState *) calloc (1, sizeof (VSTState));
@@ -109,7 +109,7 @@ vstfx_new ()
 
 /*This loads the plugin shared library*/
 
-void* vstfx_load_vst_library(const char* path)
+static void* vstfx_load_vst_library(const char* path)
 {
        void* dll;
        char* full_path = NULL;
@@ -386,133 +386,3 @@ void vstfx_close (VSTState* vstfx)
        }
        free(vstfx);
 }
-
-
-bool
-vstfx_save_state (VSTState* vstfx, char * filename)
-{
-       FILE* f = g_fopen (filename, "wb");
-       if (f)
-       {
-               int bytelen;
-               int numParams = vstfx->plugin->numParams;
-               int i;
-               char productString[64];
-               char effectName[64];
-               char vendorString[64];
-               int success;
-
-               /* write header */
-
-               fprintf(f, "<plugin_state>\n");
-
-               success = vstfx_call_dispatcher(vstfx, effGetProductString, 0, 0, productString, 0);
-
-               if(success == 1)
-               {
-                       fprintf (f, "  <check field=\"productString\" value=\"%s\"/>\n", productString);
-               }
-               else
-               {
-                       printf ("No product string\n");
-               }
-
-               success = vstfx_call_dispatcher(vstfx, effGetEffectName, 0, 0, effectName, 0);
-
-               if(success == 1)
-               {
-                       fprintf (f, "  <check field=\"effectName\" value=\"%s\"/>\n", effectName);
-                       printf ("Effect name: %s\n", effectName);
-               }
-               else
-               {
-                       printf ("No effect name\n");
-               }
-
-               success = vstfx_call_dispatcher(vstfx, effGetVendorString, 0, 0, vendorString, 0);
-
-               if( success == 1 )
-               {
-                       fprintf (f, "  <check field=\"vendorString\" value=\"%s\"/>\n", vendorString);
-                       printf ("Vendor string: %s\n", vendorString);
-               }
-               else
-               {
-                       printf ("No vendor string\n");
-               }
-
-
-               if(vstfx->plugin->flags & 32 )
-               {
-                       numParams = 0;
-               }
-
-               for(i=0; i < numParams; i++)
-               {
-                       float val;
-
-                       pthread_mutex_lock( &vstfx->lock );
-                       val = vstfx->plugin->getParameter(vstfx->plugin, i );
-                       pthread_mutex_unlock( &vstfx->lock );
-                       fprintf( f, "  <param index=\"%d\" value=\"%f\"/>\n", i, val );
-               }
-
-               if(vstfx->plugin->flags & 32 )
-               {
-                       printf( "getting chunk...\n" );
-                       void * chunk;
-                       bytelen = vstfx_call_dispatcher(vstfx, 23, 0, 0, &chunk, 0 );
-                       printf( "got tha chunk..\n" );
-                       if( bytelen )
-                       {
-                               if( bytelen < 0 )
-                               {
-                                       printf( "Chunke len < 0 !!! Not saving chunk.\n" );
-                               }
-                               else
-                               {
-                                       //char *encoded = g_base64_encode( chunk, bytelen );
-                                       //fprintf( f, "  <chunk size=\"%d\">\n    %s\n  </chunk>\n", bytelen, encoded );
-                                       //g_free( encoded );
-                               }
-                       }
-               }
-
-               fprintf( f, "</plugin_state>\n" );
-               fclose( f );
-       }
-       else
-       {
-               printf ("Could not open state file\n");
-               return false;
-       }
-       return true;
-}
-
-/*Set up a call to the plugins 'dispatcher' function*/
-
-int vstfx_call_dispatcher (VSTState* vstfx, int opcode, int index, int val, void *ptr, float opt)
-{
-       pthread_mutex_lock (&vstfx->lock);
-
-       /*Set up the opcode and parameters*/
-
-       vstfx->dispatcher_opcode = opcode;
-       vstfx->dispatcher_index = index;
-       vstfx->dispatcher_val = val;
-       vstfx->dispatcher_ptr = ptr;
-       vstfx->dispatcher_opt = opt;
-
-       /*Signal that we want the call to happen*/
-
-       vstfx->dispatcher_wantcall = 1;
-
-       /*Wait for the call to happen*/
-
-       pthread_cond_wait (&vstfx->plugin_dispatcher_called, &vstfx->lock);
-       pthread_mutex_unlock (&vstfx->lock);
-
-       /*Return the result*/
-
-       return vstfx->dispatcher_retval;
-}