Here's a (probably very nasty) patch which works around it - there's possibly much better ways to do it within the codebase.
Code: Select all
Index: OOSDLSound.h
===================================================================
--- OOSDLSound.h (revision 1769)
+++ OOSDLSound.h (working copy)
@@ -61,4 +61,6 @@
- (NSString *)name;
++ (BOOL) isSoundOK;
+
@end
Index: OOSDLSound.m
===================================================================
--- OOSDLSound.m (revision 1769)
+++ OOSDLSound.m (working copy)
@@ -89,7 +89,8 @@
+ (void) setMasterVolume:(float) fraction
{
- if (!sIsSetUp) [self setUp];
+ if (![self setUp])
+ return;
fraction = OOClamp_0_1_f(fraction);
int volume = (float)MIX_MAX_VOLUME * fraction;
@@ -108,7 +109,8 @@
+ (float) masterVolume
{
- if (!sIsSetUp) [self setUp];
+ if (![self setUp] )
+ return 0;
return (float)sEffectiveMasterVolume / (float)MIX_MAX_VOLUME;
}
@@ -116,7 +118,8 @@
- (id) init
{
- if (!sIsSetUp) [OOSound setUp];
+ if (![OOSound setUp] )
+ return nil;
return [super init];
}
@@ -124,7 +127,7 @@
- (id) initWithContentsOfFile:(NSString *)path
{
[self release];
- if (!sIsSetUp && ![OOSound setUp]) return nil;
+ if (![OOSound setUp]) return nil;
return [[OOSDLConcreteSound alloc] initWithContentsOfFile:path];
}
@@ -139,7 +142,14 @@
+ (void) update
{
- [[OOSoundMixer sharedMixer] update];
+ OOSoundMixer * mixer = [OOSoundMixer sharedMixer];
+ if( sIsSoundOK && mixer)
+ [mixer update];
}
++ (BOOL) isSoundOK
+{
+ return sIsSoundOK;
+}
+
@end
Index: SDLMusic.m
===================================================================
--- SDLMusic.m (revision 1769)
+++ SDLMusic.m (working copy)
@@ -24,6 +24,7 @@
#include "SDLMusic.h"
#import "OOLogging.h"
+#include "OOSDLSound.h"
#define kOOLogUnconvertedNSLog @"unclassified.SDLMusic"
@@ -72,8 +73,9 @@
*/
- (id) initWithContentsOfFile:(NSString*) filepath
{
+ if( ![OOSound isSoundOK] ) return nil;
+
[super init];
-
music = Mix_LoadMUS([filepath cString]);
if (!music)
{
/