26 |
|
|
27 |
#include <CoreMIDI/MIDIServices.h> |
#include <CoreMIDI/MIDIServices.h> |
28 |
|
|
29 |
#include "../common/global.h" |
#include "../../common/global.h" |
30 |
#include "MidiInputDevice.h" |
#include "MidiInputDevice.h" |
31 |
|
|
32 |
namespace LinuxSampler { |
namespace LinuxSampler { |
33 |
|
|
34 |
/** Core MIDI input driver |
/** CoreMidi input driver |
35 |
* |
* |
36 |
* Implements MIDI input for MacOSX CoreMidi architecture |
* Implements MIDI input for MacOSX CoreMidi architecture |
37 |
*/ |
*/ |
38 |
class MidiInputDeviceCoreMidi : public MidiInputDevice { |
class MidiInputDeviceCoreMidi : public MidiInputDevice { |
39 |
public: |
|
40 |
MidiInputDeviceCoreMidi(char* AutoConnectPortID = NULL); |
public: |
41 |
~MidiInputDeviceCoreMidi(); |
/** |
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 |
|
|
56 |
|
/** 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 |
// derived abstract methods from class 'MidiInputDevice' |
// derived abstract methods from class 'MidiInputDevice' |
91 |
void Listen(){} |
void Listen(){} |
92 |
void StopListen(){} |
void StopListen(){} |
93 |
void SetInputPort(const char *); |
virtual String Driver(); |
94 |
|
static String Name(); |
95 |
|
static String Description(); |
96 |
|
static String Version(); |
97 |
|
|
98 |
// own methods |
MidiInputPortCoreMidi* CreateMidiPort(); |
|
void ConnectToCoreMidiSource(const char* MidiSource); |
|
99 |
|
|
100 |
// CoreMidi callback |
// CoreMidi callback |
101 |
static void NotifyProc(const MIDINotification *message, void *refCon); |
static void NotifyProc(const MIDINotification* message, void* refCon); |
|
static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon); |
|
102 |
|
|
103 |
private: |
private: |
104 |
MIDIClientRef hCoreMidiClient; |
MIDIClientRef hCoreMidiClient; |
|
MIDIPortRef hCoreMidiInPort; |
|
105 |
}; |
}; |
106 |
} |
} |
107 |
|
|