1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
4 // Copyright(C) 2006 Simon Howard
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 #include "textscreen.h"
38 static char *sfxmode_strings
[] =
45 int snd_sfxdevice
= SNDDEVICE_SB
;
49 int snd_musicdevice
= SNDDEVICE_SB
;
52 int snd_samplerate
= 22050;
54 int use_libsamplerate
= 0;
56 static int snd_sfxmode
;
57 static int snd_musicenabled
;
59 static void UpdateSndDevices(TXT_UNCAST_ARG(widget
), TXT_UNCAST_ARG(data
))
63 case SFXMODE_DISABLED
:
64 snd_sfxdevice
= SNDDEVICE_NONE
;
66 case SFXMODE_PCSPEAKER
:
67 snd_sfxdevice
= SNDDEVICE_PCSPEAKER
;
70 snd_sfxdevice
= SNDDEVICE_SB
;
76 snd_musicdevice
= SNDDEVICE_SB
;
80 snd_musicdevice
= SNDDEVICE_NONE
;
84 void ConfigSound(void)
87 txt_table_t
*sfx_table
;
88 txt_table_t
*music_table
;
89 txt_dropdown_list_t
*sfx_mode_control
;
90 txt_checkbox_t
*music_enabled_control
;
92 if (snd_sfxdevice
== SNDDEVICE_PCSPEAKER
)
94 snd_sfxmode
= SFXMODE_PCSPEAKER
;
96 else if (snd_sfxdevice
>= SNDDEVICE_SB
)
98 snd_sfxmode
= SFXMODE_DIGITAL
;
102 snd_sfxmode
= SFXMODE_DISABLED
;
105 snd_musicenabled
= snd_musicdevice
!= SNDDEVICE_NONE
;
107 window
= TXT_NewWindow("Sound configuration");
109 TXT_AddWidgets(window
,
110 TXT_NewSeparator("Sound effects"),
111 sfx_table
= TXT_NewTable(2),
112 TXT_NewSeparator("Music"),
113 music_enabled_control
= TXT_NewCheckBox("Music enabled",
115 music_table
= TXT_NewTable(2),
118 TXT_SetColumnWidths(sfx_table
, 20, 5);
120 TXT_AddWidgets(sfx_table
,
121 TXT_NewLabel("Sound effects"),
122 sfx_mode_control
= TXT_NewDropdownList(&snd_sfxmode
,
125 TXT_NewLabel("Sound channels"),
126 TXT_NewSpinControl(&numChannels
, 1, 8),
127 TXT_NewLabel("SFX volume"),
128 TXT_NewSpinControl(&sfxVolume
, 0, 15),
131 TXT_SetColumnWidths(music_table
, 20, 5);
133 TXT_AddWidgets(music_table
,
134 TXT_NewLabel("Music volume"),
135 TXT_NewSpinControl(&musicVolume
, 0, 15),
138 TXT_SignalConnect(sfx_mode_control
, "changed",
139 UpdateSndDevices
, NULL
);
140 TXT_SignalConnect(music_enabled_control
, "changed",
141 UpdateSndDevices
, NULL
);