#include <signal.h>
#include <dlfcn.h>
#include <string.h>
+#include <strings.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
mac_vst_new ()
{
VSTState* mac_vst = (VSTState *) calloc (1, sizeof (VSTState));
-
- /*Mutexes*/
- pthread_mutex_init (&mac_vst->lock, 0);
- pthread_cond_init (&mac_vst->window_status_change, 0); // XXX unused
- pthread_cond_init (&mac_vst->plugin_dispatcher_called, 0); // XXX unused
- pthread_cond_init (&mac_vst->window_created, 0); // XXX unused
-
- /*Safe values*/
- mac_vst->want_program = -1;
- mac_vst->want_chunk = 0;
- mac_vst->n_pending_keys = 0;
- mac_vst->has_editor = 0;
- mac_vst->program_set_without_editor = 0;
- mac_vst->linux_window = 0;
- mac_vst->linux_plugin_ui_window = 0;
- mac_vst->eventProc = 0;
- mac_vst->extra_data = 0;
- mac_vst->want_resize = 0;
-
+ vststate_init (mac_vst);
return mac_vst;
}
}
mac_vst->handle = fhandle;
- mac_vst->plugin->user = userptr;
+ mac_vst->plugin->ptr1 = userptr;
if (mac_vst->plugin->magic != kEffectMagic)
{
return 0;
}
- mac_vst->plugin->dispatcher (mac_vst->plugin, effOpen, 0, 0, 0, 0);
-
- /*May or May not need to 'switch the plugin on' here - unlikely
- since FST doesn't and most plugins start up 'On' by default - I think this is the least of our worries*/
-
- //mac_vst->plugin->dispatcher (mac_vst->plugin, effMainsChanged, 0, 1, 0, 0);
-
- /* configure plugin to use Cocoa View */
- mac_vst->plugin->dispatcher (mac_vst->plugin, effCanDo, 0, 0, const_cast<char*> ("hasCockosViewAsConfig"), 0.0f);
-
- mac_vst->vst_version = mac_vst->plugin->dispatcher (mac_vst->plugin, effGetVstVersion, 0, 0, 0, 0);
+ if (!userptr) {
+ /* scanning.. or w/o master-callback userptr == 0, open now.
+ *
+ * Session::vst_callback needs a pointer to the AEffect
+ * ((VSTPlugin*)userptr)->_plugin = vstfx->plugin
+ * before calling effOpen, because effOpen may call back
+ */
+ mac_vst->plugin->dispatcher (mac_vst->plugin, effOpen, 0, 0, 0, 0);
+ mac_vst->vst_version = mac_vst->plugin->dispatcher (mac_vst->plugin, effGetVstVersion, 0, 0, 0, 0);
+
+ /* configure plugin to use Cocoa View */
+ mac_vst->plugin->dispatcher (mac_vst->plugin, effCanDo, 0, 0, const_cast<char*> ("hasCockosViewAsConfig"), 0.0f);
+ }
mac_vst->handle->plugincnt++;
mac_vst->wantIdle = 0;