Here is my code:
As you can see, AVAudioPlayer is allocated some memory, but it's never released. How would I dealloc the memory after it has finished playing? Thanks.
EDIT: Would this work?
if you alloc theAudio, can you just use theAudio release? When I try theAudio dealloc, it crashes. Any help would be greatly appreciated! Thanks!
Code:
- (void) playclick {
NSString *path = [[NSBundle mainBundle] pathForResource:@"MouseClickLoud" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
EDIT: Would this work?
Code:
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)theAudio successfully:(BOOL)flag {
[theAudio release];
}
if you alloc theAudio, can you just use theAudio release? When I try theAudio dealloc, it crashes. Any help would be greatly appreciated! Thanks!