drumstick  1.1.3
rtmidioutput.h
Go to the documentation of this file.
1 /*
2  Drumstick MIDI realtime input-output
3  Copyright (C) 2009-2019 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 2 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 MIDIOUTPUT_H
20 #define MIDIOUTPUT_H
21 
22 #include <QObject>
23 #include <QString>
24 #include <QStringList>
25 #include <QtPlugin>
26 #include <QSettings>
27 
28 #define MIDI_CHANNELS 16
29 #define MIDI_GM_DRUM_CHANNEL (10-1)
30 #define MIDI_CTL_MSB_BANK_SELECT 0x00
31 #define MIDI_CTL_MSB_MAIN_VOLUME 0x07
32 #define MIDI_CTL_LSB_BANK_SELECT 0x20
33 #define MIDI_CTL_REVERB_SEND 0x5b
34 #define MIDI_CTL_ALL_SOUNDS_OFF 0x78
35 #define MIDI_CTL_ALL_NOTES_OFF 0x7b
36 #define MIDI_CTL_RESET_CONTROLLERS 0x79
37 
38 #define MIDI_STATUS_NOTEOFF 0x80
39 #define MIDI_STATUS_NOTEON 0x90
40 #define MIDI_STATUS_KEYPRESURE 0xa0
41 #define MIDI_STATUS_CONTROLCHANGE 0xb0
42 #define MIDI_STATUS_PROGRAMCHANGE 0xc0
43 #define MIDI_STATUS_CHANNELPRESSURE 0xd0
44 #define MIDI_STATUS_PITCHBEND 0xe0
45 #define MIDI_STATUS_SYSEX 0xf0
46 #define MIDI_STATUS_ENDSYSEX 0xf7
47 #define MIDI_STATUS_REALTIME 0xf8
48 
49 #define MIDI_STATUS_MASK 0xf0
50 #define MIDI_CHANNEL_MASK 0x0f
51 
52 #define MIDI_COMMON_QTRFRAME 0xF1
53 #define MIDI_COMMON_SONGPP 0xF2
54 #define MIDI_COMMON_SONSELECT 0xF3
55 #define MIDI_COMMON_TUNEREQ 0xF6
56 
57 #define MIDI_REALTIME_CLOCK 0xF8
58 #define MIDI_REALTIME_START 0xFA
59 #define MIDI_REALTIME_CONTINUE 0xFB
60 #define MIDI_REALTIME_STOP 0xFC
61 #define MIDI_REALTIME_SENSING 0xFE
62 #define MIDI_REALTIME_RESET 0xFF
63 
64 #define MIDI_LSB(x) (x % 0x80)
65 #define MIDI_MSB(x) (x / 0x80)
66 
74 namespace drumstick {
75 namespace rt {
76 
80  class MIDIOutput : public QObject
81  {
82  Q_OBJECT
83 
84  public:
89  explicit MIDIOutput(QObject *parent = 0) : QObject(parent) {}
93  virtual ~MIDIOutput() {}
98  virtual void initialize(QSettings* settings) = 0;
103  virtual QString backendName() = 0;
108  virtual QString publicName() = 0;
113  virtual void setPublicName(QString name) = 0;
118  virtual QStringList connections(bool advanced = false) = 0;
123  virtual void setExcludedConnections(QStringList conns) = 0;
128  virtual void open(QString name) = 0;
132  virtual void close() = 0;
137  virtual QString currentConnection() = 0;
138 
139  public Q_SLOTS:
146  virtual void sendNoteOff(int chan, int note, int vel) = 0;
147 
154  virtual void sendNoteOn(int chan, int note, int vel) = 0;
155 
162  virtual void sendKeyPressure(int chan, int note, int value) = 0;
163 
170  virtual void sendController(int chan, int control, int value) = 0;
171 
177  virtual void sendProgram(int chan, int program) = 0;
178 
184  virtual void sendChannelPressure(int chan, int value) = 0;
185 
191  virtual void sendPitchBend(int chan, int value) = 0;
192 
197  virtual void sendSysex(const QByteArray& data) = 0;
198 
203  virtual void sendSystemMsg(const int status) = 0;
204  };
205 }}
206 
207 Q_DECLARE_INTERFACE(drumstick::rt::MIDIOutput, "net.sourceforge.drumstick.rt.MIDIOutput/1.0")
208 
209 
211 #endif /* MIDIOUTPUT_H */
virtual void setPublicName(QString name)=0
setPublicName
virtual void sendNoteOff(int chan, int note, int vel)=0
sendNoteOff 0x8
virtual void sendSysex(const QByteArray &data)=0
sendSysex
virtual void sendChannelPressure(int chan, int value)=0
sendChannelPressure 0xD
virtual void open(QString name)=0
open the MIDI port by name
The QObject class is the base class of all Qt objects.
virtual void close()=0
close the MIDI port
virtual void sendSystemMsg(const int status)=0
sendSystemMsg
virtual void sendController(int chan, int control, int value)=0
sendController 0xB
virtual void setExcludedConnections(QStringList conns)=0
setExcludedConnections
virtual QString publicName()=0
publicName
virtual void sendKeyPressure(int chan, int note, int value)=0
sendKeyPressure 0xA
virtual QString backendName()=0
backendName
virtual QString currentConnection()=0
currentConnection
virtual void sendProgram(int chan, int program)=0
sendProgram 0xC
virtual void initialize(QSettings *settings)=0
initialize
virtual void sendPitchBend(int chan, int value)=0
sendPitchBend 0xE
virtual ~MIDIOutput()
~MIDIOutput destructor
Definition: rtmidioutput.h:93
virtual QStringList connections(bool advanced=false)=0
connections
virtual void sendNoteOn(int chan, int note, int vel)=0
sendNoteOn 0x9
MIDIOutput(QObject *parent=0)
MIDIOutput constructor.
Definition: rtmidioutput.h:89
MIDI OUT interface.
Definition: rtmidioutput.h:80