PDA

View Full Version : Keeping iPod Music Playing




moopf
Aug 28, 2008, 01:19 PM
I'm not sure what I'm doing wrong here but, here's what I'm trying to do. Basically my app has it's own music and sound effects but, what I'd like to do, is allow those who want to play their own music to still be able to. So basically they can turn off the music in my app and play their own, or play my music and not their own, or play neither. Sound effects have a separate control in the app.

Now, here's the thing. I'm testing my app to make sure that it will allow their own music to play but every time the app launches, the iPod fades out. I've even tested by bypassing all the SoundEngine stuff I'm doing, so none of that's initialized or run, but the same thing happens.

Is there a trick to getting your app to run whilst listening to your own music? Bit perplexed on this one! Any help appreciated.



synapse9579
Aug 28, 2008, 04:56 PM
One way you can do it is start the app first, then double press the Home key to bring the iPod controls. The iPod control will not exit your app. That's usually what I do. Hope that helps.

moopf
Aug 28, 2008, 05:01 PM
One way you can do it is start the app first, then double press the Home key to bring the iPod controls. The iPod control will not exit your app. That's usually what I do. Hope that helps.

Interesting, didn't know you could do that. But I know there's a way for the app to either explicitly allow, or not interfere with and stop at least, the iPod playing if it's started before the app is run. I've got several apps on my iPhone that do that.

moopf
Aug 29, 2008, 02:59 AM
Think I've got to the bottom of it now. I was still loading a sample up into SoundEngine (my mistake) and just doing this causes the iPod to stop playing. So it seems that if you touch anything to do with OpenAL the iPod will stop (even though I hadn't initialized SoundEngine). This means I'll need to add an 'iPod Mode' to the options for the app for those people who want to listen to their iPod whilst using my app and play sound effects through the system sounds method if this mode is ON - shame because there's no volume control on this - and use OpenAL if iPod mode isn't on.

Has anybody else taken this approach?

moopf
Aug 29, 2008, 06:00 AM
This is driving me loopy now :) OK, so I need to play sound effects in a way that doesn't stop the iPod playing its music and also obviously want a volume control on the sound effects as well, so the volume can be changed to suit. But here's the thing, AudioServicesPlaySystemSound etc. has no volume control at all and, if I start to use AudioQueues, the iPod music fades out again. So how on earth is this done? I know it's possible! Dizzy Bee, as an example, lets the iPod music play and plays it's own sound effects and has a volume control for those sound effects as well.

Does anybody have any ideas at all? I'm finding the audio management a right pain. Surely it can't be that difficult, or am I over-thinking this?

priyank.ranka
Dec 16, 2008, 05:47 AM
Hi mooph did u get ur work done of playing ipod sound in the app as i also looking fr the same in my app but didnt yet figure it out..If u got through ahead in this issue please do let me know as i also want it done as soon as possible. any help will appreciated thanx.

moopf
Dec 16, 2008, 06:07 AM
Hi mooph did u get ur work done of playing ipod sound in the app as i also looking fr the same in my app but didnt yet figure it out..If u got through ahead in this issue please do let me know as i also want it done as soon as possible. any help will appreciated thanx.

Yes, take a look in the SDk documentation for audio sessions - this is the magic thing needed :)

priyank.ranka
Dec 16, 2008, 06:23 AM
I have use Audio session for call interrupts in my code but not application delegate...So where have to put this audio session inorder to make ipod music playing inside the delegate or some where else inside uiview custom class

moopf
Dec 16, 2008, 06:27 AM
I have use Audio session for call interrupts in my code but not application delegate...So where have to put this audio session inorder to make ipod music playing inside the delegate or some where else inside uiview custom class

You put it in your application delegate, before you start touching any other audio stuff.

priyank.ranka
Dec 16, 2008, 06:38 AM
UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,sizeof(sessionCategory),&sessionCategory);
AudioSessionSetActive (true);

I am writing these three lines in didFinishLaunching will it serve the purpose or hve to add sme thing more

AS i m confirming it because i crash my speaker while dealing with sound so need the confirmation while doing any thing new with sound

moopf
Dec 16, 2008, 06:48 AM
UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,sizeof(sessionCategory),&sessionCategory);
AudioSessionSetActive (true);

I am writing these three lines in didFinishLaunching will it serve the purpose or hve to add sme thing more

AS i m confirming it because i crash my speaker while dealing with sound so need the confirmation while doing any thing new with sound

I can't confirm as I don't currently have my Mac.

priyank.ranka
Dec 16, 2008, 06:54 AM
i can wait for confirmation. As i want to do it by full proof as i already spoil my speaker ones. I wont mind waiting. Really thanx fr ur help. Will look forward fr ur confirmation.

moopf
Dec 16, 2008, 07:00 AM
i can wait for confirmation. As i want to do it by full proof as i already spoil my speaker ones. I wont mind waiting. Really thanx fr ur help. Will look forward fr ur confirmation.

I'm sorry but it's not going to be for a while I'm afraid as my Mac is out of commission at the moment. I don't understand how you managed to damage your speakers though.

priyank.ranka
Dec 17, 2008, 12:06 AM
I also found one more interesting things in some of the Apps. Some of the apps comes directly into the settings of my iphone and u can set these apps such as sound and other settings directly from settings of ur phone. I am searching on how to implement such functionality but still i m not able to figure it out. Does any one hve idea on this thing plz do share. Many many thanx in advance.