1 |
persson |
1777 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
persson |
1858 |
* Copyright (C) 2008 - 2009 Andreas Persson * |
4 |
persson |
1777 |
* * |
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 |
persson |
1858 |
MidiInputPortPlugin(MidiInputDevicePlugin* pDevice, int portNumber); |
47 |
persson |
1777 |
friend class MidiInputDevicePlugin; |
48 |
|
|
}; |
49 |
|
|
|
50 |
iliev |
1907 |
/** |
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 |
persson |
2354 |
void ForceSetValue(int ports); |
59 |
iliev |
1907 |
}; |
60 |
|
|
|
61 |
persson |
1777 |
// derived abstract methods from class 'MidiInputDevice' |
62 |
|
|
void Listen(); |
63 |
|
|
void StopListen(); |
64 |
|
|
String Driver(); |
65 |
schoenebeck |
1934 |
bool isAutonomousDevice(); |
66 |
persson |
1777 |
static String Name(); |
67 |
|
|
static String Version(); |
68 |
|
|
static String Description(); |
69 |
|
|
MidiInputPort* CreateMidiPort(); |
70 |
schoenebeck |
1934 |
static bool isAutonomousDriver(); |
71 |
persson |
1777 |
|
72 |
|
|
/** |
73 |
|
|
* Returns the MIDI port to which events can be dispatched. |
74 |
|
|
* |
75 |
|
|
* @returns MIDI port |
76 |
|
|
*/ |
77 |
|
|
MidiInputPort* Port() { |
78 |
|
|
return Ports[0]; |
79 |
|
|
} |
80 |
persson |
1858 |
|
81 |
persson |
2354 |
void AddMidiPort(); |
82 |
|
|
void RemoveMidiPort(MidiInputPort* pPort); |
83 |
persson |
1777 |
}; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
#endif |