1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2008 - 2012 Andreas Persson * |
4 |
* Copyright (C) 2013 - 2016 Christian Schoenebeck * |
5 |
* * |
6 |
* This program is free software; you can redistribute it and/or modify * |
7 |
* it under the terms of the GNU General Public License as published by * |
8 |
* the Free Software Foundation; either version 2 of the License, or * |
9 |
* (at your option) any later version. * |
10 |
* * |
11 |
* This program is distributed in the hope that it will be useful, * |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 |
* GNU General Public License for more details. * |
15 |
* * |
16 |
* You should have received a copy of the GNU General Public License * |
17 |
* along with this program; if not, write to the Free Software * |
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * |
19 |
* MA 02110-1301 USA * |
20 |
***************************************************************************/ |
21 |
|
22 |
#ifndef LS_MIDIINPUTDEVICEPLUGIN_H |
23 |
#define LS_MIDIINPUTDEVICEPLUGIN_H |
24 |
|
25 |
#include "MidiInputDevice.h" |
26 |
|
27 |
namespace LinuxSampler { |
28 |
|
29 |
/** Plugin MIDI input driver |
30 |
* |
31 |
* Implements MIDI input when LinuxSampler is running as a plugin. |
32 |
* |
33 |
* The plugin implementation is given access to the MidiInputPort, |
34 |
* to which MIDI events can be dispatched. |
35 |
*/ |
36 |
class MidiInputDevicePlugin : public MidiInputDevice { |
37 |
public: |
38 |
MidiInputDevicePlugin(std::map<String, DeviceCreationParameter*> Parameters, |
39 |
void* pSampler); |
40 |
~MidiInputDevicePlugin(); |
41 |
|
42 |
/** |
43 |
* MIDI Port implementation for the plugin MIDI input driver. |
44 |
*/ |
45 |
class MidiInputPortPlugin : public MidiInputPort { |
46 |
protected: |
47 |
MidiInputPortPlugin(MidiInputDevicePlugin* pDevice, int portNumber); |
48 |
friend class MidiInputDevicePlugin; |
49 |
}; |
50 |
|
51 |
/** |
52 |
* Device Parameter 'PORTS' |
53 |
*/ |
54 |
class ParameterPortsPlugin : public ParameterPorts { |
55 |
public: |
56 |
ParameterPortsPlugin() : ParameterPorts() { } |
57 |
ParameterPortsPlugin(String s) : ParameterPorts(s) { } |
58 |
virtual bool Fix() OVERRIDE { return true; } |
59 |
void ForceSetValue(int ports); |
60 |
}; |
61 |
|
62 |
// derived abstract methods from class 'MidiInputDevice' |
63 |
void Listen() OVERRIDE; |
64 |
void StopListen() OVERRIDE; |
65 |
String Driver() OVERRIDE; |
66 |
bool isAutonomousDevice() OVERRIDE; |
67 |
static String Name(); |
68 |
static String Version(); |
69 |
static String Description(); |
70 |
MidiInputPort* CreateMidiPort() OVERRIDE; |
71 |
static bool isAutonomousDriver(); |
72 |
|
73 |
/** |
74 |
* Returns the MIDI port to which events can be dispatched. |
75 |
* |
76 |
* @returns MIDI port |
77 |
*/ |
78 |
MidiInputPort* Port() { |
79 |
return Ports[0]; |
80 |
} |
81 |
|
82 |
void AddMidiPort(); |
83 |
void RemoveMidiPort(MidiInputPort* pPort); |
84 |
}; |
85 |
} |
86 |
|
87 |
#endif |