views:

42

answers:

1

I'm not sure if I wrote this code well (get clicks on touching buttons rapidly):

#import "iEngineRoomAppDelegate.h"
#import "iEngineRoomViewController.h"
#import "SoundEffect.h"

@implementation iEngineRoomAppDelegate

@synthesize window;
@synthesize viewController;


- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after app launch    
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
    [self setupSounds];

}

- (void)setupSounds {
    NSBundle *mainBundle = [NSBundle mainBundle];
    timbal_big_Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"timbal_big" ofType:@"caf"]];
    timbal_sm_Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"timbal_sm" ofType:@"caf"]];

}

- (IBAction)timbal_big: (id)sender {
    SoundEffect *currentSoundEffect= timbal_big_Sound; 
    [currentSoundEffect play]; 
}
- (IBAction)timbal_sm: (id)sender {
    SoundEffect *currentSoundEffect= timbal_sm_Sound;
    [currentSoundEffect play];
}

- (void)dealloc {
    [timbal_big_Sound release];
    [timbal_sm_Sound release];

    [viewController release];
    [window release];
    [super dealloc];
}

@end
A: 

Memory management of the SoundEffect objects is right, if you meant that.

Nikolai Ruhe
thanks, i asked, because i got those clicks when tapping differnet buttons rapidly after the sound disapears
blacksheep