--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Fri Feb 18 00:31:01 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sat Feb 19 01:01:03 2011 +0100
@@ -90,20 +90,21 @@
}
void playSound (NSString *snd) {
- //Get the filename of the sound file:
- NSString *path = [NSString stringWithFormat:@"%@/%@.wav",[[NSBundle mainBundle] resourcePath],snd];
-
- //declare a system sound id
- SystemSoundID soundID;
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+ NSNumber *audio = [prefs objectForKey:@"audio"];
+
+ if (audio == nil || [audio boolValue] == YES) {
+ // get the filename of the sound file:
+ NSString *path = [NSString stringWithFormat:@"%@/%@.wav",[[NSBundle mainBundle] resourcePath],snd];
- //Get a URL for the sound file
- NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
+ // declare a system sound id and get a URL for the sound file
+ SystemSoundID soundID;
+ NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
- //Use audio sevices to create the sound
- AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
-
- //Use audio services to play the sound
- AudioServicesPlaySystemSound(soundID);
+ // use audio sevices to create and play the sound
+ AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
+ AudioServicesPlaySystemSound(soundID);
+ }
}
NSArray inline *getAvailableColors (void) {