1 |
schoenebeck |
201 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* LinuxSampler - modular, streaming capable sampler * |
4 |
|
|
* * |
5 |
|
|
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
|
* Copyright (C) 2004 Grame * |
7 |
|
|
* * |
8 |
|
|
* This program is free software; you can redistribute it and/or modify * |
9 |
|
|
* it under the terms of the GNU General Public License as published by * |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
11 |
|
|
* (at your option) any later version. * |
12 |
|
|
* * |
13 |
|
|
* This program is distributed in the hope that it will be useful, * |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
|
|
* GNU General Public License for more details. * |
17 |
|
|
* * |
18 |
|
|
* You should have received a copy of the GNU General Public License * |
19 |
|
|
* along with this program; if not, write to the Free Software * |
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
|
|
* MA 02111-1307 USA * |
22 |
|
|
***************************************************************************/ |
23 |
|
|
|
24 |
|
|
#ifndef __LS_MIDIINPUTDEVICECOREMIDI_H__ |
25 |
|
|
#define __LS_MIDIINPUTDEVICECOREMIDI_H__ |
26 |
|
|
|
27 |
|
|
#include <CoreMIDI/MIDIServices.h> |
28 |
|
|
|
29 |
letz |
362 |
#include "../../common/global.h" |
30 |
schoenebeck |
201 |
#include "MidiInputDevice.h" |
31 |
|
|
|
32 |
|
|
namespace LinuxSampler { |
33 |
|
|
|
34 |
letz |
362 |
/** CoreMidi input driver |
35 |
schoenebeck |
201 |
* |
36 |
|
|
* Implements MIDI input for MacOSX CoreMidi architecture |
37 |
|
|
*/ |
38 |
|
|
class MidiInputDeviceCoreMidi : public MidiInputDevice { |
39 |
letz |
362 |
|
40 |
|
|
public: |
41 |
|
|
/** |
42 |
|
|
* MIDI Port implementation for the CoreMidi input driver. |
43 |
|
|
*/ |
44 |
|
|
class MidiInputPortCoreMidi : public MidiInputPort { |
45 |
|
|
public: |
46 |
|
|
/** MIDI Port Parameter 'NAME' |
47 |
|
|
* |
48 |
|
|
* Used to assign an arbitrary name to the MIDI port. |
49 |
|
|
*/ |
50 |
|
|
class ParameterName : public MidiInputPort::ParameterName { |
51 |
|
|
public: |
52 |
|
|
ParameterName(MidiInputPort* pPort) throw (LinuxSamplerException); |
53 |
|
|
virtual void OnSetValue(String s) throw (LinuxSamplerException); |
54 |
|
|
}; |
55 |
schoenebeck |
201 |
|
56 |
letz |
362 |
/** MIDI Port Parameter 'CORE_MIDI_BINDINGS' |
57 |
|
|
* |
58 |
|
|
* Used to connect to other Alsa sequencer clients. |
59 |
|
|
*/ |
60 |
|
|
|
61 |
|
|
class ParameterCoreMidiBindings : public DeviceRuntimeParameterStrings { |
62 |
|
|
public: |
63 |
|
|
ParameterCoreMidiBindings(MidiInputPortCoreMidi* pPort); |
64 |
|
|
virtual String Description(); |
65 |
|
|
virtual bool Fix(); |
66 |
|
|
virtual std::vector<String> PossibilitiesAsString(); |
67 |
|
|
virtual void OnSetValue(std::vector<String> vS) throw (LinuxSamplerException); |
68 |
|
|
protected: |
69 |
|
|
MidiInputPortCoreMidi* pPort; |
70 |
|
|
}; |
71 |
|
|
|
72 |
|
|
static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon); |
73 |
|
|
static int pPortID; |
74 |
|
|
|
75 |
|
|
protected: |
76 |
|
|
MidiInputPortCoreMidi(MidiInputDeviceCoreMidi* pDevice) throw (MidiInputException); |
77 |
|
|
~MidiInputPortCoreMidi(); |
78 |
|
|
friend class MidiInputDeviceCoreMidi; |
79 |
|
|
private: |
80 |
|
|
MidiInputPortCoreMidi* pDevice; |
81 |
|
|
MIDIEndpointRef pDestination; |
82 |
|
|
|
83 |
|
|
friend class ParameterName; |
84 |
|
|
friend class ParameterCoreMidiBindings; |
85 |
|
|
}; |
86 |
|
|
|
87 |
|
|
MidiInputDeviceCoreMidi(std::map<String,DeviceCreationParameter*> Parameters); |
88 |
|
|
virtual ~MidiInputDeviceCoreMidi(); |
89 |
|
|
|
90 |
schoenebeck |
201 |
// derived abstract methods from class 'MidiInputDevice' |
91 |
|
|
void Listen(){} |
92 |
|
|
void StopListen(){} |
93 |
letz |
362 |
virtual String Driver(); |
94 |
|
|
static String Name(); |
95 |
|
|
static String Description(); |
96 |
|
|
static String Version(); |
97 |
schoenebeck |
201 |
|
98 |
letz |
362 |
MidiInputPortCoreMidi* CreateMidiPort(); |
99 |
schoenebeck |
201 |
|
100 |
|
|
// CoreMidi callback |
101 |
letz |
362 |
static void NotifyProc(const MIDINotification* message, void* refCon); |
102 |
schoenebeck |
201 |
|
103 |
|
|
private: |
104 |
|
|
MIDIClientRef hCoreMidiClient; |
105 |
|
|
}; |
106 |
|
|
} |
107 |
|
|
|
108 |
|
|
#endif // __LS_MIDIINPUTDEVICECOREMIDI_H__ |