2

Possible Duplicate:
Stop a sound using the same button that plays it

Hi, I create a button in my app that play a sound

If I click on this button while the sound is playing it starts again but don't stop the previous one, how can I stop any sound before playing the next one?

Thanks

Edit:

This is the code I use for playing the sound

-(IBAction)avviaSuono:(id)sender{
    CFBundleRef mainBundle= CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle,(CFStringRef) @"fileName", CFSTR ("mp3"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}

that play the file fileName.mp3

Community
  • 1
  • 1
pugia
  • 442
  • 1
  • 4
  • 11
  • Another person asked this question after you and has solved it; you can refer to that answer: http://stackoverflow.com/questions/5765595/stop-a-sound-using-the-same-button-that-plays-it – jscs Apr 23 '11 at 18:19

0 Answers0