forked from osxmidi/LinVst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remotepluginserver.h
228 lines (188 loc) · 9.24 KB
/
remotepluginserver.h
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/* dssi-vst: a DSSI plugin wrapper for VST effects and instruments
Copyright 2004-2007 Chris Cannam
*/
#ifndef REMOTE_PLUGIN_SERVER_H
#define REMOTE_PLUGIN_SERVER_H
#ifdef __WINE__
#else
#define __cdecl
#endif
#ifdef VESTIGE
typedef int16_t VstInt16;
typedef int32_t VstInt32;
typedef int64_t VstInt64;
typedef intptr_t VstIntPtr;
#define VESTIGECALLBACK __cdecl
#include "vestige.h"
#else
#include "pluginterfaces/vst2.x/aeffectx.h"
#endif
#include "remoteplugin.h"
#include "rdwrops.h"
#include <string>
class RemotePluginServer
{
public:
virtual ~RemotePluginServer();
virtual float getVersion() { return RemotePluginVersion; }
virtual std::string getName() = 0;
virtual std::string getMaker() = 0;
virtual void setBufferSize(int) = 0;
virtual void setSampleRate(int) = 0;
virtual void reset() = 0;
virtual void terminate() = 0;
virtual int getInputCount() = 0;
virtual int getOutputCount() = 0;
virtual int getFlags() = 0;
virtual int getinitialDelay() = 0;
virtual int processVstEvents() = 0;
virtual void getChunk() = 0;
virtual void setChunk() = 0;
virtual void canBeAutomated() = 0;
virtual void getProgram() = 0;
virtual void EffectOpen() = 0;
// virtual int getUniqueID() = 0;
// virtual int getVersion() = 0;
// virtual void eff_mainsChanged(int v) = 0;
virtual int getUID() { return 0; }
virtual int getParameterCount() { return 0; }
virtual std::string getParameterName(int) { return ""; }
virtual void setParameter(int, float) { return; }
virtual float getParameter(int) { return 0.0f; }
virtual float getParameterDefault(int) { return 0.0f; }
virtual void getParameters(int p0, int pn, float *v) { for (int i = p0; i <= pn; ++i) v[i - p0] = 0.0f; }
#ifdef WAVES
virtual int getShellName(char *name) { return 0; }
#endif
virtual int getProgramCount() { return 0; }
virtual std::string getProgramNameIndexed(int) { return ""; }
virtual std::string getProgramName() { return ""; }
virtual void setCurrentProgram(int) { return; }
virtual int getEffInt(int opcode) { return 0; }
virtual std::string getEffString(int opcode, int index) { return ""; }
virtual void effDoVoid(int opcode) { return; }
virtual int effDoVoid2(int opcode, int index, int value, float opt) { return 0; }
virtual void process(float **inputs, float **outputs, int sampleFrames) = 0;
#ifdef DOUBLEP
virtual void processdouble(double **inputs, double **outputs, int sampleFrames) = 0;
virtual bool setPrecision(int value) {return false; }
double **m_inputsdouble;
double **m_outputsdouble;
#endif
#ifdef MIDIEFF
virtual bool getInProp(int index) {return false; }
virtual bool getOutProp(int index) {return false; }
virtual bool getMidiKey(int index) {return false; }
virtual bool getMidiProgName(int index) {return false; }
virtual bool getMidiCurProg(int index) {return false; }
virtual bool getMidiProgCat(int index) {return false; }
virtual bool getMidiProgCh(int index) {return false; }
virtual bool setSpeaker() {return false; }
virtual bool getSpeaker() {return false; }
#endif
#ifdef CANDOEFF
virtual bool getEffCanDo(std::string) = 0;
#endif
virtual void setDebugLevel(RemotePluginDebugLevel) { return; }
virtual bool warn(std::string) = 0;
virtual void showGUI() { }
virtual void hideGUI() { }
virtual void hideGUI2() { }
#ifdef EMBED
virtual void openGUI() { }
#endif
void dispatch(int timeout = -1); // may throw RemotePluginClosedException
void dispatchControl(int timeout = -1); // may throw RemotePluginClosedException
void dispatchProcess(int timeout = -1); // may throw RemotePluginClosedException
void dispatchGetSet(int timeout = -1); // may throw RemotePluginClosedException
void dispatchPar(int timeout = -1); // may throw RemotePluginClosedException
int sizeShm();
char *m_shm;
char *m_shm2;
char *m_shm3;
int m_shmControlFd;
int m_threadsfinish;
void waitForClient2exit();
void waitForClient3exit();
void waitForClient4exit();
void waitForClient5exit();
protected:
RemotePluginServer(std::string fileIdentifiers);
void cleanup();
private:
void dispatchControlEvents();
void dispatchProcessEvents();
void dispatchGetSetEvents();
void dispatchParEvents();
int m_flags;
int m_delay;
int m_shmFd;
int m_shmFd2;
int m_shmFd3;
size_t m_shmSize;
size_t m_shmSize2;
size_t m_shmSize3;
char *m_shmFileName;
char *m_shmFileName2;
char *m_shmFileName3;
float **m_inputs;
float **m_outputs;
RemotePluginDebugLevel m_debugLevel;
public:
#ifdef CHUNKBUF
void *chunkptr;
char *chunkptr2;
#endif
int m_bufferSize;
int m_numInputs;
int m_numOutputs;
char *m_shmControlFileName;
ShmControl *m_shmControl;
int m_shmControl2Fd;
char *m_shmControl2FileName;
ShmControl *m_shmControl2;
int m_shmControl3Fd;
char *m_shmControl3FileName;
ShmControl *m_shmControl3;
int m_shmControl4Fd;
char *m_shmControl4FileName;
ShmControl *m_shmControl4;
int m_shmControl5Fd;
char *m_shmControl5FileName;
ShmControl *m_shmControl5;
void waitForServer();
void waitForServerexit();
void waitForServerexcept();
void RemotePluginClosedException();
int m_inexcept;
int m_runok;
int m_386run;
int starterror;
bool fwait(int *fcount, int ms);
bool fpost(int *fcount);
VstTimeInfo *timeinfo;
int m_updateio;
int m_updatein;
int m_updateout;
void rdwr_tryReadring(RingBuffer *ringbuf, void *buf, size_t count, const char *file, int line);
void rdwr_tryWritering(RingBuffer *ringbuf, const void *buf, size_t count, const char *file, int line);
void rdwr_writeOpcodering(RingBuffer *ringbuf, RemotePluginOpcode opcode, const char *file, int line);
int rdwr_readIntring(RingBuffer *ringbuf, const char *file, int line);
void rdwr_writeIntring(RingBuffer *ringbuf, int i, const char *file, int line);
void rdwr_writeFloatring(RingBuffer *ringbuf, float f, const char *file, int line);
float rdwr_readFloatring(RingBuffer *ringbuf, const char *file, int line);
void rdwr_writeStringring(RingBuffer *ringbuf, const std::string &str, const char *file, int line);
std::string rdwr_readStringring(RingBuffer *ringbuf, const char *file, int line);
void rdwr_commitWrite(RingBuffer *ringbuf, const char *file, int line);
bool dataAvailable(RingBuffer *ringbuf);
void rdwr_tryRead(char *ptr, void *buf, size_t count, const char *file, int line);
void rdwr_tryWrite(char *ptr, const void *buf, size_t count, const char *file, int line);
void rdwr_writeOpcode(char *ptr, RemotePluginOpcode opcode, const char *file, int line);
void rdwr_writeString(char *ptr, const std::string &str, const char *file, int line);
std::string rdwr_readString(char *ptr, const char *file, int line);
void rdwr_writeInt(char *ptr, int i, const char *file, int line);
int rdwr_readInt(char *ptr, const char *file, int line);
void rdwr_writeFloat(char *ptr, float f, const char *file, int line);
float rdwr_readFloat(char *ptr, const char *file, int line);
};
#endif