iPhone OS 4.0 issue with AudioDeviceIOCallback

Hello there

I think this time is unfortunately the good one! I use a GIT version of Juce which I downloaded for one month.

I wanted to to test my iphone audio app with the new iPhone OS 4.0 on my device, but when I want to play some sound, I only listen to silence.

So, I test the juce demo on the device (OS 4.0 updated) and same problem, no sound, just silence.

Here we are… the app works fine in Simulator. I’ve just have this warning line in console after initializing AudioDeviceManager :

Thus, I take a look in debug mode (in device mode), actually, audioIOdevicecallback is never called. And, according to me, in AudioDeviceManager, currentDevice’s params doesn’t look so silly.

Hoping to be helpful this time.

Thanks.

Thanks, I’ll try it out when I’ve got a working OS4 install.

Ok, great. Thanks for all.

Well, audio works just fine on my iphone with version 4.0…

Sorry, I’ve got an iTouch (2nd Generation). I can’t test on an iphone currently.

Well, I don’t have one of those, sorry. You could do some digging yourself, maybe trace through the audio device opening code and see what’s failing.

Damn.

I found THE solution over here : http://redmine.libnui.net/projects/libnui/repository/revisions/5325/diff/trunk/nui3/src/Audio/AudioUnit/nuiAudioDevice_AudioUnit.mm

	// Set the category
        //UInt32 uCategory = kAudioSessionCategory_PlayAndRecord; //Old one;	
	UInt32 uCategory = kAudioSessionCategory_LiveAudio;
	err = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &uCategory);

Actually, IPhoneAudioIODevice::open set AudioSessionCategory to PlayAndRecord, but iPod Touch doesn’t have any mic.

I saw kAudioSessionCategory_LiveAudio is deprecetad so I changed to kAudioSessionCategory_MediaPlayback. And it works! Three days for one line, great!

ok, thanks for tracking that down, though it’d need to be a bit smarter to avoid breaking any software that does want to use an input. Maybe this:

UInt32 audioCategory = audioInputIsAvailable ? kAudioSessionCategory_PlayAndRecord : kAudioSessionCategory_MediaPlayback;

Yes great!