From 05fc12ddb631c111b96bf03d84100d270f296b21 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Fri, 3 Aug 2018 21:17:33 -0300 Subject: Add OS::open_midi_inputs and OS::close_midi_inputs --- drivers/coremidi/core_midi.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/coremidi/core_midi.cpp') diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp index 3619be4a8e..6d4624e05b 100644 --- a/drivers/coremidi/core_midi.cpp +++ b/drivers/coremidi/core_midi.cpp @@ -92,6 +92,25 @@ void MIDIDriverCoreMidi::close() { } } +PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() { + + PoolStringArray list; + + for (int i = 0; i < connected_sources.size(); i++) { + MIDIEndpointRef source = connected_sources[i]; + CFStringRef ref = NULL; + char name[256]; + + MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref); + CFStringGetCString(ref, name, sizeof(name), kCFStringEncodingUTF8); + CFRelease(ref); + + list.push_back(name); + } + + return list; +} + MIDIDriverCoreMidi::MIDIDriverCoreMidi() { client = 0; -- cgit v1.2.3