From 614351cebaaf2b1a372c78639d2ede7d1d7091fc Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 28 Sep 2009 20:44:20 +0000 Subject: Change music enable/disable control in setup tool to a dropdown list, to allow MIDI playback type to be selected. Subversion-branch: /branches/opl-branch Subversion-revision: 1695 --- OPL-TODO | 2 +- setup/sound.c | 74 ++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/OPL-TODO b/OPL-TODO index 3def4e36..39e5b131 100644 --- a/OPL-TODO +++ b/OPL-TODO @@ -8,6 +8,7 @@ Needs research: Bad MIDIs: + * doom2.wad MAP01 * deca.wad MAP01 * gothicdm MAP05 * tnt.wad MAP30 @@ -15,6 +16,5 @@ Bad MIDIs: Other tasks: - * Add option to select MIDI type in setup tool * DMXOPTIONS opl3/phase option support. diff --git a/setup/sound.c b/setup/sound.c index 72414c83..92a6cbae 100644 --- a/setup/sound.c +++ b/setup/sound.c @@ -49,6 +49,14 @@ typedef enum NUM_SFXMODES } sfxmode_t; +typedef enum +{ + MUSMODE_DISABLED, + MUSMODE_OPL, + MUSMODE_NATIVE, + NUM_MUSMODES +} musmode_t; + static char *sfxmode_strings[] = { "Disabled", @@ -56,14 +64,14 @@ static char *sfxmode_strings[] = "Digital", }; -// Disable MIDI music on OSX: there are problems with the native -// MIDI code in SDL_mixer. +static char *musmode_strings[] = +{ + "Disabled", + "OPL (Adlib/SB)", + "Native MIDI" +}; -#ifdef __MACOSX__ -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE -#else #define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB -#endif int snd_sfxdevice = SNDDEVICE_SB; int numChannels = 8; @@ -77,7 +85,7 @@ int snd_samplerate = 22050; int use_libsamplerate = 0; static int snd_sfxmode; -static int snd_musicenabled; +static int snd_musmode; static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) { @@ -93,14 +101,18 @@ static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) snd_sfxdevice = SNDDEVICE_SB; break; } - - if (snd_musicenabled) - { - snd_musicdevice = SNDDEVICE_SB; - } - else + + switch (snd_musmode) { - snd_musicdevice = SNDDEVICE_NONE; + case MUSMODE_DISABLED: + snd_musicdevice = SNDDEVICE_NONE; + break; + case MUSMODE_OPL: + snd_musicdevice = SNDDEVICE_SB; + break; + case MUSMODE_NATIVE: + snd_musicdevice = SNDDEVICE_GENMIDI; + break; } } @@ -110,7 +122,7 @@ void ConfigSound(void) txt_table_t *sfx_table; txt_table_t *music_table; txt_dropdown_list_t *sfx_mode_control; - txt_checkbox_t *music_enabled_control; + txt_dropdown_list_t *mus_mode_control; if (snd_sfxdevice == SNDDEVICE_PCSPEAKER) { @@ -124,8 +136,21 @@ void ConfigSound(void) { snd_sfxmode = SFXMODE_DISABLED; } - - snd_musicenabled = snd_musicdevice != SNDDEVICE_NONE; + + if (snd_musicdevice == SNDDEVICE_GENMIDI) + { + snd_musmode = MUSMODE_NATIVE; + } + else if (snd_musicdevice == SNDDEVICE_SB + || snd_musicdevice == SNDDEVICE_ADLIB + || snd_musicdevice == SNDDEVICE_AWE32) + { + snd_musmode = MUSMODE_OPL; + } + else + { + snd_musmode = MUSMODE_DISABLED; + } window = TXT_NewWindow("Sound configuration"); @@ -133,12 +158,10 @@ void ConfigSound(void) TXT_NewSeparator("Sound effects"), sfx_table = TXT_NewTable(2), TXT_NewSeparator("Music"), - music_enabled_control = TXT_NewCheckBox("Music enabled", - &snd_musicenabled), music_table = TXT_NewTable(2), NULL); - TXT_SetColumnWidths(sfx_table, 20, 5); + TXT_SetColumnWidths(sfx_table, 20, 14); TXT_AddWidgets(sfx_table, TXT_NewLabel("Sound effects"), @@ -151,17 +174,20 @@ void ConfigSound(void) TXT_NewSpinControl(&sfxVolume, 0, 15), NULL); - TXT_SetColumnWidths(music_table, 20, 5); + TXT_SetColumnWidths(music_table, 20, 14); TXT_AddWidgets(music_table, + TXT_NewLabel("Music playback"), + mus_mode_control = TXT_NewDropdownList(&snd_musmode, + musmode_strings, + NUM_MUSMODES), TXT_NewLabel("Music volume"), TXT_NewSpinControl(&musicVolume, 0, 15), NULL); - TXT_SignalConnect(sfx_mode_control, "changed", + TXT_SignalConnect(sfx_mode_control, "changed", UpdateSndDevices, NULL); - TXT_SignalConnect(music_enabled_control, "changed", + TXT_SignalConnect(mus_mode_control, "changed", UpdateSndDevices, NULL); - } -- cgit v1.2.3