drumstick  1.1.0
rtmidioutput.h
Go to the documentation of this file.
1 /*
2  Drumstick MIDI realtime input-output
3  Copyright (C) 2009-2016 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 along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef MIDIOUTPUT_H
21 #define MIDIOUTPUT_H
22 
23 #include <QObject>
24 #include <QString>
25 #include <QStringList>
26 #include <QtPlugin>
27 #include <QSettings>
28 
29 #define MIDI_CHANNELS 16
30 #define MIDI_GM_DRUM_CHANNEL (10-1)
31 #define MIDI_CTL_MSB_MAIN_VOLUME 0x07
32 #define MIDI_CTL_ALL_SOUNDS_OFF 0x78
33 #define MIDI_CTL_ALL_NOTES_OFF 0x7b
34 #define MIDI_CTL_RESET_CONTROLLERS 0x79
35 
36 #define MIDI_STATUS_NOTEOFF 0x80
37 #define MIDI_STATUS_NOTEON 0x90
38 #define MIDI_STATUS_KEYPRESURE 0xa0
39 #define MIDI_STATUS_CONTROLCHANGE 0xb0
40 #define MIDI_STATUS_PROGRAMCHANGE 0xc0
41 #define MIDI_STATUS_CHANNELPRESSURE 0xd0
42 #define MIDI_STATUS_PITCHBEND 0xe0
43 #define MIDI_STATUS_SYSEX 0xf0
44 #define MIDI_STATUS_ENDSYSEX 0xf7
45 #define MIDI_STATUS_REALTIME 0xf8
46 
47 #define MIDI_STATUS_MASK 0xf0
48 #define MIDI_CHANNEL_MASK 0x0f
49 
50 #define MIDI_COMMON_QTRFRAME 0xF1
51 #define MIDI_COMMON_SONGPP 0xF2
52 #define MIDI_COMMON_SONSELECT 0xF3
53 #define MIDI_COMMON_TUNEREQ 0xF6
54 
55 #define MIDI_REALTIME_CLOCK 0xF8
56 #define MIDI_REALTIME_START 0xFA
57 #define MIDI_REALTIME_CONTINUE 0xFB
58 #define MIDI_REALTIME_STOP 0xFC
59 #define MIDI_REALTIME_SENSING 0xFE
60 #define MIDI_REALTIME_RESET 0xFF
61 
62 #define MIDI_LSB(x) (x % 0x80)
63 #define MIDI_MSB(x) (x / 0x80)
64 
72 namespace drumstick {
73 namespace rt {
74 
78  class MIDIOutput : public QObject
79  {
80  Q_OBJECT
81 
82  public:
87  explicit MIDIOutput(QObject *parent = 0) : QObject(parent) {}
91  virtual ~MIDIOutput() {}
96  virtual void initialize(QSettings* settings) = 0;
101  virtual QString backendName() = 0;
106  virtual QString publicName() = 0;
111  virtual void setPublicName(QString name) = 0;
116  virtual QStringList connections(bool advanced = false) = 0;
121  virtual void setExcludedConnections(QStringList conns) = 0;
126  virtual void open(QString name) = 0;
130  virtual void close() = 0;
135  virtual QString currentConnection() = 0;
136 
137  public Q_SLOTS:
144  virtual void sendNoteOff(int chan, int note, int vel) = 0;
145 
152  virtual void sendNoteOn(int chan, int note, int vel) = 0;
153 
160  virtual void sendKeyPressure(int chan, int note, int value) = 0;
161 
168  virtual void sendController(int chan, int control, int value) = 0;
169 
175  virtual void sendProgram(int chan, int program) = 0;
176 
182  virtual void sendChannelPressure(int chan, int value) = 0;
183 
189  virtual void sendPitchBend(int chan, int value) = 0;
190 
195  virtual void sendSysex(const QByteArray& data) = 0;
196 
201  virtual void sendSystemMsg(const int status) = 0;
202  };
203 }}
204 
205 Q_DECLARE_INTERFACE(drumstick::rt::MIDIOutput, "net.sourceforge.drumstick.rt.MIDIOutput/1.0")
206 
207 
209 #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:91
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:87
MIDI OUT interface.
Definition: rtmidioutput.h:78