Fix crash introduced in r11877 (oops). Add LV2Plugin::port_index().
[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/vestige/aeffectx.h"
24
25 struct _VSTKey
26 {
27         /** virtual-key code, or 0 if this _VSTFXKey is a `character' key */
28         int special;
29         /** `character' key, or 0 if this _VSTFXKey is a virtual-key */
30         int character;
31 };
32
33 typedef struct _VSTKey VSTKey;
34
35 struct _VSTInfo 
36 {
37         char  *name;
38         char  *creator;
39         int    UniqueID;
40         char  *Category;
41     
42         int    numInputs;
43         int    numOutputs;
44         int    numParams;
45         
46         int    wantMidi;
47         int    wantEvents;
48         int    hasEditor;
49         int    canProcessReplacing;
50         
51         char** ParamNames;
52         char** ParamLabels;
53 };
54
55 typedef struct _VSTInfo VSTInfo;
56
57 typedef AEffect * (* main_entry_t) (audioMasterCallback);
58
59 struct _VSTHandle
60 {
61         void*        dll;
62         char*        name;
63         char*        nameptr;
64         
65         main_entry_t main_entry;
66
67         int          plugincnt;
68 };
69
70 typedef struct _VSTHandle VSTHandle;
71
72 struct _VSTState
73 {
74         AEffect* plugin;
75
76         /* Linux */
77         int         linux_window;            ///< The plugin's parent X11 XWindow
78         int         linux_plugin_ui_window;  ///< The ID of the plugin UI window created by the plugin
79
80         /* Windows */
81         void*       windows_window;
82
83         int         xid;               ///< X11 XWindow
84         
85         int         want_resize;       ///< Set to signal the plugin resized its UI
86         void*       extra_data;        ///< Pointer to any extra data
87         
88         void * event_callback_thisptr;
89         void  (* eventProc) (void * event);
90         
91         VSTHandle*  handle;
92         
93         int         width;
94         int         height;
95         int         wantIdle;
96         int         destroy;
97         int         vst_version;
98         int         has_editor;
99         
100         int         program_set_without_editor;
101         
102         int         want_program;
103         int         want_chunk;
104         int         n_pending_keys;
105         unsigned char * wanted_chunk;
106         int         wanted_chunk_size;
107         float *     want_params;
108         float *     set_params;
109         
110         VSTKey      pending_keys[16];
111
112         int         dispatcher_wantcall;
113         int         dispatcher_opcode;
114         int         dispatcher_index;
115         int         dispatcher_val;
116         void *      dispatcher_ptr;
117         float       dispatcher_opt;
118         int         dispatcher_retval;
119
120         struct _VSTState * next;
121         pthread_mutex_t    lock;
122         pthread_cond_t     window_status_change;
123         pthread_cond_t     plugin_dispatcher_called;
124         pthread_cond_t     window_created;
125         int                been_activated;
126 };
127
128 typedef struct _VSTState VSTState;
129
130 #endif