X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Ffst%2Fvstwin.c;h=27fb3cbead21af949eb87ed6361e4d21df356f61;hb=8b745aa4b43330b7fd0ddbe3e886c804da54156b;hp=75bf2372da8dbf82f3b4f7ebbb2e4ce0bb2697f5;hpb=dfdf9a35f1e990c45f35632eb993eb67f4f7abf8;p=ardour.git diff --git a/libs/fst/vstwin.c b/libs/fst/vstwin.c index 75bf2372da..27fb3cbead 100644 --- a/libs/fst/vstwin.c +++ b/libs/fst/vstwin.c @@ -2,16 +2,16 @@ #include #include +#define fst_error(...) fprintf(stderr, __VA_ARGS__) + #ifdef PLATFORM_WINDOWS -#include -#include +#include static UINT_PTR idle_timer_id = 0; #else /* linux + wine */ #include // PATH_MAX -#include // basename #include #include #include @@ -116,9 +116,9 @@ idle_hands( } } + pthread_mutex_lock (&fst->lock); #ifndef PLATFORM_WINDOWS /* linux + wine */ /* Dispatch messages to send keypresses to the plugin */ - pthread_mutex_lock (&fst->lock); int i; for (i = 0; i < fst->n_pending_keys; ++i) { @@ -141,6 +141,7 @@ idle_hands( } fst->n_pending_keys = 0; +#endif /* See comment for maybe_set_program call below */ maybe_set_program (fst); @@ -158,7 +159,6 @@ idle_hands( maybe_set_program (fst); fst->program_set_without_editor = 1; } -#endif pthread_mutex_unlock (&fst->lock); } @@ -223,9 +223,11 @@ fst_new (void) fst->n_pending_keys = 0; fst->has_editor = 0; #ifdef PLATFORM_WINDOWS - fst->voffset = 36; + fst->voffset = 50; + fst->hoffset = 0; #else /* linux + wine */ fst->voffset = 24; + fst->hoffset = 6; #endif fst->program_set_without_editor = 0; return fst; @@ -463,9 +465,9 @@ fst_move_window_into_view (VSTState* fst) { if (fst->windows_window) { #ifdef PLATFORM_WINDOWS - SetWindowPos ((HWND)(fst->windows_window), 0, 0, fst->voffset, fst->width, fst->height, 0); + SetWindowPos ((HWND)(fst->windows_window), 0, fst->hoffset, fst->voffset, fst->width + fst->hoffset, fst->height + fst->voffset, 0); #else /* linux + wine */ - SetWindowPos ((HWND)(fst->windows_window), 0, 0, 0, fst->width, fst->height, 0); + SetWindowPos ((HWND)(fst->windows_window), 0, 0, 0, fst->width + fst->hoffset, fst->height + fst->voffset, 0); #endif ShowWindow ((HWND)(fst->windows_window), SW_SHOWNA); } @@ -487,9 +489,8 @@ fst_load (const char *path) if ((strlen(path)) && (NULL != (fhandle = fst_handle_new ()))) { char* period; - fhandle->nameptr = strdup (path); fhandle->path = strdup (path); - fhandle->name = basename(fhandle->nameptr); + fhandle->name = g_path_get_basename(path); if ((period = strrchr (fhandle->name, '.'))) { *period = '\0'; } @@ -500,10 +501,10 @@ fst_load (const char *path) return NULL; } - fhandle->main_entry = (main_entry_t) GetProcAddress (fhandle->dll, "main"); + fhandle->main_entry = (main_entry_t) GetProcAddress ((HMODULE)fhandle->dll, "main"); if (fhandle->main_entry == 0) { - if ((fhandle->main_entry = (main_entry_t) GetProcAddress (fhandle->dll, "VSTPluginMain"))) { + if ((fhandle->main_entry = (main_entry_t) GetProcAddress ((HMODULE)fhandle->dll, "VSTPluginMain"))) { fprintf(stderr, "VST >= 2.4 plugin '%s'\n", path); //PBD::warning << path << _(": is a VST >= 2.4 - this plugin may or may not function correctly with this version of Ardour.") << endmsg; } @@ -538,9 +539,8 @@ fst_unload (VSTHandle** fhandle) (*fhandle)->path = NULL; } - if ((*fhandle)->nameptr) { - free ((*fhandle)->nameptr); - (*fhandle)->nameptr = NULL; + if ((*fhandle)->name) { + free ((*fhandle)->name); (*fhandle)->name = NULL; } @@ -606,7 +606,7 @@ fst_close (VSTState* fst) if (fst->handle->plugincnt && --fst->handle->plugincnt == 0) { fst->handle->main_entry = NULL; - fst_unload (&fst->handle); + fst_unload (&fst->handle); // XXX } }