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
|
//=============================================================================
// MusE
// Linux Music Editor
// $Id:$
//
// Copyright (C) 2002-2006 by Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// 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 __VST_H__
#define __VST_H__
#include "synth.h"
#include "plugin.h"
struct _FSTHandle;
struct _FST;
class VstPluginIF;
//---------------------------------------------------------
// FstPlugin
//---------------------------------------------------------
class FstPlugin {
_FST* _fst;
int version;
public:
FstPlugin();
~FstPlugin();
void instantiate(FSTHandle* s, void*);
int numInputs() const;
int numOutputs() const;
int numParameter() const;
void setProgram(int p);
void mainsChanged(bool on);
void setBlockSize(int bs);
void setSampleRate(float sr);
bool runEditor();
void destroyEditor();
int getVstVersion();
bool hasGui() const;
bool canReplacing();
void setParameter(int idx, float value);
float getParameter(int idx);
void processReplacing(float**, float**, int);
void process(float**, float**, int);
void putEvent(const MidiEvent& ev);
const char* getParameterName(int idx) const;
const char* getParameterLabel(int idx) const;
const char* getParameterDisplay(int idx, float val) const;
};
//---------------------------------------------------------
// VstSynth
//---------------------------------------------------------
class VstSynth : public Synth {
_FSTHandle* fstHandle;
int vstVersion;
public:
VstSynth(const QFileInfo* fi) : Synth(fi, fi->baseName()) {
fstHandle = 0;
}
virtual ~VstSynth() {}
virtual void incInstances(int val);
virtual SynthIF* createSIF(SynthI*);
};
//---------------------------------------------------------
// VstSynthIF
// VSTi synthesizer instance
//---------------------------------------------------------
class VstSynthIF : public SynthIF
{
FstPlugin* _fst;
bool _guiVisible;
public:
VstSynthIF(SynthI* s) : SynthIF(s) {
_fst = 0;
_guiVisible = false;
}
virtual ~VstSynthIF();
virtual bool guiVisible() const;
virtual void showGui(bool v);
virtual bool hasGui() const;
virtual void getGeometry(int*, int*, int*, int*) const {}
virtual void setGeometry(int, int, int, int) {}
virtual void getData(MidiEventList*, unsigned pos, int ports, unsigned n, float** buffer) ;
virtual bool putEvent(const MidiEvent& ev);
virtual MidiEvent receiveEvent();
virtual int eventsPending() const { return 0; }
virtual int channels() const;
virtual void deactivate3();
virtual QString getPatchName(int, int) { return QString(""); }
virtual void populatePatchPopup(QMenu*, int) {};
virtual void write(Xml& xml) const;
virtual void setParameter(int idx, float value);
virtual int getControllerInfo(int, const char**, int*, int*, int*) { return 0; }
bool init(FSTHandle*);
};
//---------------------------------------------------------
// VstPlugin
//---------------------------------------------------------
class VstPlugin : public Plugin {
_FSTHandle* fstHandle;
FSTInfo* info;
protected:
int vstVersion;
friend class VstPluginIF;
public:
VstPlugin(const QFileInfo* fi, FSTInfo* i);
virtual ~VstPlugin();
virtual PluginIF* createPIF(PluginI*);
virtual QString name() const { return QString(info->name); }
virtual QString label() const { return QString(info->name); }
virtual int parameter() const;
virtual int inports() const;
virtual int outports() const;
virtual unsigned long id() const;
};
//---------------------------------------------------------
// VstPluginIF
// Vst plugin instance interface
//---------------------------------------------------------
class VstPluginIF : public PluginIF {
FstPlugin* _fst;
bool _guiVisible;
public:
VstPluginIF(PluginI*);
virtual ~VstPluginIF();
virtual void apply(unsigned nframes, float** src, float** dst);
virtual void activate() {}
virtual void deactivate() {}
virtual void cleanup() {}
virtual void setParam(int i, double val);
virtual float param(int i) const;
virtual const char* getParameterName(int k) const;
virtual const char* getParameterLabel(int) const;
virtual const char* getParameterDisplay(int, float) const;
virtual bool hasGui() const;
virtual bool guiVisible() const { return _guiVisible; }
virtual void showGui(bool f);
bool init(FSTHandle*);
};
#endif
|