lundi 16 février 2015

Preventing overlapping audio using Objective C

I am only on day 5 of learning to code for iPhones, so please forgive me for my current levels of stupidity.


I have an app that's working well, with short audio tracks being played whenever a button is pressed. So far, so good. However, the audio overlaps if another button is played before the previous sound is finished.


I have looked online to find a solution, but I can't get any of them to work.


Here's my .m file code for each button press:



-(IBAction)PlayAudioButton1:(id)sender;{

NSURL *resourceURL = [[NSBundle mainBundle] URLForResource:@"Coward.mp3" withExtension:nil];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)resourceURL, &playSoundID);
AudioServicesPlaySystemSound(playSoundID);


}


Aucun commentaire:

Enregistrer un commentaire