Problems initializing AudioAppComponent in iOS with USB audio interface

audio
#1

Hello,

I’m trying to create an audio app in iOS, but am having trouble when using USB audio interfaces with my iPhone/iPad connected via the camera kit.

For example, the AudioDeviceManagerTutorial and a blank Audio Application work just fine on MacOS and work fine on iOS when using the internal iOS Audio device, but when trying to open the apps with a USB audio device connected, the app crashes. This happens with a MOTU Ultralite AVB interface and a MOTU MicroBook IIc; I don’t have other interfaces to test at the moment.

On the Ultralite interface, when the JUCE app opens, the interface display shows that it’s cycling through a variety of sample rates, and then the app crashes. The same thing happens with the MicroBook interface - it has no sample rate display, but the LEDs blink on and off consistent with when the device’s sample rate changes.

Any ideas what to do to in this situation, so my iOS JUCE app can get past the splash screen? Thanks.

0 Likes

#2

Further to the above, I should also mention that the MidiDemo works fine with the USB interface attached, and can send and receive Midi from the interface, so the interface can connect. I do note, though, that the MidiDemo does not use the AudioAppComponent.

0 Likes

#3

It sounds like you’ve set a sample rate that you want the interface to follow. The correct method would be to initialize with no sample rate, and then in prepareToPlay(), ask what the host’s sample rate is.

0 Likes

#4

My reply was, I realize, nearly useless. I’m obviously talking about a plugin hosted in the supplied app wrapper. Derp. Let me have a look at the demo and get back to you.

0 Likes

#5

Upon further investigation, it seems that the MOTU Ultralite AVB interface doesn’t want to play nice with JUCE on iOS. I can’t instantiate the device, and the AudioDeviceManagerTutorial crashes on launch when the Ultralite is connected. As noted, the interface sets itself in a series of sample rates, then the app crashes.

On iOS I was able to successfully insantiate/connect/use a MOTU MicroBook IIc, Apogee Onev2, and an iRig Duo using JUCE, and the MOTU Ultralite works as expected with JUCE on MacOs, and Midi with the Ultralite works fine in iOS and JUCE, but audio will not.

0 Likes

#6

One more follow-up, the Ultralite interface works fine on iOS with apps like Audiobus and AUM; it’s just JUCE that I can’t get working with it.

0 Likes

#7

What happens if you modify the code in the audio device implementation to not cycle through sample rates?

Annoyingly on iOS the only way to find out what sample rate a device supports is to attempt to set a lot of different values and see what values are returned, and it sounds like this could be causing the problem. If you instead open the device with a specified sample rate (avoiding any calls to getAvailableSampleRates()) then this might be a better approach.

1 Like

#8

Many thanks t0m, I’ll give that a try.

0 Likes

#9

As a follow-up, I’ve gotten around to trying this. I modified getAvailableSampleRates() in native/juce_ios_Audio.cpp to only populate the availableSampleRates array with 48000 and avoid trying any other sample rates, and I’m not crashing anymore with the MOTU interface.

2 Likes