In the game I'm building there are sound effects and music. Players are able to turn off the in-game music and sound effects. I assume that when a player turns off the in-game music it's probably because they want to listen to their own music. However, when I run a Sound.play() in order to play a sound effect the background music being played from the music app is stopped. Is there a way around this?
Thanks in advance.
Related
I'm developing a game app which is having background music. but I don't want to play background music of game if system sound is already playing.Please help me.
All the user has to do is flip the switch on the side of the device (silent mode). Music will keep playing but app sounds will will be disabled.
I am using CDAudioManager and Cocos2d for my iOs game. I need the iOs player music and game music to play at the same time along with the sound effects. Neither of the modes suits me, since they either shut off the background music or game music.
Here is what I am looking to get:
ipod player music playing, launch game. ipod, game music and effects all play together.
upon resume all the channels should work as they did prior to resume.
ipod player music NOT playing, launch game. game music and effects play. as well as after resume.
kAMM_FxOnly, //!Other apps will be able to play audio
---ipod music plays, game effects play. game music doesn't play.
kAMM_FxPlusMusic, //!Only this app will play audio
---ipod music doesnt play
kAMM_FxPlusMusicIfNoOtherAudio
---ipod music plays, game music doesnt play.
In all of the modes I have tries the ipod music doesn't resume after minimizing.
I'm 99% sure that this is not possible. If the iPod player is playing music, and you play game music it'll stop the iPod player. And vice versa.
I have personally never seen (heard) an app that did this, and the general concern of game developers is more along the lines of not interrupting iPod music if it is playing - meaning how to detect if iPod music is playing in order to prevent the game music from playing and interrupting the iPod music (therefore annoying the user).
As you can suggest, I have a trouble =)
In the game I use CocosDenshion for playing both background music and sound effects. As far as I know and can see in the code, it uses AVAudioPlayer to play background music. The trouble is appeared when I try to launch my app with music from iPod library.
I set audio category to AmbientSound (tried setting both with AVAudioSession and C interface). If I then try to play game background track directly using AVAudioPlayer, it plays with iPod music in background without problems. But if try to play background music with SimpleAudioEngine, only iPod music is playing.
Can someone give an advice how to make CocosDenshion work in this case?
I have a video with sounds, and I want to play other sounds on the background. So I want to stop the video music to keep playing just the other music. I have to code for all except to stop the music for the video. Is it possible to build?
How to not to mute music player? The xna game (mango 7.1) mutes the music from music player how to prevent it?
The music player isn't being muted, it is being stopped. This is by design. When the application begins to run again you would need to restart your music. Keep in mind that when your application got pushed to the background the user could have decided to start playing a song through the media player. So when your application gets brought back to the front it may not have control of the media player.