Music and SFX with AVAudioPlayer and SystemSounds

Discussion in 'iOS Programming' started by thedollarhunter, Oct 3, 2012.

  1. thedollarhunter macrumors member

    Joined:
    May 9, 2011
    Location:
    UK
    #1
    Well it is time to consult the oracle of shared dev wisdom again...

    I have background music looping via AVAudioPlayer and a handful (10) sound effects playing via SystemSoundIDs which all seems to work just fine.

    Is anyone else using the combination or is there a better way of doing things?

    I am asking as I had one user complain that there was no SFX in my game which I am guessing was down to him having switched off system sounds somehow?

    Any advise is very welcome, bug free code would be great too (I can always add my own bugs later :D)

    Thanks
    MJ
     
  2. nickculbertson macrumors regular

    nickculbertson

    Joined:
    Nov 19, 2010
    Location:
    Nashville, TN
    #2
    Combining the two is not optimal. If the user has both system and media volumes turned on, the SystemSound volume control will be the first to respond in the app. SystemSound volume control will then become disabled as soon as your first AVAudio sound is played. Some iPad users have the alerts on mute and they will never hear your SystemSound. It is a pain but I try to stay away from SystemSound. In the apps I do use SystemSound I've added an itunes screenshot to show the user how their settings should look. In a nutshell, use one or the other. Since it can't be disabled, AVAudio trumps SystemSound.

    Nick
     

Share This Page