| @@ -334,7 +334,8 @@ public: | |||||
| if (iOS) | if (iOS) | ||||
| { | { | ||||
| props.add (new ChoicePropertyComponent (iosBackgroundAudioValue, "Audio Background Capability"), | props.add (new ChoicePropertyComponent (iosBackgroundAudioValue, "Audio Background Capability"), | ||||
| "Enable this to grant your app the capability to access audio when in background mode."); | |||||
| "Enable this to grant your app the capability to access audio when in background mode. " | |||||
| "This permission is required if your app creates a MIDI input or output device."); | |||||
| props.add (new ChoicePropertyComponent (iosBackgroundBleValue, "Bluetooth MIDI Background Capability"), | props.add (new ChoicePropertyComponent (iosBackgroundBleValue, "Bluetooth MIDI Background Capability"), | ||||
| "Enable this to grant your app the capability to connect to Bluetooth LE devices when in background mode."); | "Enable this to grant your app the capability to connect to Bluetooth LE devices when in background mode."); | ||||
| @@ -112,6 +112,9 @@ public: | |||||
| This will attempt to create a new midi input device with the specified name for other | This will attempt to create a new midi input device with the specified name for other | ||||
| apps to connect to. | apps to connect to. | ||||
| NB - if you are calling this method on iOS you must have enabled the "Audio Background Capability" | |||||
| setting in the iOS exporter otherwise this method will fail. | |||||
| Returns nullptr if a device can't be created. | Returns nullptr if a device can't be created. | ||||
| @param deviceName the name of the device to create | @param deviceName the name of the device to create | ||||
| @@ -265,6 +268,9 @@ public: | |||||
| This will attempt to create a new midi output device with the specified name that other | This will attempt to create a new midi output device with the specified name that other | ||||
| apps can connect to and use as their midi input. | apps can connect to and use as their midi input. | ||||
| NB - if you are calling this method on iOS you must have enabled the "Audio Background Capability" | |||||
| setting in the iOS exporter otherwise this method will fail. | |||||
| Returns nullptr if a device can't be created. | Returns nullptr if a device can't be created. | ||||
| @param deviceName the name of the device to create | @param deviceName the name of the device to create | ||||
| @@ -459,7 +459,19 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba | |||||
| MIDIEndpointRef endpoint; | MIDIEndpointRef endpoint; | ||||
| ScopedCFString name (deviceName); | ScopedCFString name (deviceName); | ||||
| if (CHECK_ERROR (MIDIDestinationCreate (client, name.cfString, midiInputProc, mpc.get(), &endpoint))) | |||||
| auto err = MIDIDestinationCreate (client, name.cfString, midiInputProc, mpc.get(), &endpoint); | |||||
| #if JUCE_IOS | |||||
| if (err == kMIDINotPermitted) | |||||
| { | |||||
| // If you've hit this assertion then you probably haven't enabled the "Audio Background Capability" | |||||
| // setting in the iOS exporter for your app - this is required if you want to create a MIDI device! | |||||
| jassertfalse; | |||||
| return nullptr; | |||||
| } | |||||
| #endif | |||||
| if (CHECK_ERROR (err)) | |||||
| { | { | ||||
| auto deviceIdentifier = createUniqueIDForMidiPort (deviceName, true); | auto deviceIdentifier = createUniqueIDForMidiPort (deviceName, true); | ||||
| @@ -582,7 +594,19 @@ MidiOutput* MidiOutput::createNewDevice (const String& deviceName) | |||||
| ScopedCFString name (deviceName); | ScopedCFString name (deviceName); | ||||
| if (CHECK_ERROR (MIDISourceCreate (client, name.cfString, &endpoint))) | |||||
| auto err = MIDISourceCreate (client, name.cfString, &endpoint); | |||||
| #if JUCE_IOS | |||||
| if (err == kMIDINotPermitted) | |||||
| { | |||||
| // If you've hit this assertion then you probably haven't enabled the "Audio Background Capability" | |||||
| // setting in the iOS exporter for your app - this is required if you want to create a MIDI device! | |||||
| jassertfalse; | |||||
| return nullptr; | |||||
| } | |||||
| #endif | |||||
| if (CHECK_ERROR (err)) | |||||
| { | { | ||||
| auto deviceIdentifier = createUniqueIDForMidiPort (deviceName, true); | auto deviceIdentifier = createUniqueIDForMidiPort (deviceName, true); | ||||