MuseScore  3.4
Music composition and notation
pm.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2002-2009 Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __PORTMIDI_H__
21 #define __PORTMIDI_H__
22 
23 #include "config.h"
24 #include "mididriver.h"
25 
26 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
27  #include "portmidi/pm_common/portmidi.h"
28 #else
29  #include <portmidi.h>
30 #endif
31 
32 namespace Ms {
33 
34 class Seq;
35 
36 //---------------------------------------------------------
37 // PortMidiDriver
38 //---------------------------------------------------------
39 
40 class PortMidiDriver : public MidiDriver {
41  int inputId;
42  int outputId;
43  QTimer* timer;
44  PmStream* inputStream;
45  PmStream* outputStream;
46 
47  public:
49  virtual ~PortMidiDriver();
50  virtual bool init();
51  virtual Port registerOutPort(const QString& name);
52  virtual Port registerInPort(const QString& name);
53  virtual void getInputPollFd(struct pollfd**, int* n);
54  virtual void getOutputPollFd(struct pollfd**, int* n);
55  virtual void read();
56  virtual void write(const Event&);
57  QStringList deviceInList() const;
58  QStringList deviceOutList() const;
59  int getDeviceIn(const QString& interfaceAndName);
60  int getDeviceOut(const QString& interfaceAndName);
61  PmStream* getInputStream() { return inputStream; }
62  PmStream* getOutputStream() { return outputStream; }
63  bool canOutput() { return outputStream != 0; }
64  bool isSameCoreMidiIacBus(const QString& inInterfaceAndName, const QString& outInterfaceAndName);
65  };
66 
67 
68 } // namespace Ms
69 #endif
70 
71 
int inputId
Definition: pm.h:41
PmStream * getOutputStream()
Definition: pm.h:62
virtual ~PortMidiDriver()
Definition: pm.cpp:52
PmStream * outputStream
Definition: pm.h:45
virtual void read()
Definition: pm.cpp:163
Definition: pm.h:40
int getDeviceIn(const QString &interfaceAndName)
Definition: pm.cpp:237
Definition: mididriver.h:68
bool canOutput()
Definition: pm.h:63
PmStream * getInputStream()
Definition: pm.h:61
virtual Port registerInPort(const QString &name)
Definition: pm.cpp:136
Definition: seq.h:104
QTimer * timer
Definition: pm.h:43
QStringList deviceInList() const
Definition: pm.cpp:205
PmStream * inputStream
Definition: pm.h:44
Definition: aeolus.cpp:26
Definition: event.h:264
virtual void write(const Event &)
Definition: pm.cpp:197
int getDeviceOut(const QString &interfaceAndName)
Definition: pm.cpp:254
QStringList deviceOutList() const
Definition: pm.cpp:221
int outputId
Definition: pm.h:42
PortMidiDriver(Seq *)
Definition: pm.cpp:42
virtual void getOutputPollFd(struct pollfd **, int *n)
Definition: pm.cpp:154
virtual bool init()
Definition: pm.cpp:65
bool isSameCoreMidiIacBus(const QString &inInterfaceAndName, const QString &outInterfaceAndName)
Definition: pm.cpp:272
Definition: mididriver.h:43
virtual Port registerOutPort(const QString &name)
Definition: pm.cpp:127
virtual void getInputPollFd(struct pollfd **, int *n)
Definition: pm.cpp:145