View Full Version : Playing Concurrent Sounds
tsornin
Nov 29, 2008, 02:23 PM
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?
firewood
Nov 29, 2008, 03:37 PM
Audio queues will help if you either use multiple queues, or implement a software mixer.
.
xsmasher
Nov 29, 2008, 04:47 PM
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.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.