mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
iOS: Made it clear that the "Audio Background Capability" setting must be enabled for MidiInput/Output::createNewDevice() to succeed
This commit is contained in:
parent
132295bdb3
commit
251ec6daa8
3 changed files with 34 additions and 3 deletions
|
|
@ -334,7 +334,8 @@ public:
|
|||
if (iOS)
|
||||
{
|
||||
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"),
|
||||
"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
|
||||
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.
|
||||
|
||||
@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
|
||||
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.
|
||||
|
||||
@param deviceName the name of the device to create
|
||||
|
|
|
|||
|
|
@ -459,7 +459,19 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba
|
|||
MIDIEndpointRef endpoint;
|
||||
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);
|
||||
|
||||
|
|
@ -582,7 +594,19 @@ MidiOutput* MidiOutput::createNewDevice (const String& 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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue