Hi,
I have a class of Targets, which contain their own sounds.
The main game class, only adds the target objects.
When i hit an object, it calls that object method to pause the sound, and start another short sound.
This works fine for a minute, but as objects are getting removed from the main class. The sounds (i assume) are not as i reach the sound buffer limit.
Could not allocate OpenAL buffer (ffffffff)
So what are best practice, is there an extra step I need to perform? In addition to just removing the object from the game?
Snippets
Main Game Class
-(void)monsterClickedOn:(SPTouchEvent*) event { SPTouch *touch = [[event touchesWithTarget:self andPhase:SPTouchPhaseBegan] anyObject]; SPPoint *explodePosition = [touch locationInSpace:self]; if (touch) { SPDisplayObject *currentMonster = (SPDisplayObject*)[touch target]; Monster *mmm = (Monster*)currentMonster.parent; NSLog(@"Current Monster %@", mmm); [playFieldSprite removeChild:mmm]; [self monsterExplosion: explodePosition]; [mmm explodePauseSound]; // pause jet sound and explode sound - wouldnt play b4 as object dont exist at certain point! NSLog(@"X = %f, Y = %f", explodePosition.x, explodePosition.y); [mmm removeEventListener:@selector(monsterClickedOn:) atObject:self forType:SP_EVENT_TYPE_TOUCH]; [self.juggler removeTweensWithTarget:mmm]; // stops rocket flying up [playFieldSprite removeChild:mmm]; } }
The method called in the target class
- (void) explodePauseSound { [jetSoundChannel pause]; [explodeSoundChannel play]; }
Thanks for your help