Skip to content

Commit

Permalink
Print errors when calling MIDI input methods on unsupported platforms
Browse files Browse the repository at this point in the history
This partially addresses godotengine#32065.

(cherry picked from commit 9c0d214)
  • Loading branch information
Calinou authored and akien-mga committed Jun 4, 2020
1 parent eef442f commit 424d1b5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,19 +728,25 @@ PoolStringArray OS::get_connected_midi_inputs() {
return MIDIDriver::get_singleton()->get_connected_inputs();

PoolStringArray list;
return list;
ERR_FAIL_V_MSG(list, vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name()));
}

void OS::open_midi_inputs() {

if (MIDIDriver::get_singleton())
if (MIDIDriver::get_singleton()) {
MIDIDriver::get_singleton()->open();
} else {
ERR_PRINT(vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name()));
}
}

void OS::close_midi_inputs() {

if (MIDIDriver::get_singleton())
if (MIDIDriver::get_singleton()) {
MIDIDriver::get_singleton()->close();
} else {
ERR_PRINT(vformat("MIDI input isn't supported on %s.", OS::get_singleton()->get_name()));
}
}

OS::OS() {
Expand Down

0 comments on commit 424d1b5

Please sign in to comment.