project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 3667 9359a70df013
parent 3662 a44406f4369b
child 3697 d5b30d6373fc
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Fri Jul 23 22:14:56 2010 +0400
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Jul 24 23:23:10 2010 +0200
@@ -12,6 +12,7 @@
 #import "GameConfigViewController.h"
 #import "SplitViewRootController.h"
 #import "CommodityFunctions.h"
+#import "SDL_mixer.h"
 
 @implementation MainMenuViewController
 @synthesize versionLabel;
@@ -30,7 +31,18 @@
     MSG_MEMCLEAN();
 }
 
+// using a different thread for audio 'cos it's slow
+-(void) initAudioThread {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 1, 512);
+    [pool release];
+}
+
 -(void) viewDidLoad {
+    [NSThread detachNewThreadSelector:@selector(initAudioThread)
+                             toTarget:self
+                           withObject:nil];
+    
     char *ver;
     HW_versionInfo(NULL, &ver);
     NSString *versionNumber = [[NSString alloc] initWithCString:ver];