I put a button on a table view cell that play sound when they are pressed, when I press the button it stop the sound. But pressing another button on another cell it doesn't plays another sound while the other still playing. I hope that when another button is pressed in another table cell it will stop the playing sound.
Here is my code
.h file
I enter this on @interface bracket AVAudioPlayer *talkSound;
.m
NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"kumusta" ofType:@"m4a"];
if (talkSound.playing) {
[talkSound stop];
[talkSound release];
}
talkSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];
talkSound.delegate = self; /*with this here it says theres no delegate so i go an add AVAudioPlayerDelegate and i get tons of errors of connot find protocol declaration*/
[talkSound play];