summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/vst_types.h
blob: 7bce34f05a22c0129d7461165215050314065cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
    Copyright (C) 2010 Paul Davis

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __ardour_vst_types_h__
#define __ardour_vst_types_h__

#include <pthread.h>
#include "ardour/libardour_visibility.h"
#include "ardour/vestige/vestige.h"

struct LIBARDOUR_API _VSTKey
{
	/** virtual-key code, or 0 if this _VSTFXKey is a `character' key */
	int special;
	/** `character' key, or 0 if this _VSTFXKey is a virtual-key */
	int character;
};

typedef struct _VSTKey VSTKey;

struct LIBARDOUR_API _VSTInfo
{
	char  *name;
	char  *creator;
	int    UniqueID;
	char  *Category;

	int    numInputs;
	int    numOutputs;
	int    numParams;

	int    wantMidi;
	int    wantEvents;
	int    hasEditor;
	int    isInstrument; // still unused
	int    canProcessReplacing;

	char** ParamNames;
	char** ParamLabels;
};

typedef struct _VSTInfo VSTInfo;

typedef AEffect * (* main_entry_t) (audioMasterCallback);

struct LIBARDOUR_API _VSTHandle
{
	void*        dll;
	char*        name;
	char*        path;

	main_entry_t main_entry;

	int          plugincnt;
#ifdef MACVST_SUPPORT
	int32_t      res_file_id;
#endif
};

typedef struct _VSTHandle VSTHandle;

struct LIBARDOUR_API _VSTState
{
	AEffect*    plugin;
	VSTHandle*  handle;
	audioMasterCallback amc;

	void*       gtk_window_parent;
	int         xid;                     ///< X11 XWindow (wine + lxvst)

	/* LXVST/X11 */
	int         linux_window;            ///< The plugin's parent X11 XWindow
	int         linux_plugin_ui_window;  ///< The ID of the plugin UI window created by the plugin
	void  (* eventProc) (void * event);  ///< X11 UI _XEventProc

	/* Windows */
	void*       windows_window;


	int width;
	int height;
	int wantIdle;

	int voffset;
	int hoffset;
	int gui_shown;
	int destroy;
	int vst_version;
	int has_editor;

	int     program_set_without_editor;
	int     want_program;
	int     want_chunk;
	int     n_pending_keys;
	unsigned char* wanted_chunk;
	int     wanted_chunk_size;
	float*  want_params;
	float*  set_params;

	VSTKey  pending_keys[16];

	int     dispatcher_wantcall;
	int     dispatcher_opcode;
	int     dispatcher_index;
	int     dispatcher_val;
	void*   dispatcher_ptr;
	float   dispatcher_opt;
	int     dispatcher_retval;

	struct _VSTState* next;
	pthread_mutex_t   lock;
	pthread_mutex_t   state_lock;
	pthread_cond_t    window_status_change;
	pthread_cond_t    plugin_dispatcher_called;
	pthread_cond_t    window_created;
	int               been_activated;
};

typedef struct _VSTState VSTState;

#ifdef __cplusplus
extern "C" {
#endif
LIBARDOUR_API extern void vststate_init (VSTState* state);
LIBARDOUR_API extern void vststate_maybe_set_program (VSTState* state);
#ifdef __cplusplus
}
#endif

#endif