about summary refs log tree commit diff
path: root/src/engine/client/snd.cpp
diff options
context:
space:
mode:
authorJoel de Vahl <joel@stalverk80.se>2007-07-21 17:03:27 +0000
committerJoel de Vahl <joel@stalverk80.se>2007-07-21 17:03:27 +0000
commitb5551dc685d69ef82e581c5ff08454737372175c (patch)
treee60731678bee02184ea27d635162e15f6ae44f04 /src/engine/client/snd.cpp
parentf66acdfee2935ce30e2ccb0049eef5cfdf9e233b (diff)
downloadzcatch-b5551dc685d69ef82e581c5ff08454737372175c.tar.gz
zcatch-b5551dc685d69ef82e581c5ff08454737372175c.zip
Volume control backend.
Diffstat (limited to 'src/engine/client/snd.cpp')
-rw-r--r--src/engine/client/snd.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/engine/client/snd.cpp b/src/engine/client/snd.cpp
index 8cfa51d7..ee563df8 100644
--- a/src/engine/client/snd.cpp
+++ b/src/engine/client/snd.cpp
@@ -11,7 +11,7 @@ static const float NUM_FRAMES_STOP_INV = 1.0f/(float)NUM_FRAMES_STOP;
 static const int NUM_FRAMES_LERP = 512;
 static const float NUM_FRAMES_LERP_INV = 1.0f/(float)NUM_FRAMES_LERP;
 
-static const float GLOBAL_VOLUME_SCALE = 0.75f;
+static float GLOBAL_VOLUME_SCALE = 0.75f;
 
 static const int64 GLOBAL_SOUND_DELAY = 1000;
 
@@ -211,6 +211,21 @@ bool snd_shutdown()
 	return true;
 }
 
+float snd_get_master_volume()
+{
+	return GLOBAL_VOLUME_SCALE;
+}
+
+void snd_set_master_volume(float val)
+{
+	if(val < 0.0f)
+		val = 0.0f;
+	else if(val > 1.0f)
+		val = 1.0f;
+
+	GLOBAL_VOLUME_SCALE = val;
+}
+
 static int snd_alloc_sound()
 {
 	if(first_free_sound < 0)