Implemented -nosound command line option.

This commit is contained in:
AnotherCommander 2016-11-05 22:12:07 +01:00
parent 6ed3ceac6c
commit 11c639a866
4 changed files with 14 additions and 1 deletions

View File

@ -8494,7 +8494,7 @@ static NSString *SliderString(NSInteger amountIn20ths)
[gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,AUTOSAVE)];
// volume control
if ([OOSound respondsToSelector:@selector(masterVolume)])
if ([OOSound respondsToSelector:@selector(masterVolume)] && [OOSound isSoundOK])
{
double volume = 100.0 * [OOSound masterVolume];
int vol = (volume / 5.0 + 0.5); // avoid rounding errors

View File

@ -96,6 +96,8 @@ static BOOL sIsSoundOK = NO;
- (id) initWithContentsOfFile:(NSString *)path
{
if (!sIsSoundOK) return nil;
[self release];
if (!sIsSetUp && ![OOSound setUp]) return nil;

View File

@ -47,6 +47,16 @@ static id sSingleton = nil;
self = [super init];
if (self != nil)
{
NSArray *arguments = nil;
NSEnumerator *argEnum = nil;
NSString *arg = nil;
arguments = [[NSProcessInfo processInfo] arguments];
for (argEnum = [arguments objectEnumerator]; (arg = [argEnum nextObject]); )
{
if ([arg isEqual:@"-nosound"] || [arg isEqual:@"--nosound"]) return nil;
}
ALuint error;
device = alcOpenDevice(NULL); // default device
if (!device)

View File

@ -195,6 +195,7 @@ MA 02110-1301, USA.
// end TODO
[OOSound setUp];
if (![OOSound isSoundOK]) OOLog(@"sound.init", @"Sound system disabled.");
// Generate the window caption, containing the version number and the date the executable was compiled.
static char windowCaption[128];