drumstick  1.1.2
rtmidioutput.h
Go to the documentation of this file.
1 /*
2  Drumstick MIDI realtime input-output
3  Copyright (C) 2009-2018 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_MAIN_VOLUME 0x07
31 #define MIDI_CTL_ALL_SOUNDS_OFF 0x78
32 #define MIDI_CTL_ALL_NOTES_OFF 0x7b
33 #define MIDI_CTL_RESET_CONTROLLERS 0x79
34 
35 #define MIDI_STATUS_NOTEOFF 0x80
36 #define MIDI_STATUS_NOTEON 0x90
37 #define MIDI_STATUS_KEYPRESURE 0xa0
38 #define MIDI_STATUS_CONTROLCHANGE 0xb0
39 #define MIDI_STATUS_PROGRAMCHANGE 0xc0
40 #define MIDI_STATUS_CHANNELPRESSURE 0xd0
41 #define MIDI_STATUS_PITCHBEND 0xe0
42 #define MIDI_STATUS_SYSEX 0xf0
43 #define MIDI_STATUS_ENDSYSEX 0xf7
44 #define MIDI_STATUS_REALTIME 0xf8
45 
46 #define MIDI_STATUS_MASK 0xf0
47 #define MIDI_CHANNEL_MASK 0x0f
48 
49 #define MIDI_COMMON_QTRFRAME 0xF1
50 #define MIDI_COMMON_SONGPP 0xF2
51 #define MIDI_COMMON_SONSELECT 0xF3
52 #define MIDI_COMMON_TUNEREQ 0xF6
53 
54 #define MIDI_REALTIME_CLOCK 0xF8
55 #define MIDI_REALTIME_START 0xFA
56 #define MIDI_REALTIME_CONTINUE 0xFB
57 #define MIDI_REALTIME_STOP 0xFC
58 #define MIDI_REALTIME_SENSING 0xFE
59 #define MIDI_REALTIME_RESET 0xFF
60 
61 #define MIDI_LSB(x) (x % 0x80)
62 #define MIDI_MSB(x) (x / 0x80)
63 
71 namespace drumstick {
72 namespace rt {
73 
77  class MIDIOutput : public QObject
78  {
79  Q_OBJECT
80 
81  public:
86  explicit MIDIOutput(QObject *parent = 0) : QObject(parent) {}
90  virtual ~MIDIOutput() {}
95  virtual void initialize(QSettings* settings) = 0;
100  virtual QString backendName() = 0;
105  virtual QString publicName() = 0;
110  virtual void setPublicName(QString name) = 0;
115  virtual QStringList connections(bool advanced = false) = 0;
120  virtual void setExcludedConnections(QStringList conns) = 0;
125  virtual void open(QString name) = 0;
129  virtual void close() = 0;
134  virtual QString currentConnection() = 0;
135 
136  public Q_SLOTS:
143  virtual void sendNoteOff(int chan, int note, int vel) = 0;
144 
151  virtual void sendNoteOn(int chan, int note, int vel) = 0;
152 
159  virtual void sendKeyPressure(int chan, int note, int value) = 0;
160 
167  virtual void sendController(int chan, int control, int value) = 0;
168 
174  virtual void sendProgram(int chan, int program) = 0;
175 
181  virtual void sendChannelPressure(int chan, int value) = 0;
182 
188  virtual void sendPitchBend(int chan, int value) = 0;
189 
194  virtual void sendSysex(const QByteArray& data) = 0;
195 
200  virtual void sendSystemMsg(const int status) = 0;
201  };
202 }}
203 
204 Q_DECLARE_INTERFACE(drumstick::rt::MIDIOutput, "net.sourceforge.drumstick.rt.MIDIOutput/1.0")
205 
206 
208 #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:90
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:86
MIDI OUT interface.
Definition: rtmidioutput.h:77