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

« back to all changes in this revision

Viewing changes to muse/mididev.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:
14
14
 
15
15
#include "mpevent.h"
16
16
//#include "sync.h"
 
17
#include "route.h"
 
18
#include "globaldefs.h"
 
19
 
 
20
//class RouteList;
 
21
class Xml;
17
22
 
18
23
//---------------------------------------------------------
19
24
//   MidiDevice
23
28
      MPEventList _stuckNotes;
24
29
      MPEventList _playEvents;
25
30
      iMPEvent _nextPlayEvent;
26
 
      MREventList _recordEvents;
27
 
      MREventList _recordEvents2;
28
 
      bool _recBufFlipped;
 
31
      ///MREventList _recordEvents;
 
32
      ///MREventList _recordEvents2;
 
33
      
 
34
      // Used for multiple reads of fifos during process.
 
35
      //int _tmpRecordCount;
 
36
      int _tmpRecordCount[MIDI_CHANNELS + 1];
 
37
      bool _sysexFIFOProcessed;
 
38
      
 
39
      ///bool _recBufFlipped;
29
40
      // Holds sync settings and detection monitors.
30
41
      //MidiSyncInfo _syncInfo;
31
42
 
36
47
      int _openFlags;    // configured open flags
37
48
      bool _readEnable;  // set when opened/closed.
38
49
      bool _writeEnable; //
 
50
      //int _sysexWriteChunk;
 
51
      //int _sysexReadChunk;
 
52
      //bool _sysexWritingChunks;
 
53
      bool _sysexReadingChunks;
 
54
      
 
55
      // Recording fifo. 
 
56
      //MidiFifo _recordFifo;
 
57
      // Recording fifos. To speed up processing, one per channel plus one special system 'channel' for channel-less events like sysex.
 
58
      MidiFifo _recordFifo[MIDI_CHANNELS + 1];
 
59
      
 
60
      RouteList _inRoutes, _outRoutes;
 
61
      
39
62
      void init();
40
63
      virtual bool putMidiEvent(const MidiPlayEvent&) = 0;
41
64
 
42
65
   public:
 
66
      enum { ALSA_MIDI=0, JACK_MIDI=1, SYNTH_MIDI=2 };
 
67
      
43
68
      MidiDevice();
44
69
      MidiDevice(const QString& name);
45
70
      virtual ~MidiDevice() {}
46
71
 
 
72
      virtual int deviceType() = 0;
 
73
      
 
74
      virtual void* clientPort() { return 0; }
47
75
      virtual QString open() = 0;
48
76
      virtual void close() = 0;
 
77
      virtual void writeRouting(int, Xml&) const {  };
49
78
 
 
79
      RouteList* inRoutes()   { return &_inRoutes; }
 
80
      RouteList* outRoutes()   { return &_outRoutes; }
 
81
      bool noInRoute() const   { return _inRoutes.empty();  }
 
82
      bool noOutRoute() const  { return _outRoutes.empty(); }
 
83
      
50
84
      const QString& name() const      { return _name; }
51
 
      void setName(const QString& s)   { _name = s; }
52
 
 
 
85
      virtual void setName(const QString& s)   { _name = s; }
 
86
      
53
87
      int midiPort() const             { return _port; }
54
88
      void setPort(int p)              { _port = p; }
55
89
 
67
101
      virtual void processInput()      {}
68
102
      virtual void discardInput()      {}
69
103
 
70
 
      void recordEvent(MidiRecordEvent&);
 
104
      virtual void recordEvent(MidiRecordEvent&);
71
105
 
72
106
      virtual bool putEvent(const MidiPlayEvent&);
 
107
      
 
108
      // For Jack-based devices - called in Jack audio process callback
 
109
      virtual void collectMidiEvents() {}   
 
110
      virtual void processMidi() {}
73
111
 
74
112
      MPEventList* stuckNotes()          { return &_stuckNotes; }
75
113
      MPEventList* playEvents()          { return &_playEvents; }
76
 
      MREventList* recordEvents();
77
 
      void flipRecBuffer()               { _recBufFlipped = _recBufFlipped ? false : true; }
78
 
      bool recBufFlipped()               { return _recBufFlipped; }
 
114
      
 
115
      ///MREventList* recordEvents();
 
116
      ///void flipRecBuffer()               { _recBufFlipped = _recBufFlipped ? false : true; }
 
117
      ///bool recBufFlipped()               { return _recBufFlipped; }
 
118
      void beforeProcess();
 
119
      void afterProcess();
 
120
      //int tmpRecordCount() { return _tmpRecordCount; }
 
121
      int tmpRecordCount(const unsigned int ch)     { return _tmpRecordCount[ch]; }
 
122
      //MidiFifo& recordEvents() { return _recordFifo; }
 
123
      MidiFifo& recordEvents(const unsigned int ch) { return _recordFifo[ch]; }
 
124
      bool sysexFIFOProcessed()                     { return _sysexFIFOProcessed; }
 
125
      void setSysexFIFOProcessed(bool v)            { _sysexFIFOProcessed = v; }
 
126
      //bool sysexWritingChunks() { return _sysexWritingChunks; }
 
127
      //void setSysexWritingChunks(bool v) { _sysexWritingChunks = v; }
 
128
      bool sysexReadingChunks() { return _sysexReadingChunks; }
 
129
      void setSysexReadingChunks(bool v) { _sysexReadingChunks = v; }
 
130
      //virtual void getEvents(unsigned /*from*/, unsigned /*to*/, int /*channel*/, MPEventList* /*dst*/);
 
131
      
79
132
      iMPEvent nextPlayEvent()           { return _nextPlayEvent; }
80
133
      void setNextPlayEvent(iMPEvent i)  { _nextPlayEvent = i; }
81
134
      bool sendNullRPNParams(int, bool);
87
140
 
88
141
typedef std::list<MidiDevice*>::iterator iMidiDevice;
89
142
 
90
 
class MidiDeviceList : public std::list<MidiDevice*> {
 
143
class MidiDeviceList : public std::list<MidiDevice*> 
 
144
{
91
145
   public:
92
146
      void add(MidiDevice* dev);
93
147
      void remove(MidiDevice* dev);
94
 
      MidiDevice* find(const QString& name);
 
148
      MidiDevice* find(const QString& name, int typeHint = -1);
95
149
      iMidiDevice find(const MidiDevice* dev);
96
 
      };
 
150
};
97
151
 
98
152
extern MidiDeviceList midiDevices;
99
153
extern void initMidiDevices();
 
154
extern bool filterEvent(const MEvent& event, int type, bool thru);
100
155
 
101
156
#endif
102
157