File: rtmidiinput.h

package info (click to toggle)
libdrumstick 2.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,876 kB
  • sloc: cpp: 25,685; xml: 122; sh: 14; makefile: 5
file content (211 lines) | stat: -rw-r--r-- 5,328 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
    Drumstick MIDI realtime input-output
    Copyright (C) 2009-2024 Pedro Lopez-Cabanillas <plcl@users.sf.net>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIDIINPUT_H
#define MIDIINPUT_H

#include <QObject>
#include <QString>
#include <QStringList>
#include <QtPlugin>
#include <QSettings>

#include "macros.h"
#include "rtmidioutput.h"

/**
 * @file rtmidiinput.h
 * Realtime MIDI input interface
 */

#if defined(DRUMSTICK_STATIC)
#define DRUMSTICK_RT_EXPORT
#else
#if defined(drumstick_rt_EXPORTS)
#define DRUMSTICK_RT_EXPORT Q_DECL_EXPORT
#else
#define DRUMSTICK_RT_EXPORT Q_DECL_IMPORT
#endif
#endif

namespace drumstick { namespace rt {

/**
     * @addtogroup RT
     * @{
     *
     * @class MIDIInput
     * @brief MIDI IN interface
     */
class DRUMSTICK_RT_EXPORT MIDIInput : public QObject
{
    Q_OBJECT

public:
    /**
         * @brief MIDIInput constructor
         * @param parent
         */
    explicit MIDIInput(QObject *parent = nullptr)
        : QObject(parent)
    {}
    /**
         * @brief ~MIDIInput destructor
         */
    virtual ~MIDIInput() = default;
    /**
         * @brief initialize
         * @param settings
         */
    virtual void initialize(QSettings *settings) = 0;
    /**
         * @brief backendName
         * @return plugin name
         */
    virtual QString backendName() = 0;
    /**
         * @brief publicName
         * @return MIDI port name
         */
    virtual QString publicName() = 0;
    /**
         * @brief setPublicName
         * @param name MIDI port name
         */
    virtual void setPublicName(QString name) = 0;
    /**
         * @brief connections
         * @param advanced whether the advanced connections are included or not
         * @return list of available MIDI ports
         */
    virtual QList<MIDIConnection> connections(bool advanced = false) = 0;
    /**
         * @brief setExcludedConnections
         * @param conns
         */
    virtual void setExcludedConnections(QStringList conns) = 0;
    /**
         * @brief open the MIDI port by name
         * @param conn Connection to open
         */
    virtual void open(const MIDIConnection &conn) = 0;
    /**
         * @brief close the MIDI port
         */
    virtual void close() = 0;
    /**
         * @brief currentConnection
         * @return name of the current connection if it is opened
         */
    virtual MIDIConnection currentConnection() = 0;
    /**
         * @brief setMIDIThruDevice
         * @param device
         */
    virtual void setMIDIThruDevice(MIDIOutput *device) = 0;
    /**
         * @brief enableMIDIThru
         * @param enable
         */
    virtual void enableMIDIThru(bool enable) = 0;
    /**
         * @brief isEnabledMIDIThru
         * @return MIDI Thru is enabled
         */
    virtual bool isEnabledMIDIThru() = 0;

Q_SIGNALS:
    /**
         * @brief midiNoteOff 0x8
         * @param chan
         * @param note
         * @param vel
         */
    void midiNoteOff(const int chan, const int note, const int vel);

    /**
         * @brief midiNoteOn 0x9
         * @param chan
         * @param note
         * @param vel
         */
    void midiNoteOn(const int chan, const int note, const int vel);

    /**
         * @brief midiKeyPressure 0xA
         * @param chan
         * @param note
         * @param value
         */
    void midiKeyPressure(const int chan, const int note, const int value);

    /**
         * @brief midiController 0xB
         * @param chan
         * @param control
         * @param value
         */
    void midiController(const int chan, const int control, const int value);

    /**
         * @brief midiProgram 0xC
         * @param chan
         * @param program
         */
    void midiProgram(const int chan, const int program);

    /**
         * @brief midiChannelPressure 0xD
         * @param chan
         * @param value
         */
    void midiChannelPressure(const int chan, const int value);

    /**
         * @brief midiPitchBend 0xE
         * @param chan
         * @param value
         */
    void midiPitchBend(const int chan, const int value);

    /**
         * @brief midiSysex
         * @param data 0xF0 ... 0xF7
         */
    void midiSysex(const QByteArray &data);

    /**
         * @brief midiSystemCommon
         * @param status 0xF (1..6)
         */
    void midiSystemCommon(const int status);

    /**
         * @brief midiSystemRealtime
         * @param status 0xF (8..F)
         */
    void midiSystemRealtime(const int status);
};

/** @} */

}} // namespace drumstick::rt

Q_DECLARE_INTERFACE(drumstick::rt::MIDIInput, "net.sourceforge.drumstick.rt.MIDIInput/2.0")

#endif // MIDIINPUT_H