PDA

View Full Version : AVAudioPlayer Help --- AGAIN




PanzyCat
Jul 19, 2010, 09:30 PM
Hey guyss


NSString *path = [[NSBundle mainBundle] pathForResource:@"badsnarepad" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];

}

When I press the buttons often, after 200-250 times pressing the buttons, the buttons don't sound anymore. I can continue pressing the buttons, but no sound appears. But the application doesn't break down, i can continue using my application fine, but only the sound doesn't sound anymore, so I have to restart the application and after the restart everything works fine again, till I pressed the sound-buttons 200-250 times and the game begins again. I can't figure out the problem.

- (void)dealloc {
[super dealloc];
[theAudio release];}

I am trying to release it, but when i do, it gives me the error: theAudio undeclared.

I put @synthesize theAudio; at the top, put AVAudioPlayer *theAudio, and put @property (nonatomic, retain) AVAudioPlayer *theAudio;


I have no idea what to do anymore.

Please help




If you could help, that would be great.



PanzyCat
Jul 19, 2010, 11:22 PM
EDIT- I got it!