--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sat Aug 28 05:35:02 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sun Aug 29 16:55:27 2010 +0200
@@ -11,6 +11,7 @@
#import <sys/sysctl.h>
#import <mach/mach.h>
#import <mach/mach_host.h>
+#import "AudioToolbox/AudioToolbox.h"
void createTeamNamed (NSString *nameWithoutExt) {
NSString *teamsDirectory = TEAMS_DIRECTORY();
@@ -232,3 +233,20 @@
return modelId;
}
+
+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;
+
+ //Get a URL for the sound file
+ 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);
+}
\ No newline at end of file