~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to muse/osc.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-11-17 21:43:38 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101117214338-1hvfl7oo2dsqnvrb
Tags: 1.1-0ubuntu1
* New upstream release (LP: #668631)
* Switch to dpkg-source 3.0 (quilt) format
* Switch to dh7 short form
* debian/rules:
  - added --enable-dssi and --enable-osc to conf flags for dssi support
  - added -ljackserver to LDFLAGS to fix a FTBFS because of --as-needed
* debian/control:
  - added build build dependency on liblo-dev and dssi-dev for dssi support
  - bump Standards-version to 3.9.1. No changes required.
* debian/muse.desktop, debian/muse.xpm: dropped as desktop file and icon is
  now shipped upstream.
* fix-desktop-categories.patch: fix Categories tag in upstream desktop file
* 10_es_locale_fix.dpatch: refreshed and converted to quilt as
  fix_es_locale.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=============================================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//  $Id: osc.h,v 1.0.0.0 2010/04/22 10:05:00 terminator356 Exp $
 
5
//
 
6
//  Copyright (C) 1999-2010 by Werner Schweer and others
 
7
//
 
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.
 
10
//
 
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.
 
15
//
 
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
//=============================================================================
 
20
 
 
21
#ifndef __OSC_H__
 
22
#define __OSC_H__
 
23
 
 
24
#include <lo/lo.h>
 
25
 
 
26
#include "config.h"
 
27
 
 
28
#ifdef DSSI_SUPPORT
 
29
class DssiSynthIF;
 
30
#endif
 
31
 
 
32
class QProcess;
 
33
class PluginI;
 
34
class OscIF;
 
35
 
 
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
 
40
 
 
41
//---------------------------------------------------------
 
42
//  OscControlValue
 
43
//  Item struct for OscGuiControlFifo. 
 
44
//---------------------------------------------------------
 
45
 
 
46
struct OscControlValue
 
47
{
 
48
  //int idx;
 
49
  float value;
 
50
  // maybe timestamp, too ?
 
51
};
 
52
 
 
53
//---------------------------------------------------------
 
54
//  OscControlFifo
 
55
//  A fifo for each of the OSC controls.
 
56
//---------------------------------------------------------
 
57
 
 
58
class OscControlFifo
 
59
{
 
60
      OscControlValue fifo[OSC_FIFO_SIZE];
 
61
      volatile int size;
 
62
      int wIndex;
 
63
      int rIndex;
 
64
 
 
65
   public:
 
66
      OscControlFifo()  { clear(); }
 
67
      bool put(const OscControlValue& event);   // returns true on fifo overflow
 
68
      OscControlValue get();
 
69
      const OscControlValue& peek(int n = 0);
 
70
      void remove();
 
71
      bool isEmpty() const { return size == 0; }
 
72
      void clear()         { size = 0, wIndex = 0, rIndex = 0; }
 
73
      int getSize() const  { return size; }
 
74
};
 
75
 
 
76
//---------------------------------------------------------
 
77
//  OscIF
 
78
//  Open Sound Control Interface
 
79
//---------------------------------------------------------
 
80
 
 
81
/*
 
82
class OscIF
 
83
{
 
84
   private:
 
85
      PluginI* _oscPluginI;
 
86
      
 
87
      #ifdef DSSI_SUPPORT
 
88
      DssiSynthIF* _oscSynthIF;
 
89
      #endif
 
90
      
 
91
      QProcess* _oscGuiQProc;
 
92
      void* _uiOscTarget;
 
93
      char* _uiOscShowPath;
 
94
      char* _uiOscControlPath;
 
95
      char* _uiOscConfigurePath;
 
96
      char* _uiOscProgramPath;
 
97
      char* _uiOscPath;
 
98
      bool _oscGuiVisible;
 
99
   
 
100
      OscControlFifo* _oscControlFifos;
 
101
      
 
102
   public:
 
103
      OscIF();
 
104
      ~OscIF();
 
105
      
 
106
      void oscSetPluginI(PluginI*);
 
107
      
 
108
      #ifdef DSSI_SUPPORT
 
109
      void oscSetSynthIF(DssiSynthIF*);
 
110
      #endif
 
111
      
 
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**); 
 
118
   
 
119
      bool oscInitGui();
 
120
      void oscShowGui(bool);
 
121
      bool oscGuiVisible() const;
 
122
      OscControlFifo* oscFifo(unsigned long) const;
 
123
};
 
124
*/ 
 
125
 
 
126
class OscIF
 
127
{
 
128
   protected:
 
129
      QProcess* _oscGuiQProc;
 
130
      void* _uiOscTarget;
 
131
      char* _uiOscPath;
 
132
      char* _uiOscSampleRatePath;
 
133
      char* _uiOscConfigurePath;
 
134
      char* _uiOscProgramPath;
 
135
      char* _uiOscControlPath;
 
136
      char* _uiOscShowPath;
 
137
      bool _oscGuiVisible;
 
138
   
 
139
      OscControlFifo* _oscControlFifos;
 
140
      
 
141
      virtual bool oscInitGui(const QString& /*typ*/, const QString& /*baseName*/, const QString& /*name*/, 
 
142
                       const QString& /*label*/, const QString& /*filePath*/, const QString& /*dirPath*/);
 
143
                       
 
144
   public:
 
145
      OscIF();
 
146
      virtual ~OscIF();
 
147
      
 
148
      OscControlFifo* oscFifo(unsigned long) const;
 
149
      
 
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; } 
 
156
   
 
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*/); 
 
160
      
 
161
      virtual bool oscInitGui() { return false; }
 
162
      virtual void oscShowGui(bool);
 
163
      virtual bool oscGuiVisible() const;
 
164
};
 
165
 
 
166
class OscEffectIF : public OscIF
 
167
{
 
168
   protected:
 
169
      PluginI* _oscPluginI;
 
170
   
 
171
   public:
 
172
      OscEffectIF() {}
 
173
      //~OscEffectIF();
 
174
 
 
175
      void oscSetPluginI(PluginI*);
 
176
      
 
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**);
 
183
      
 
184
      virtual bool oscInitGui();
 
185
};
 
186
 
 
187
#ifdef DSSI_SUPPORT
 
188
class OscDssiIF : public OscIF
 
189
{
 
190
   protected:
 
191
      DssiSynthIF* _oscSynthIF;
 
192
      
 
193
   public:
 
194
      OscDssiIF() {}
 
195
      //~OscDssiIF();
 
196
      
 
197
      void oscSetSynthIF(DssiSynthIF*);
 
198
      
 
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**);
 
205
      
 
206
      virtual bool oscInitGui();
 
207
};
 
208
#endif // DSSI_SUPPORT
 
209
 
 
210
extern void initOSC();
 
211
 
 
212
#endif