about summary refs log tree commit diff
path: root/src/engine/client/snd.c
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-11-04 21:36:03 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-11-04 21:36:03 +0000
commitb6a629cf8020e9fe76de251e07a0135dbd2f1f80 (patch)
treedd744a6ec4384beaae26006e3f674ee774855ea7 /src/engine/client/snd.c
parentdaf89a01ff88c7771f0c252808de2b3eede23927 (diff)
downloadzcatch-b6a629cf8020e9fe76de251e07a0135dbd2f1f80.tar.gz
zcatch-b6a629cf8020e9fe76de251e07a0135dbd2f1f80.zip
new gui commit
Diffstat (limited to 'src/engine/client/snd.c')
-rw-r--r--src/engine/client/snd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/engine/client/snd.c b/src/engine/client/snd.c
index 725bc569..8e70deea 100644
--- a/src/engine/client/snd.c
+++ b/src/engine/client/snd.c
@@ -48,6 +48,7 @@ static VOICE voices[NUM_VOICES] = { {0} };
 static CHANNEL channels[NUM_CHANNELS] = { {255, 0} };
 
 static LOCK sound_lock = 0;
+static int sound_enabled = 0;
 
 static int center_x = 0;
 static int center_y = 0;
@@ -231,9 +232,12 @@ int snd_init()
 	PaStreamParameters params;
 	PaError err = Pa_Initialize();
 	
-	mixing_rate = config.snd_rate;
-
 	sound_lock = lock_create();
+	
+	if(!config.snd_enable)
+		return 0;
+	
+	mixing_rate = config.snd_rate;
 
 	params.device = Pa_GetDefaultOutputDevice();
 	if(params.device < 0)
@@ -243,7 +247,6 @@ int snd_init()
 	params.suggestedLatency = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency;
 	params.hostApiSpecificStreamInfo = 0x0;
 
-
 	err = Pa_OpenStream(
 			&stream,        /* passes back stream pointer */
 			0,              /* no input channels */
@@ -255,6 +258,7 @@ int snd_init()
 			0x0); /* pass our data through to callback */
 	err = Pa_StartStream(stream);
 
+	sound_enabled = 1;
 	return 0;
 }
 
@@ -338,6 +342,10 @@ int snd_load_wv(const char *filename)
 	/* don't waste memory on sound when we are stress testing */
 	if(config.stress)
 		return -1;
+		
+	/* no need to load sound when we are running with no sound */
+	if(!sound_enabled)
+		return 1;
 
 	file = fopen(filename, "rb"); /* TODO: use system.h stuff for this */
 	if(!file)