From bc77b007006112c73d56d95c92ecc7facaf03495 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 4 Aug 2016 12:24:21 +0100 Subject: [PATCH] MIDI network session enabled for iOS simulator --- modules/juce_audio_devices/juce_audio_devices.cpp | 4 ++++ modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/modules/juce_audio_devices/juce_audio_devices.cpp b/modules/juce_audio_devices/juce_audio_devices.cpp index e740a2e54d..86669c040f 100644 --- a/modules/juce_audio_devices/juce_audio_devices.cpp +++ b/modules/juce_audio_devices/juce_audio_devices.cpp @@ -55,6 +55,10 @@ #import #import + #if TARGET_OS_SIMULATOR + #import + #endif + //============================================================================== #elif JUCE_WINDOWS #if JUCE_WASAPI diff --git a/modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp b/modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp index 7e49c6b8f1..310de94f9a 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp @@ -220,6 +220,14 @@ namespace CoreMidiHelpers // correctly when called from the message thread! jassert (MessageManager::getInstance()->isThisTheMessageThread()); + #if TARGET_OS_SIMULATOR + // Enable MIDI for iOS simulator + MIDINetworkSession* session = [MIDINetworkSession defaultSession]; + session.enabled = YES; + session.connectionPolicy = MIDINetworkConnectionPolicy_Anyone; + #endif + + CoreMidiHelpers::ScopedCFString name; name.cfString = getGlobalMidiClientName().toCFString(); CHECK_ERROR (MIDIClientCreate (name.cfString, &globalSystemChangeCallback, nullptr, &globalMidiClient));