drumstick  2.9.0
C++MIDIlibrariesusingQtobjects,idioms,andstyle.
rtmidiinput.h
Go to the documentation of this file.
1 /*
2  Drumstick MIDI realtime input-output
3  Copyright (C) 2009-2023 Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef MIDIINPUT_H
20 #define MIDIINPUT_H
21 
22 #include <QObject>
23 #include <QString>
24 #include <QStringList>
25 #include <QtPlugin>
26 #include <QSettings>
27 
28 #include "macros.h"
29 #include "rtmidioutput.h"
30 
36 #if defined(DRUMSTICK_STATIC)
37 #define DRUMSTICK_RT_EXPORT
38 #else
39 #if defined(drumstick_rt_EXPORTS)
40 #define DRUMSTICK_RT_EXPORT Q_DECL_EXPORT
41 #else
42 #define DRUMSTICK_RT_EXPORT Q_DECL_IMPORT
43 #endif
44 #endif
45 
46 namespace drumstick { namespace rt {
47 
55 class DRUMSTICK_RT_EXPORT MIDIInput : public QObject
56 {
57  Q_OBJECT
58 
59 public:
64  explicit MIDIInput(QObject *parent = nullptr)
65  : QObject(parent)
66  {}
70  virtual ~MIDIInput() = default;
75  virtual void initialize(QSettings *settings) = 0;
80  virtual QString backendName() = 0;
85  virtual QString publicName() = 0;
90  virtual void setPublicName(QString name) = 0;
96  virtual QList<MIDIConnection> connections(bool advanced = false) = 0;
101  virtual void setExcludedConnections(QStringList conns) = 0;
106  virtual void open(const MIDIConnection &conn) = 0;
110  virtual void close() = 0;
115  virtual MIDIConnection currentConnection() = 0;
120  virtual void setMIDIThruDevice(MIDIOutput *device) = 0;
125  virtual void enableMIDIThru(bool enable) = 0;
130  virtual bool isEnabledMIDIThru() = 0;
131 
132 Q_SIGNALS:
139  void midiNoteOff(const int chan, const int note, const int vel);
140 
147  void midiNoteOn(const int chan, const int note, const int vel);
148 
155  void midiKeyPressure(const int chan, const int note, const int value);
156 
163  void midiController(const int chan, const int control, const int value);
164 
170  void midiProgram(const int chan, const int program);
171 
177  void midiChannelPressure(const int chan, const int value);
178 
184  void midiPitchBend(const int chan, const int value);
185 
190  void midiSysex(const QByteArray &data);
191 
196  void midiSystemCommon(const int status);
197 
202  void midiSystemRealtime(const int status);
203 };
204 
207 }} // namespace drumstick::rt
208 
209 Q_DECLARE_INTERFACE(drumstick::rt::MIDIInput, "net.sourceforge.drumstick.rt.MIDIInput/2.0")
210 
211 #endif // MIDIINPUT_H
MIDIInput(QObject *parent=nullptr)
MIDIInput constructor.
Definition: rtmidiinput.h:64
QPair< QString, QVariant > MIDIConnection
MIDIConnection represents a connection identifier.
Definition: rtmidioutput.h:116
The QSettings class provides persistent platform-independent application settings.
MIDI IN interface.
Definition: rtmidiinput.h:55
The QObject class is the base class of all Qt objects.
Drumstick common.
Definition: alsaclient.cpp:68
Realtime MIDI output interface.
MIDI OUT interface.
Definition: rtmidioutput.h:121