00001
00002
00003
00004
00005
00006
00007
00008
00009 #import "SoundPlayerForMacTrek.h"
00010
00011
00012 @implementation SoundPlayerForMacTrek
00013
00014 - (void) subscribeToNotifications {
00015
00016 [super subscribeToNotifications];
00017
00018 [notificationCenter addObserver:self selector:@selector(handleTransporter) name:@"SPW_BEAMUP2_TEXT"];
00019 [notificationCenter addObserver:self selector:@selector(handleTransporter) name:@"SPW_BEAM_D_PLANET_TEXT"];
00020 [notificationCenter addObserver:self selector:@selector(handleTransporter) name:@"SPW_BEAM_U_TEXT"];
00021
00022 [notificationCenter addObserver:self selector:@selector(handleDeath) name:@"CC_GO_OUTFIT"];
00023 }
00024
00025 - (void) loadSounds {
00026
00027 SoundEffect *sound;
00028
00029
00030
00031
00032
00033 sound = [[SoundEffect alloc] init];
00034 [sound loadSoundWithName:@"SoundEffects/explosion.au"];
00035 [soundEffects setObject:sound forKey:@"EXPLOSION_SOUND"];
00036 sound = [[SoundEffect alloc] init];
00037 [sound loadSoundWithName:@"SoundEffects/intro.au"];
00038 [soundEffects setObject:sound forKey:@"INTRO_SOUND"];
00039 sound = [[SoundEffect alloc] init];
00040 [sound loadSoundWithName:@"SoundEffects/plasma_hit.au"];
00041 [soundEffects setObject:sound forKey:@"PLASMA_HIT_SOUND"];
00042 sound = [[SoundEffect alloc] init];
00043 [sound loadSoundWithName:@"SoundEffects/self_destruct.au"];
00044 [soundEffects setObject:sound forKey:@"SELF_DESTRUCT_SOUND"];
00045 sound = [[SoundEffect alloc] init];
00046 [sound loadSoundWithName:@"SoundEffects/torp_hit.au"];
00047 [soundEffects setObject:sound forKey:@"TORP_HIT_SOUND"];
00048
00049
00050 sound = [[SoundEffect alloc] init];
00051 [sound loadSoundWithName:@"SoundEffects2/cloak.wav"];
00052 [soundEffects setObject:sound forKey:@"CLOAK_SOUND"];
00053 sound = [[SoundEffect alloc] init];
00054 [sound loadSoundWithName:@"SoundEffects2/enter_ship.wav"];
00055 [soundEffects setObject:sound forKey:@"ENTER_SHIP_SOUND"];
00056 sound = [[SoundEffect alloc] init];
00057 [sound loadSoundWithName:@"SoundEffects2/explosion_other.wav"];
00058 [soundEffects setObject:sound forKey:@"EXPLOSION_OTHER_SOUND"];
00059 sound = [[SoundEffect alloc] init];
00060 [sound loadSoundWithName:@"SoundEffects2/message.wav"];
00061 [soundEffects setObject:sound forKey:@"MESSAGE_SOUND"];
00062 sound = [[SoundEffect alloc] init];
00063 [sound loadSoundWithName:@"SoundEffects2/fire_phaser.wav"];
00064 [soundEffects setObject:sound forKey:@"PHASER_SOUND"];
00065 sound = [[SoundEffect alloc] init];
00066 [sound loadSoundWithName:@"SoundEffects2/fire_phaser_other.wav"];
00067 [soundEffects setObject:sound forKey:@"PHASER_OTHER_SOUND"];
00068 sound = [[SoundEffect alloc] init];
00069 [sound loadSoundWithName:@"SoundEffects2/fire_plasma.wav"];
00070 [soundEffects setObject:sound forKey:@"FIRE_PLASMA_SOUND"];
00071 sound = [[SoundEffect alloc] init];
00072 [sound loadSoundWithName:@"SoundEffects2/fire_plasma.wav"];
00073 [soundEffects setObject:sound forKey:@"FIRE_PLASMA_OTHER_SOUND"];
00074 sound = [[SoundEffect alloc] init];
00075 [sound loadSoundWithName:@"SoundEffects2/fire_torp.wav"];
00076 [soundEffects setObject:sound forKey:@"FIRE_TORP_SOUND"];
00077 sound = [[SoundEffect alloc] init];
00078 [sound loadSoundWithName:@"SoundEffects2/fire_torp_other.wav"];
00079 [soundEffects setObject:sound forKey:@"FIRE_TORP_OTHER_SOUND"];
00080 sound = [[SoundEffect alloc] init];
00081 [sound loadSoundWithName:@"SoundEffects2/red_alert.wav"];
00082 [soundEffects setObject:sound forKey:@"RED_ALERT_SOUND"];
00083 sound = [[SoundEffect alloc] init];
00084 [sound loadSoundWithName:@"SoundEffects2/shield_down.wav"];
00085 [soundEffects setObject:sound forKey:@"SHIELD_DOWN_SOUND"];
00086 sound = [[SoundEffect alloc] init];
00087 [sound loadSoundWithName:@"SoundEffects2/shield_up.wav"];
00088 [soundEffects setObject:sound forKey:@"SHIELD_UP_SOUND"];
00089 sound = [[SoundEffect alloc] init];
00090 [sound loadSoundWithName:@"SoundEffects2/uncloak.wav"];
00091 [soundEffects setObject:sound forKey:@"UNCLOAK_SOUND"];
00092 sound = [[SoundEffect alloc] init];
00093 [sound loadSoundWithName:@"SoundEffects2/transporter.wav"];
00094 [soundEffects setObject:sound forKey:@"TRANSPORTER_SOUND"];
00095 sound = [[SoundEffect alloc] init];
00096 [sound loadSoundWithName:@"SoundEffects2/good-day-to-die.au"];
00097 [soundEffects setObject:sound forKey:@"I_DIED_SOUND"];
00098
00099 NSLog(@"SoundPlayerForMacTrek.loadSound done");
00100 [notificationCenter postNotificationName:@"SP_SOUNDS_CACHED"];
00101 }
00102
00103 - (void) handleTransporter {
00104 [self playSoundEffect:@"TRANSPORTER_SOUND"];
00105 }
00106
00107 - (void) handleDeath {
00108 [self playSoundEffect:@"I_DIED_SOUND"];
00109 }
00110
00111 @end