Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tsornin

macrumors newbie
Original poster
Jul 23, 2002
26
0
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?
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
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?

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.