32 #include <glib/gstdio.h>
33 #include <glibmm/miscutils.h>
34 #include <glibmm/fileutils.h>
55 vsnprintf (buffer,
sizeof(buffer), fmt, ap);
89 pthread_mutex_init (&vstfx->
lock, 0);
115 char* full_path = NULL;
126 if ((dll = dlopen (path, RTLD_LOCAL | RTLD_LAZY)) != 0) {
130 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
138 envdup = getenv (
"LXVST_PATH");
147 envdup = strdup (envdup);
156 lxvst_path = strtok_r (envdup,
":", &saveptr);
158 while (lxvst_path != 0)
161 len1 = strlen(lxvst_path);
163 if (full_path) free(full_path);
164 full_path = (
char*)malloc(len1 + 1 + len2 + 1);
165 memcpy(full_path, lxvst_path, len1);
166 full_path[len1] =
'/';
167 memcpy(full_path + len1 + 1, path, len2);
168 full_path[len1 + 1 + len2] =
'\0';
172 if ((dll = dlopen(full_path, RTLD_LOCAL | RTLD_LAZY)) != 0)
180 lxvst_path = strtok_r (0,
":", &saveptr);
184 if (full_path) free(full_path);
205 if (strstr (path,
".so") == 0)
210 buf = (
char *)malloc(strlen(path) + 4);
212 sprintf (buf,
"%s.so", path);
246 PBD::warning << path <<
_(
": is a VST >= 2.4 - this plugin may or may not function correctly with this version of Ardour.") <<
endmsg;
285 dlclose(fhandle->
dll);
291 free (fhandle->
name);
309 vstfx_error(
"** ERROR ** VSTFX : The handle was 0\n" );
316 vstfx_error (
"** ERROR ** VSTFX : %s could not be instantiated :(\n", fhandle->
name);
326 vstfx_error (
"** ERROR ** VSTFX : %s is not a VST plugin\n", fhandle->
name);
394 FILE*
f = g_fopen (filename,
"wb");
400 char productString[64];
402 char vendorString[64];
407 fprintf(f,
"<plugin_state>\n");
413 fprintf (f,
" <check field=\"productString\" value=\"%s\"/>\n", productString);
417 printf (
"No product string\n");
424 fprintf (f,
" <check field=\"effectName\" value=\"%s\"/>\n", effectName);
425 printf (
"Effect name: %s\n", effectName);
429 printf (
"No effect name\n");
436 fprintf (f,
" <check field=\"vendorString\" value=\"%s\"/>\n", vendorString);
437 printf (
"Vendor string: %s\n", vendorString);
441 printf (
"No vendor string\n");
450 for(i=0; i < numParams; i++)
454 pthread_mutex_lock( &vstfx->
lock );
456 pthread_mutex_unlock( &vstfx->
lock );
457 fprintf( f,
" <param index=\"%d\" value=\"%f\"/>\n", i, val );
462 printf(
"getting chunk...\n" );
465 printf(
"got tha chunk..\n" );
470 printf(
"Chunke len < 0 !!! Not saving chunk.\n" );
481 fprintf( f,
"</plugin_state>\n" );
486 printf (
"Could not open state file\n");
496 pthread_mutex_lock (&vstfx->
lock);
513 pthread_mutex_unlock (&vstfx->
lock);
pthread_cond_t window_status_change
VSTState * vstfx_instantiate(VSTHandle *fhandle, audioMasterCallback amc, void *userptr)
intptr_t(* audioMasterCallback)(AEffect *, int32_t, int32_t, intptr_t, void *, float)
#define effGetProductString
int want_resize
Set to signal the plugin resized its UI.
VSTHandle * vstfx_handle_new()
void vstfx_close(VSTState *vstfx)
float(* getParameter)(struct _AEffect *, int)
void default_vstfx_error_callback(const char *desc)
intptr_t(* dispatcher)(struct _AEffect *, int, int, intptr_t, void *, float)
int vstfx_unload(VSTHandle *fhandle)
LIBPBD_API Transmitter error
LIBPBD_API Transmitter warning
void(* vstfx_error_callback)(const char *desc)
int linux_plugin_ui_window
The ID of the plugin UI window created by the plugin.
std::ostream & endmsg(std::ostream &ostr)
pthread_cond_t plugin_dispatcher_called
AEffect *(* main_entry_t)(audioMasterCallback)
LIBARDOUR_API void vstfx_destroy_editor(VSTState *)
int program_set_without_editor
void vstfx_error(const char *fmt,...)
pthread_cond_t window_created
bool vstfx_save_state(VSTState *vstfx, char *filename)
#define effGetVendorString
VSTHandle * vstfx_load(const char *path)
void * vstfx_load_vst_library(const char *path)
int vstfx_call_dispatcher(VSTState *vstfx, int opcode, int index, int val, void *ptr, float opt)
LIBPBD_API Glib::ustring basename_nosuffix(Glib::ustring)
void * extra_data
Pointer to any extra data.
void(* eventProc)(void *event)
std::string string_compose(const std::string &fmt, const T1 &o1)
int linux_window
The plugin's parent X11 XWindow.