I've made a simple app, where I have a list of songs. The user taps a list entry and the song begins playing.
I've lifted the SoundEffect class from Apple's sample projects (e.g. Metronome, BubbleLevel). It seems to work fine with the following code:
// declare in the .h file
SoundEffect *audio;
// setup - when controller loads
audio = [SoundEffect alloc];
// play when user taps entry
NSBundle *mainBundle = [NSBundle mainBundle];
[audio initWithContentsOfFile:[mainBundle pathForResource:@"entry1" ofType:@"mp3"]];
[audio play];
However, if the 'audio' object is already playing, I'd like to stop it before it starts playing the sound again. SoundEffect class does not have a stop method or I am simply missing something.
How do i stop the audio before playing it again?