summaryrefslogtreecommitdiff
path: root/libs/fst/vstwin.c
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-29 23:31:02 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-29 23:31:02 +0000
commit72190954c49dbe5874115132e0497cf5b8d6e633 (patch)
tree90f60f857b461cb924801e0530b374710bd0b1d5 /libs/fst/vstwin.c
parentcf2cd98db01f28aab4e6dfcd3e0de9c5a26964c4 (diff)
Clean up VST plugin key handling slightly.
git-svn-id: svn://localhost/ardour2/branches/3.0@8377 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/fst/vstwin.c')
-rw-r--r--libs/fst/vstwin.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/libs/fst/vstwin.c b/libs/fst/vstwin.c
index f1553821ad..b9f372d461 100644
--- a/libs/fst/vstwin.c
+++ b/libs/fst/vstwin.c
@@ -14,6 +14,8 @@
#include <X11/X.h>
#include <X11/Xlib.h>
+extern char * strdup (const char *);
+
struct ERect{
short top;
short left;
@@ -73,7 +75,7 @@ fst_new ()
fst->want_program = -1;
fst->want_chunk = 0;
fst->current_program = -1;
- fst->pending_key = 0;
+ fst->n_pending_keys = 0;
return fst;
}
@@ -211,20 +213,39 @@ again:
}
+ pthread_mutex_lock (&plugin_mutex);
for (fst = fst_first; fst; fst = fst->next) {
- if (fst->pending_key) {
- msg.message = WM_CHAR;
+ pthread_mutex_lock (&fst->lock);
+
+ /* Dispatch messages to send keypresses to the plugin */
+
+ for (int i = 0; i < fst->n_pending_keys; ++i) {
+ /* I'm not quite sure what is going on here; it seems
+ `special' keys must be delivered with WM_KEYDOWN,
+ but that alphanumerics etc. must use WM_CHAR or
+ they will be ignored. Ours is not to reason why ...
+ */
+ if (fst->pending_keys[i].special != 0) {
+ msg.message = WM_KEYDOWN;
+ msg.wParam = fst->pending_keys[i].special;
+ } else {
+ msg.message = WM_CHAR;
+ msg.wParam = fst->pending_keys[i].character;
+ }
msg.hwnd = GetFocus ();
- msg.wParam = fst->pending_key;
msg.lParam = 0;
DispatchMessageA (&msg);
- fst->pending_key = 0;
}
+ fst->n_pending_keys = 0;
+ pthread_mutex_unlock (&fst->lock);
+
}
+ pthread_mutex_unlock (&plugin_mutex);
+
}
return 0;
@@ -752,7 +773,6 @@ int fst_save_state (FST * fst, char * filename)
if (f) {
int bytelen;
int numParams = fst->plugin->numParams;
- unsigned i;
char productString[64];
char effectName[64];
char vendorString[64];
@@ -789,13 +809,13 @@ int fst_save_state (FST * fst, char * filename)
numParams = 0;
}
- for( i=0; i<numParams; i++ ) {
+ for (int j = 0; j < numParams; ++j) {
float val;
pthread_mutex_lock( &fst->lock );
- val = fst->plugin->getParameter( fst->plugin, i );
+ val = fst->plugin->getParameter (fst->plugin, j);
pthread_mutex_unlock( &fst->lock );
- fprintf( f, " <param index=\"%d\" value=\"%f\"/>\n", i, val );
+ fprintf( f, " <param index=\"%d\" value=\"%f\"/>\n", j, val );
}
if( fst->plugin->flags & 32 ) {