Playing Concurrent Sounds

Discussion in 'iPhone/iPad Programming' started by tsornin, Nov 29, 2008.

  1. macrumors newbie

    Joined:
    Jul 23, 2002
    #1
    I'm using AudioServicesPlaySystemSound to play a short sound (3-4 seconds long) when a user taps a button. However if the user taps the button again before the sound finishes playing, the sound starts over from the beginning... truncating the first sound.

    Is there a way to play the same sound concurrently, so if the user presses the button every second, then they get overlapping sounds? If I switch to an Audio Queue will it fix the problem?
     
  2. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #2
    Audio queues will help if you either use multiple queues, or implement a software mixer.

    .
     
  3. macrumors regular

    xsmasher

    Joined:
    Jul 18, 2008
    #3
    You can play more than one sound at a time with the method your using, but you have to use multiple soundID's - just call AudioServicesCreateSystemSoundID, and then AudioServicesPlaySystemSound on the ID you got back.

    I suspect your code is only creating one soundID, and then calling play on that soundID multiple times. That would behave as you described - it would restart the single sound from the beginning.
     

Share This Page