Quote:
Originally Posted by edcousins
Hi guys,
I'm just starting to get into iPhone development myself, and have a quick question that I hope someone can help me out with.
I have the code below that plays a sound when the connected button is pressed:
Code:
- (IBAction)playsound1 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"FILENAME" ofType:@"mp3"];
AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
What I want to do is add some code to this so that if another button is pressed, it stops the above sound, while the other sound starts.
Can anyone help me out with this?
Thanks in advance 
|
Code:
[theAudio stop];
[theAudio release];