1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2008 - 2009 Andreas Persson * |
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, write to the Free Software * |
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * |
18 |
* MA 02110-1301 USA * |
19 |
***************************************************************************/ |
20 |
|
21 |
#ifndef LS_MIDIINPUTDEVICEPLUGIN_H |
22 |
#define LS_MIDIINPUTDEVICEPLUGIN_H |
23 |
|
24 |
#include "MidiInputDevice.h" |
25 |
|
26 |
namespace LinuxSampler { |
27 |
|
28 |
/** Plugin MIDI input driver |
29 |
* |
30 |
* Implements MIDI input when LinuxSampler is running as a plugin. |
31 |
* |
32 |
* The plugin implementation is given access to the MidiInputPort, |
33 |
* to which MIDI events can be dispatched. |
34 |
*/ |
35 |
class MidiInputDevicePlugin : public MidiInputDevice { |
36 |
public: |
37 |
MidiInputDevicePlugin(std::map<String, DeviceCreationParameter*> Parameters, |
38 |
void* pSampler); |
39 |
~MidiInputDevicePlugin(); |
40 |
|
41 |
/** |
42 |
* MIDI Port implementation for the plugin MIDI input driver. |
43 |
*/ |
44 |
class MidiInputPortPlugin : public MidiInputPort { |
45 |
protected: |
46 |
MidiInputPortPlugin(MidiInputDevicePlugin* pDevice, int portNumber); |
47 |
friend class MidiInputDevicePlugin; |
48 |
}; |
49 |
|
50 |
/** |
51 |
* Device Parameter 'PORTS' |
52 |
*/ |
53 |
class ParameterPortsPlugin : public ParameterPorts { |
54 |
public: |
55 |
ParameterPortsPlugin() : ParameterPorts() { } |
56 |
ParameterPortsPlugin(String s) : ParameterPorts(s) { } |
57 |
virtual bool Fix() { return true; } |
58 |
}; |
59 |
|
60 |
// derived abstract methods from class 'MidiInputDevice' |
61 |
void Listen(); |
62 |
void StopListen(); |
63 |
String Driver(); |
64 |
bool isAutonomousDevice(); |
65 |
static String Name(); |
66 |
static String Version(); |
67 |
static String Description(); |
68 |
MidiInputPort* CreateMidiPort(); |
69 |
static bool isAutonomousDriver(); |
70 |
|
71 |
/** |
72 |
* Returns the MIDI port to which events can be dispatched. |
73 |
* |
74 |
* @returns MIDI port |
75 |
*/ |
76 |
MidiInputPort* Port() { |
77 |
return Ports[0]; |
78 |
} |
79 |
|
80 |
static void DeleteMidiPort(MidiInputPort* pPort); |
81 |
}; |
82 |
} |
83 |
|
84 |
#endif |