summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/muse/dssihost.h
blob: 0ec251ac4c47545277428bc287d4f4184105a3b1 (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
//=============================================================================
//  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 __DSSIHOST_H__
#define __DSSIHOST_H__

#include <lo/lo.h>
#include "synth.h"
#include "plugin.h"

struct _DSSI;
class DssiPluginIF;
class LadspaPort;

//---------------------------------------------------------
//   DssiSynth
//---------------------------------------------------------

class DssiSynth : public Synth {
   protected:
      char* label;
      void* handle;
      const DSSI_Descriptor* dssi;
      DSSI_Descriptor_Function df;
      std::vector<int> pIdx;
      std::vector<int> iIdx;
      std::vector<int> oIdx;
      int _inports, _outports, _controller;
      bool _hasGui;

   public:
      DssiSynth(const QFileInfo* fi, QString l) : Synth(fi, l) {
            df = 0;
            handle = 0;
            dssi = 0;
            _hasGui = false;
            }
      virtual ~DssiSynth() {
            delete label;
            }
      virtual void incInstances(int val);
      virtual SynthIF* createSIF(SynthI*);
      friend class DssiSynthIF;
      float defaultValue(int);
      };

//---------------------------------------------------------
//   DssiSynthIF
//    VSTi synthesizer instance
//---------------------------------------------------------

class DssiSynthIF : public SynthIF
      {
      bool _guiVisible;
      DssiSynth* synth;
      LADSPA_Handle handle;
      LadspaPort* controls;
      void* uiTarget;
      char* uiOscShowPath;
      char* uiOscControlPath;
      char* uiOscConfigurePath;
      char* uiOscProgramPath;
      char* uiOscPath;

      std::vector<DSSI_Program_Descriptor> programs;
      void queryPrograms();

   protected:
      int guiPid;

   public:
      DssiSynthIF(SynthI* s);
      virtual ~DssiSynthIF();

      virtual bool guiVisible() const;
      virtual void showGui(bool v);
      virtual bool hasGui() const { return synth->_hasGui; }
      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 { return synth->_outports; }
      virtual void deactivate3() {}
      virtual QString getPatchName(int, int);
      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(DssiSynth* s);

      int oscUpdate(lo_arg**);
      int oscProgram(lo_arg**);
      int oscControl(lo_arg**);
      int oscExiting(lo_arg**);
      int oscMidi(lo_arg**);
      int oscConfigure(lo_arg**);

      friend class DssiSynth;
      };

#endif