iPod interfacing playback issue

I’ve written a ObjC plugin to let me display, select, and play the playlists that are on the player’s ipod while they are in my game. I’m not using the built in modal view that Apple supplies because I think it’s a piece of crap. I’m doing it more low level so that I can make it all match my game.

But I’ve run into an annoying problem that I cannot solve and am hoping for some help.

If I launch my game and go into the internal iPod playlist browser, select some playlists, and hit play, the playlists all play wonderfully. The in-game music fades out pretty nice, too. However, the sound effects stop! And they won’t come back when I stop the iPod music player. (I’ve tried using both the “iPodMusicPlayer” and “applicationMusicPlayer” types of MPMusicPlayerController).

If I start playing music before I launch my game, launch my game, and then go into my internal iPod playlist browser and select some playlists, everything works great. The sound effects still function.

I suspect that maybe there is some conflict with MPMusicPlayerController and OpenAL? I tried enabling/disabling audio using UnitySetAudioSessionActive(bool) at various places as experiments, but that didn’t fix anything.

Any ideas? :slight_smile:

Thanks!

See AudioSessionSetProperty and kAudioSessionProperty_AudioCategory in the SDK docs. Note that there are changes in behaviour between 2.x and 3.x. Unity may be setting one of the modes that doesn’t mix with iPod audio, you may be able to change this from your plugin code.

Mark

Oo, thanks, you’ve given me a place to start. I’ll let you know how it goes.

Any luck yet? I just ran into the exact same problem today and figured I’d check the forums. I’ll take a look at what the previous post recommended too and see what I come up with.

Edit: This helped me out a lot - http://developer.apple.com/IPhone/library/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html#//apple_ref/doc/uid/TP40007875-CH3-SW1

This too: http://developer.apple.com/IPhone/library/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Cookbook/Cookbook.html

Those links aren’t good anymore. Do you remember what was on them? I’m having the same problem (no unity sound) using either remote IO and avAssetReader or using MPMusicPlayer using either the ipod player or the application player.

There is a relevant thread on the matter.
From what I recall, when enabling the MPMusicPlayer etc you must ensure that you pause the audio and don’t unpause it until the external playback actually started to have them work in parallel