merge with master
[ardour.git] / libs / ardour / ardour / vst_types.h
1 /*
2     Copyright (C) 2010 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_vst_types_h__
21 #define __ardour_vst_types_h__
22
23 #include "ardour/libardour_visibility.h"
24 #include "ardour/vestige/aeffectx.h"
25
26 struct LIBARDOUR_API _VSTKey
27 {
28         /** virtual-key code, or 0 if this _VSTFXKey is a `character' key */
29         int special;
30         /** `character' key, or 0 if this _VSTFXKey is a virtual-key */
31         int character;
32 };
33
34 typedef struct _VSTKey VSTKey;
35
36 struct LIBARDOUR_API _VSTInfo 
37 {
38         char  *name;
39         char  *creator;
40         int    UniqueID;
41         char  *Category;
42     
43         int    numInputs;
44         int    numOutputs;
45         int    numParams;
46         
47         int    wantMidi;
48         int    wantEvents;
49         int    hasEditor;
50         int    canProcessReplacing;
51         
52         char** ParamNames;
53         char** ParamLabels;
54 };
55
56 typedef struct _VSTInfo VSTInfo;
57
58 typedef AEffect * (* main_entry_t) (audioMasterCallback);
59
60 struct LIBARDOUR_API _VSTHandle
61 {
62         void*        dll;
63         char*        name;
64         char*        nameptr;
65         
66         main_entry_t main_entry;
67
68         int          plugincnt;
69 };
70
71 typedef struct _VSTHandle VSTHandle;
72
73 struct LIBARDOUR_API _VSTState
74 {
75         AEffect* plugin;
76
77         /* Linux */
78         int         linux_window;            ///< The plugin's parent X11 XWindow
79         int         linux_plugin_ui_window;  ///< The ID of the plugin UI window created by the plugin
80
81         /* Windows */
82         void*       windows_window;
83
84         int         xid;               ///< X11 XWindow
85         
86         int         want_resize;       ///< Set to signal the plugin resized its UI
87         void*       extra_data;        ///< Pointer to any extra data
88         
89         void * event_callback_thisptr;
90         void  (* eventProc) (void * event);
91         
92         VSTHandle*  handle;
93         
94         int         width;
95         int         height;
96         int         wantIdle;
97         int         destroy;
98         int         vst_version;
99         int         has_editor;
100         
101         int         program_set_without_editor;
102         
103         int         want_program;
104         int         want_chunk;
105         int         n_pending_keys;
106         unsigned char * wanted_chunk;
107         int         wanted_chunk_size;
108         float *     want_params;
109         float *     set_params;
110         
111         VSTKey      pending_keys[16];
112
113         int         dispatcher_wantcall;
114         int         dispatcher_opcode;
115         int         dispatcher_index;
116         int         dispatcher_val;
117         void *      dispatcher_ptr;
118         float       dispatcher_opt;
119         int         dispatcher_retval;
120
121         struct _VSTState * next;
122         pthread_mutex_t    lock;
123         pthread_cond_t     window_status_change;
124         pthread_cond_t     plugin_dispatcher_called;
125         pthread_cond_t     window_created;
126         int                been_activated;
127 };
128
129 typedef struct _VSTState VSTState;
130
131 #endif