summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarcelo Fernandez <marcelofg55@gmail.com>2018-08-03 21:17:33 -0300
committerMarcelo Fernandez <marcelofg55@gmail.com>2018-08-04 10:07:46 -0300
commit05fc12ddb631c111b96bf03d84100d270f296b21 (patch)
tree71763043111b98f1a70171aa385353f2882f8620 /drivers
parent6c569c90b666c7fb773eca3948fc76ba7a160a27 (diff)
Add OS::open_midi_inputs and OS::close_midi_inputs
Diffstat (limited to 'drivers')
-rw-r--r--drivers/coremidi/core_midi.cpp19
-rw-r--r--drivers/coremidi/core_midi.h2
-rw-r--r--drivers/winmidi/win_midi.cpp6
3 files changed, 27 insertions, 0 deletions
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;
diff --git a/drivers/coremidi/core_midi.h b/drivers/coremidi/core_midi.h
index fd35e12f4b..c6b443764f 100644
--- a/drivers/coremidi/core_midi.h
+++ b/drivers/coremidi/core_midi.h
@@ -53,6 +53,8 @@ public:
virtual Error open();
virtual void close();
+ PoolStringArray get_connected_inputs();
+
MIDIDriverCoreMidi();
virtual ~MIDIDriverCoreMidi();
};
diff --git a/drivers/winmidi/win_midi.cpp b/drivers/winmidi/win_midi.cpp
index 6da6e31b2b..63f7f13685 100644
--- a/drivers/winmidi/win_midi.cpp
+++ b/drivers/winmidi/win_midi.cpp
@@ -53,6 +53,12 @@ Error MIDIDriverWinMidi::open() {
char err[256];
midiInGetErrorText(res, err, 256);
ERR_PRINTS("midiInOpen error: " + String(err));
+
+ MIDIINCAPS caps;
+ res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS));
+ if (res == MMSYSERR_NOERROR) {
+ ERR_PRINTS("Can't open MIDI device \"" + String(caps.szPname) + "\", is it being used by another application?");
+ }
}
}