Reputation: 7900
I play now small sound with :
SystemSoundID reload = [GameFlow createSoundID:@"Reload.wav"];
AudioServicesPlaySystemSound(loop);
Now i want to play this sound for 3 seconds for example in loop, there is any build in stuff for this?
Upvotes: 0
Views: 847
Reputation: 4270
I don't think there's anything built in. You could play the sound on an infinite loop (i.e. set it to 99 repetitions or some appropriate number), then set an NSTimer
to fire after 3 seconds and stop the sound.
Upvotes: 1
Reputation: 16714
You can use AVAudioPlayer. Here is an example. To set a specific number of loops, use:
player.numberOfLoops = 3;
Upvotes: 0