1
//=============================================================================
4
// $Id: osc.h,v 1.0.0.0 2010/04/22 10:05:00 terminator356 Exp $
6
// Copyright (C) 1999-2010 by Werner Schweer and others
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License version 2.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
//=============================================================================
36
// Keep the OSC fifo small. There may be thousands of controls, and each control needs a fifo.
37
// Oops, no, if the user keeps adjusting a slider without releasing the mouse button, then all of the
38
// events are sent at once upon releasing the button, meaning there might be thousands of events at once.
39
#define OSC_FIFO_SIZE 512
41
//---------------------------------------------------------
43
// Item struct for OscGuiControlFifo.
44
//---------------------------------------------------------
46
struct OscControlValue
50
// maybe timestamp, too ?
53
//---------------------------------------------------------
55
// A fifo for each of the OSC controls.
56
//---------------------------------------------------------
60
OscControlValue fifo[OSC_FIFO_SIZE];
66
OscControlFifo() { clear(); }
67
bool put(const OscControlValue& event); // returns true on fifo overflow
68
OscControlValue get();
69
const OscControlValue& peek(int n = 0);
71
bool isEmpty() const { return size == 0; }
72
void clear() { size = 0, wIndex = 0, rIndex = 0; }
73
int getSize() const { return size; }
76
//---------------------------------------------------------
78
// Open Sound Control Interface
79
//---------------------------------------------------------
88
DssiSynthIF* _oscSynthIF;
91
QProcess* _oscGuiQProc;
94
char* _uiOscControlPath;
95
char* _uiOscConfigurePath;
96
char* _uiOscProgramPath;
100
OscControlFifo* _oscControlFifos;
106
void oscSetPluginI(PluginI*);
109
void oscSetSynthIF(DssiSynthIF*);
112
int oscUpdate(lo_arg**);
113
int oscProgram(lo_arg**);
114
int oscControl(lo_arg**);
115
int oscExiting(lo_arg**);
116
int oscMidi(lo_arg**);
117
int oscConfigure(lo_arg**);
120
void oscShowGui(bool);
121
bool oscGuiVisible() const;
122
OscControlFifo* oscFifo(unsigned long) const;
129
QProcess* _oscGuiQProc;
132
char* _uiOscSampleRatePath;
133
char* _uiOscConfigurePath;
134
char* _uiOscProgramPath;
135
char* _uiOscControlPath;
136
char* _uiOscShowPath;
139
OscControlFifo* _oscControlFifos;
141
virtual bool oscInitGui(const QString& /*typ*/, const QString& /*baseName*/, const QString& /*name*/,
142
const QString& /*label*/, const QString& /*filePath*/, const QString& /*dirPath*/);
148
OscControlFifo* oscFifo(unsigned long) const;
150
virtual int oscUpdate(lo_arg**);
151
virtual int oscProgram(lo_arg**) { return 0; }
152
virtual int oscControl(lo_arg**) { return 0; }
153
virtual int oscExiting(lo_arg**);
154
virtual int oscMidi(lo_arg**) { return 0; }
155
virtual int oscConfigure(lo_arg**) { return 0; }
157
virtual void oscSendProgram(unsigned long /*prog*/, unsigned long /*bank*/);
158
virtual void oscSendControl(unsigned long /*dssiPort*/, float /*val*/);
159
virtual void oscSendConfigure(const char */*key*/, const char */*val*/);
161
virtual bool oscInitGui() { return false; }
162
virtual void oscShowGui(bool);
163
virtual bool oscGuiVisible() const;
166
class OscEffectIF : public OscIF
169
PluginI* _oscPluginI;
175
void oscSetPluginI(PluginI*);
177
virtual int oscUpdate(lo_arg**);
178
//virtual int oscProgram(lo_arg**);
179
virtual int oscControl(lo_arg**);
180
//virtual int oscExiting(lo_arg**);
181
//virtual int oscMidi(lo_arg**);
182
virtual int oscConfigure(lo_arg**);
184
virtual bool oscInitGui();
188
class OscDssiIF : public OscIF
191
DssiSynthIF* _oscSynthIF;
197
void oscSetSynthIF(DssiSynthIF*);
199
virtual int oscUpdate(lo_arg**);
200
virtual int oscProgram(lo_arg**);
201
virtual int oscControl(lo_arg**);
202
//virtual int oscExiting(lo_arg**);
203
virtual int oscMidi(lo_arg**);
204
virtual int oscConfigure(lo_arg**);
206
virtual bool oscInitGui();
208
#endif // DSSI_SUPPORT
210
extern void initOSC();