summaryrefslogtreecommitdiff
path: root/setup/sound.c
diff options
context:
space:
mode:
authorSimon Howard2006-10-22 22:10:08 +0000
committerSimon Howard2006-10-22 22:10:08 +0000
commitc4c79440c404fabc7a77e1d4561ff707e223233a (patch)
treed0054a00fb394debb1f193f172ac382419965e87 /setup/sound.c
parent14b01ab612caf0cbedd845ab3ae6bd5cec3a1bd3 (diff)
downloadchocolate-doom-c4c79440c404fabc7a77e1d4561ff707e223233a.tar.gz
chocolate-doom-c4c79440c404fabc7a77e1d4561ff707e223233a.tar.bz2
chocolate-doom-c4c79440c404fabc7a77e1d4561ff707e223233a.zip
Standardise setup config variable names on the same variable names used
in Doom. Add header files for source files where they are needed. Make variables static where appropriate. General cleanups etc. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 712
Diffstat (limited to 'setup/sound.c')
-rw-r--r--setup/sound.c94
1 files changed, 66 insertions, 28 deletions
diff --git a/setup/sound.c b/setup/sound.c
index a96868ab..e8e05277 100644
--- a/setup/sound.c
+++ b/setup/sound.c
@@ -25,44 +25,82 @@
#include "textscreen.h"
-int snd_sfxenabled;
+#include "sound.h"
+
+int snd_sfxdevice = 3;
int snd_channels = 8;
int sfx_volume = 15;
-int snd_musicenabled;
+int snd_musicdevice = 3;
int music_volume = 15;
+static int snd_sfxenabled;
+static int snd_musicenabled;
+
+static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data))
+{
+ if (snd_sfxenabled)
+ {
+ snd_sfxdevice = 3;
+ }
+ else
+ {
+ snd_sfxdevice = 0;
+ }
+
+ if (snd_musicenabled)
+ {
+ snd_musicdevice = 3;
+ }
+ else
+ {
+ snd_musicdevice = 0;
+ }
+}
+
void ConfigSound(void)
{
- txt_window_t *window;
- txt_table_t *sfx_table;
- txt_table_t *music_table;
-
- window = TXT_NewWindow("Sound configuration");
-
- TXT_AddWidgets(window,
- TXT_NewSeparator("Sound effects"),
- TXT_NewCheckBox("Sound effects enabled", &snd_sfxenabled),
- sfx_table = TXT_NewTable(2),
- TXT_NewSeparator("Music"),
- TXT_NewCheckBox("Music enabled", &snd_musicenabled),
- music_table = TXT_NewTable(2),
- NULL);
+ txt_window_t *window;
+ txt_table_t *sfx_table;
+ txt_table_t *music_table;
+ txt_checkbox_t *sfx_enabled_control;
+ txt_checkbox_t *music_enabled_control;
- TXT_SetColumnWidths(sfx_table, 20, 5);
+ snd_sfxenabled = snd_sfxdevice != 0;
+ snd_musicenabled = snd_musicdevice != 0;
- TXT_AddWidgets(sfx_table,
- TXT_NewLabel("Sound channels"),
- TXT_NewSpinControl(&snd_channels, 1, 8),
- TXT_NewLabel("SFX volume"),
- TXT_NewSpinControl(&sfx_volume, 0, 15),
- NULL);
+ window = TXT_NewWindow("Sound configuration");
- TXT_SetColumnWidths(music_table, 20, 5);
+ TXT_AddWidgets(window,
+ TXT_NewSeparator("Sound effects"),
+ sfx_enabled_control = TXT_NewCheckBox("Sound effects enabled",
+ &snd_sfxenabled),
+ sfx_table = TXT_NewTable(2),
+ TXT_NewSeparator("Music"),
+ music_enabled_control = TXT_NewCheckBox("Music enabled",
+ &snd_musicenabled),
+ music_table = TXT_NewTable(2),
+ NULL);
- TXT_AddWidgets(music_table,
- TXT_NewLabel("Music volume"),
- TXT_NewSpinControl(&music_volume, 0, 15),
- NULL);
+ TXT_SetColumnWidths(sfx_table, 20, 5);
+
+ TXT_SignalConnect(sfx_enabled_control, "changed",
+ UpdateSndDevices, NULL);
+ TXT_SignalConnect(music_enabled_control, "changed",
+ UpdateSndDevices, NULL);
+
+ TXT_AddWidgets(sfx_table,
+ TXT_NewLabel("Sound channels"),
+ TXT_NewSpinControl(&snd_channels, 1, 8),
+ TXT_NewLabel("SFX volume"),
+ TXT_NewSpinControl(&sfx_volume, 0, 15),
+ NULL);
+
+ TXT_SetColumnWidths(music_table, 20, 5);
+
+ TXT_AddWidgets(music_table,
+ TXT_NewLabel("Music volume"),
+ TXT_NewSpinControl(&music_volume, 0, 15),
+ NULL);
}