Muted sound during cartridge open and preferences dialogs

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@375 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
markgrebe 2005-02-26 22:16:37 +00:00
parent c10b612913
commit c01df20e0a
2 changed files with 21 additions and 3 deletions

View File

@ -4,7 +4,7 @@
Mark Grebe <atarimac@cox.net> Mark Grebe <atarimac@cox.net>
*/ */
/* $Id: Menus.m,v 1.4 2005-02-18 05:31:47 markgrebe Exp $ */ /* $Id: Menus.m,v 1.5 2005-02-26 22:16:24 markgrebe Exp $ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "Menus.h" #import "Menus.h"
@ -16,6 +16,7 @@
#define QZ_SLASH 0x2C #define QZ_SLASH 0x2C
#define QZ_COMMA 0x2B #define QZ_COMMA 0x2B
extern void soundMute(int state);
extern void setPaddleMode(int mode); extern void setPaddleMode(int mode);
extern void getPrefsSettings(int *gl, int *volume, float *aspect, const char **romdir); extern void getPrefsSettings(int *gl, int *volume, float *aspect, const char **romdir);
extern void setPrefsSettings(int gl, int volume, float aspect, const char *romdir); extern void setPrefsSettings(int gl, int volume, float aspect, const char *romdir);
@ -57,9 +58,13 @@ char *browseFile(void) {
NSString *dirName; NSString *dirName;
char cdirName[FILENAME_MAX]; char cdirName[FILENAME_MAX];
soundMute(1);
fileName = malloc(FILENAME_MAX); fileName = malloc(FILENAME_MAX);
if (fileName == NULL) if (fileName == NULL)
{
soundMute(0);
return NULL; return NULL;
}
getRomdirSetting(cdirName); getRomdirSetting(cdirName);
dirName = [NSString stringWithCString:cdirName]; dirName = [NSString stringWithCString:cdirName];
@ -72,11 +77,13 @@ char *browseFile(void) {
[[[openPanel filenames] objectAtIndex:0] getCString:fileName]; [[[openPanel filenames] objectAtIndex:0] getCString:fileName];
releaseCmdKeys(@"o",QZ_o); releaseCmdKeys(@"o",QZ_o);
[dirName release]; [dirName release];
soundMute(0);
return fileName; return fileName;
} }
else { else {
releaseCmdKeys(@"o",QZ_o); releaseCmdKeys(@"o",QZ_o);
[dirName release]; [dirName release];
soundMute(0);
return NULL; return NULL;
} }
} }
@ -195,7 +202,8 @@ static Menus *sharedInstance = nil;
const char *romdir; const char *romdir;
const char *newRomdir; const char *newRomdir;
NSString *romDirString; NSString *romDirString;
soundMute(1);
getPrefsSettings(&gl, &volume, &aspectRatio, &romdir); getPrefsSettings(&gl, &volume, &aspectRatio, &romdir);
romDirString = [NSString stringWithCString:romdir]; romDirString = [NSString stringWithCString:romdir];
@ -213,6 +221,7 @@ static Menus *sharedInstance = nil;
newRomdir = [romDirString cString]; newRomdir = [romDirString cString];
setPrefsSettings(gl, volume, aspectRatio, newRomdir); setPrefsSettings(gl, volume, aspectRatio, newRomdir);
soundMute(0);
} }
- (IBAction) prefsOK:(id) sender - (IBAction) prefsOK:(id) sender

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: mainSDL.cxx,v 1.9 2005-02-21 19:32:07 markgrebe Exp $ // $Id: mainSDL.cxx,v 1.10 2005-02-26 22:16:37 markgrebe Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -53,6 +53,7 @@
extern "C" { extern "C" {
int stellaMain(int argc, char* argv[]); int stellaMain(int argc, char* argv[]);
void soundMute(int state);
void setPaddleMode(int mode); void setPaddleMode(int mode);
void setLeftJoystickMode(int mode); void setLeftJoystickMode(int mode);
void setRightJoystickMode(int mode); void setRightJoystickMode(int mode);
@ -997,6 +998,14 @@ void cleanup()
SDL_Quit(); SDL_Quit();
} }
void soundMute(int state)
{
if (state)
theSound->mute(true);
else
theSound->mute(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int stellaMain(int argc, char* argv[]) int stellaMain(int argc, char* argv[])