diff options
author | Robin Gareus <robin@gareus.org> | 2016-09-16 22:05:43 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-09-16 22:05:43 +0200 |
commit | 8e36e9bf053eb6b880a3ab6c8039d2158cd3ca7a (patch) | |
tree | 06ed58be0c965aa8f6ae9369a9f8b6f0fa98b324 /libs/ardour/linux_vst_support.cc | |
parent | 0996656eccceccccc4eea7ec74bfe60559ee2fff (diff) |
remove cruft - don't pollute global namespace
* remove unused functions
* don't globally export C functions that are only used locally
Diffstat (limited to 'libs/ardour/linux_vst_support.cc')
-rw-r--r-- | libs/ardour/linux_vst_support.cc | 138 |
1 files changed, 4 insertions, 134 deletions
diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc index 9f2ab0ab3b..0314fa8d57 100644 --- a/libs/ardour/linux_vst_support.cc +++ b/libs/ardour/linux_vst_support.cc @@ -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; -} |