mardi 17 février 2015

Not allowing audio file to be played if its already playing

I have this code in my project -


-(IBAction)Bpm70:(id)sender{



CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"70bpm", CFSTR("mp3"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);

Timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(TimerCount) userInfo:nil repeats:YES];


}




  • the code starts a metronome audio file when the button is pressed, it also starts an NSTimer object.




  • Once the button is pressed I dont want the button to be able to be pressed again or audio file to play again) until the metronome audio file has finished playing.




Any help would be greatly appreciated, still relatively new to programming Thanks


Aucun commentaire:

Enregistrer un commentaire