1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2004, 2005 Grame * |
* Copyright (C) 2004, 2005 Grame * |
4 |
* Copyright (C) 2007 Christian Schoenebeck * |
* Copyright (C) 2005 - 2012 Christian Schoenebeck * |
5 |
* * |
* * |
6 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
66 |
protected: |
protected: |
67 |
MidiInputPortCoreMidi* pPort; |
MidiInputPortCoreMidi* pPort; |
68 |
}; |
}; |
69 |
|
|
70 |
|
/** MIDI Port Parameter 'AUTO_BIND' |
71 |
|
* |
72 |
|
* If enabled, the port will automatically be connected to all |
73 |
|
* CoreMIDI source endpoints at present and future. |
74 |
|
*/ |
75 |
|
class ParameterAutoBind : public DeviceRuntimeParameterBool { |
76 |
|
public: |
77 |
|
ParameterAutoBind(MidiInputPortCoreMidi* pPort); |
78 |
|
virtual String Description(); |
79 |
|
virtual bool Fix(); |
80 |
|
virtual void OnSetValue(bool b) throw (Exception); |
81 |
|
protected: |
82 |
|
MidiInputPortCoreMidi* pPort; |
83 |
|
}; |
84 |
|
|
85 |
|
void ProcessMidiEvents(const MIDIPacketList *pktlist); |
86 |
|
|
87 |
static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon); |
static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon); |
88 |
static int pPortID; |
static int pPortID; |
90 |
protected: |
protected: |
91 |
MidiInputPortCoreMidi(MidiInputDeviceCoreMidi* pDevice) throw (MidiInputException); |
MidiInputPortCoreMidi(MidiInputDeviceCoreMidi* pDevice) throw (MidiInputException); |
92 |
~MidiInputPortCoreMidi(); |
~MidiInputPortCoreMidi(); |
93 |
|
void connectToSource(MIDIEndpointRef source); |
94 |
|
void connectToAllSources(); |
95 |
|
void onNewSourceAppeared(MIDIEndpointRef source); |
96 |
|
void onNewSourceDisappeared(MIDIEndpointRef source); |
97 |
friend class MidiInputDeviceCoreMidi; |
friend class MidiInputDeviceCoreMidi; |
98 |
private: |
private: |
99 |
MidiInputPortCoreMidi* pDevice; |
MidiInputDeviceCoreMidi* pDevice; |
100 |
MIDIEndpointRef pDestination; |
MIDIEndpointRef pDestination; |
101 |
|
std::vector<MIDIEndpointRef> bindings; //TODO: shall probably be protected by a mutex (since the CoreMIDI notification callback thread might also modify it when new sources appear or disappear) |
102 |
|
|
103 |
friend class ParameterName; |
friend class ParameterName; |
104 |
friend class ParameterCoreMidiBindings; |
friend class ParameterCoreMidiBindings; |
122 |
|
|
123 |
private: |
private: |
124 |
MIDIClientRef hCoreMidiClient; |
MIDIClientRef hCoreMidiClient; |
125 |
|
MIDIPortRef pBridge; |
126 |
}; |
}; |
127 |
} |
} |
128 |
|
|