tags:

views:

70

answers:

1

I use AVFoundation framework to play sound. If music is playing when I play a sound, the music stops. Is there a way of avoiding that?

+2  A: 

Yes, you want to configure an audio session to treat your sounds as "ambient" sounds. Here's how I do it in my game:

// Configure the audio system
AudioSessionInitialize(NULL, NULL, NULL, NULL);
UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
AudioSessionSetActive(true);
randallmeadows