drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
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
46namespace drumstick { namespace rt {
47
55class DRUMSTICK_RT_EXPORT MIDIInput : public QObject
56{
57 Q_OBJECT
58
59public:
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;
120 virtual void setMIDIThruDevice(MIDIOutput *device) = 0;
125 virtual void enableMIDIThru(bool enable) = 0;
130 virtual bool isEnabledMIDIThru() = 0;
131
132Q_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
209Q_DECLARE_INTERFACE(drumstick::rt::MIDIInput, "net.sourceforge.drumstick.rt.MIDIInput/2.0")
210
211#endif // MIDIINPUT_H
The QObject class is the base class of all Qt objects.
The QSettings class provides persistent platform-independent application settings.
MIDI IN interface.
Definition: rtmidiinput.h:56
void midiProgram(const int chan, const int program)
midiProgram 0xC
void midiController(const int chan, const int control, const int value)
midiController 0xB
void midiNoteOn(const int chan, const int note, const int vel)
midiNoteOn 0x9
virtual void setExcludedConnections(QStringList conns)=0
setExcludedConnections
void midiChannelPressure(const int chan, const int value)
midiChannelPressure 0xD
virtual void initialize(QSettings *settings)=0
initialize
virtual QString backendName()=0
backendName
virtual ~MIDIInput()=default
~MIDIInput destructor
virtual MIDIConnection currentConnection()=0
currentConnection
MIDIInput(QObject *parent=nullptr)
MIDIInput constructor.
Definition: rtmidiinput.h:64
virtual void enableMIDIThru(bool enable)=0
enableMIDIThru
void midiPitchBend(const int chan, const int value)
midiPitchBend 0xE
void midiSystemRealtime(const int status)
midiSystemRealtime
virtual QList< MIDIConnection > connections(bool advanced=false)=0
connections
virtual QString publicName()=0
publicName
virtual void open(const MIDIConnection &conn)=0
open the MIDI port by name
void midiKeyPressure(const int chan, const int note, const int value)
midiKeyPressure 0xA
virtual void setMIDIThruDevice(MIDIOutput *device)=0
setMIDIThruDevice
virtual bool isEnabledMIDIThru()=0
isEnabledMIDIThru
void midiNoteOff(const int chan, const int note, const int vel)
midiNoteOff 0x8
void midiSystemCommon(const int status)
midiSystemCommon
virtual void close()=0
close the MIDI port
void midiSysex(const QByteArray &data)
midiSysex
virtual void setPublicName(QString name)=0
setPublicName
MIDI OUT interface.
Definition: rtmidioutput.h:122
QPair< QString, QVariant > MIDIConnection
MIDIConnection represents a connection identifier.
Definition: rtmidioutput.h:116
Drumstick common.
Definition: alsaclient.cpp:68
Realtime MIDI output interface.