Menu changes (#1928)

* Add a new gap macro

* Limit wrapped strings to 2 lines

* Adjust FluidSynth string formatting

* Add native MIDI gain setting

* Add MIDI options menu

* Adjust gamepad menu for consistency

* Adjust video menu spacing
This commit is contained in:
ceski 2024-09-30 19:28:54 -07:00 committed by GitHub
parent c4ddb3de39
commit 14332c3bfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 163 additions and 44 deletions

View File

@ -197,6 +197,7 @@ typedef enum {
ss_enem,
ss_gen, // killough 10/98
ss_comp, // killough 10/98
ss_midi,
ss_eq,
ss_padadv,
ss_gyro,

View File

@ -441,7 +441,7 @@ static const char **I_FL_DeviceList(void)
if (W_CheckNumForName("SNDFONT") >= 0)
{
array_push(devices, "FluidSynth (SNDFONT)");
array_push(devices, "FluidSynth: SNDFONT");
return devices;
}
@ -454,7 +454,7 @@ static const char **I_FL_DeviceList(void)
{
name[NAME_MAX_LENGTH] = '\0';
}
array_push(devices, M_StringJoin("FluidSynth (", name, ")"));
array_push(devices, M_StringJoin("FluidSynth: ", name));
free(name);
}
@ -477,8 +477,8 @@ static void I_FL_BindVariables(void)
"../share/" PROJECT_SHORTNAME "/soundfonts",
#endif
wad_no, "FluidSynth soundfont directories");
BIND_BOOL(mus_chorus, false, "FluidSynth chorus");
BIND_BOOL(mus_reverb, false, "FluidSynth reverb");
BIND_BOOL_MIDI(mus_chorus, false, "FluidSynth chorus");
BIND_BOOL_MIDI(mus_reverb, false, "FluidSynth reverb");
}
stream_module_t stream_fl_module =

View File

@ -64,6 +64,7 @@ static int midi_complevel = COMP_STANDARD;
static int midi_reset_type = RESET_TYPE_GM;
static int midi_reset_delay = -1;
static boolean midi_ctf = true;
static int midi_gain = 100;
static const byte gm_system_on[] =
{
@ -1320,25 +1321,32 @@ static boolean I_MID_InitMusic(int device)
return true;
}
static void UpdateVolumeFactor(int volume)
{
volume_factor = sqrtf(volume / 15.0f) * midi_gain / 100.0f;
}
static void I_MID_SetMusicVolume(int volume)
{
static int last_volume = -1;
static int last_midi_gain = -1;
if (last_volume == volume)
if (last_volume == volume && midi_gain == last_midi_gain)
{
// Ignore holding key down in volume menu.
return;
}
last_volume = volume;
last_midi_gain = midi_gain;
if (!SDL_AtomicGet(&player_thread_running))
{
volume_factor = sqrtf((float)volume / 15.0f);
UpdateVolumeFactor(volume);
return;
}
SDL_LockMutex(music_lock);
volume_factor = sqrtf((float)volume / 15.0f);
UpdateVolumeFactor(volume);
UpdateVolume();
SDL_UnlockMutex(music_lock);
}
@ -1479,14 +1487,16 @@ static const char **I_MID_DeviceList(void)
static void I_MID_BindVariables(void)
{
BIND_NUM(midi_complevel, COMP_STANDARD, 0, COMP_NUM - 1,
BIND_NUM_MIDI(midi_complevel, COMP_STANDARD, 0, COMP_NUM - 1,
"Native MIDI compatibility level (0 = Vanilla; 1 = Standard; 2 = Full)");
BIND_NUM(midi_reset_type, RESET_TYPE_GM, 0, RESET_NUM - 1,
BIND_NUM_MIDI(midi_reset_type, RESET_TYPE_GM, 0, RESET_NUM - 1,
"Reset type for native MIDI (0 = No SysEx; 1 = GM; 2 = GS; 3 = XG)");
BIND_NUM(midi_reset_delay, -1, -1, 2000,
"Delay after reset for native MIDI (-1 = Auto; 0 = None; 1-2000 = Milliseconds)");
BIND_BOOL(midi_ctf, true,
BIND_BOOL_MIDI(midi_ctf, true,
"Fix invalid instruments by emulating SC-55 capital tone fallback");
BIND_NUM_MIDI(midi_gain, 100, 0, 100,
"Fine tune native MIDI output level (default 100%)");
}
music_module_t music_mid_module =

View File

@ -460,10 +460,10 @@ static const char **I_OAL_DeviceList(void)
static void I_OAL_BindVariables(void)
{
BIND_NUM(opl_gain, 200, 100, 1000,
BIND_NUM_MIDI(opl_gain, 200, 100, 1000,
"Fine tune OPL emulation output level (default 200%)");
#if defined (HAVE_FLUIDSYNTH)
BIND_NUM(mus_gain, 100, 10, 1000,
BIND_NUM_MIDI(mus_gain, 100, 10, 1000,
"Fine tune FluidSynth output level (default 100%)");
#endif
for (int i = 0; i < arrlen(midi_modules); ++i)

View File

@ -1687,9 +1687,9 @@ static const char **I_OPL_DeviceList(void)
static void I_OPL_BindVariables(void)
{
BIND_NUM(num_opl_chips, 1, 1, OPL_MAX_CHIPS,
BIND_NUM_MIDI(num_opl_chips, 1, 1, OPL_MAX_CHIPS,
"[OPL3 Emulation] Number of chips to emulate (1-6)");
BIND_BOOL(opl_stereo_correct, false,
BIND_BOOL_MIDI(opl_stereo_correct, false,
"[OPL3 Emulation] Use MIDI-correct stereo channel polarity");
}

View File

@ -42,6 +42,9 @@ void M_BindNum(const char *name, void *location, void *current,
#define BIND_NUM_GENERAL(name, v, a, b, help) \
M_BindNum(#name, &name, NULL, (v), (a), (b), ss_gen, wad_no, help)
#define BIND_NUM_MIDI(name, v, a, b, help) \
M_BindNum(#name, &name, NULL, (v), (a), (b), ss_midi, wad_no, help)
void M_BindBool(const char *name, boolean *location, boolean *current,
boolean default_val, ss_types screen, wad_allowed_t wad,
const char *help);
@ -52,6 +55,9 @@ void M_BindBool(const char *name, boolean *location, boolean *current,
#define BIND_BOOL_GENERAL(name, v, help) \
M_BindBool(#name, &name, NULL, (v), ss_gen, wad_no, help)
#define BIND_BOOL_MIDI(name, v, help) \
M_BindBool(#name, &name, NULL, (v), ss_midi, wad_no, help)
void M_BindStr(char *name, const char **location, char *default_val,
wad_allowed_t wad, const char *help);

View File

@ -95,9 +95,10 @@ void MN_DrawStatusHUD(void);
void MN_DrawAutoMap(void);
void MN_DrawWeapons(void);
void MN_DrawEnemy(void);
void MN_DrawMidi(void);
void MN_DrawEqualizer(void);
void MN_DrawPadAdv(void);
void MN_DrawGyro(void);
void MN_DrawEqualizer(void);
/////////////////////////////
//

View File

@ -1867,6 +1867,14 @@ static menu_t CompatDef = // killough 10/98
0
};
static menu_t MidiDef = {
generic_setup_end, // numitems
&SetupDef, // prevMenu
Generic_Setup, // menuitems
MN_DrawMidi, // routine
34, 5, // x, y (skull drawn here)
};
static menu_t EqualizerDef = {
generic_setup_end, // numitems
&SetupDef, // prevMenu
@ -1894,8 +1902,9 @@ static menu_t GyroDef = {
void MN_SetNextMenuAlt(ss_types type)
{
static menu_t *setup_defs[] = {
&KeybndDef, &WeaponDef, &StatusHUDDef, &AutoMapDef, &EnemyDef,
&GeneralDef, &CompatDef, &EqualizerDef, &PadAdvDef, &GyroDef,
&KeybndDef, &WeaponDef, &StatusHUDDef, &AutoMapDef,
&EnemyDef, &GeneralDef, &CompatDef, &MidiDef,
&EqualizerDef, &PadAdvDef, &GyroDef,
};
SetNextMenu(setup_defs[type]);

View File

@ -133,8 +133,8 @@ static boolean default_reset;
#define MI_GAP \
{NULL, S_SKIP, 0, M_SPC}
#define MI_GAP_HALF \
{NULL, S_SKIP, 0, M_SPC / 2}
#define MI_GAP_EX(y) \
{NULL, S_SKIP, 0, (y)}
static void DisableItem(boolean condition, setup_menu_t *menu, const char *item)
{
@ -337,6 +337,8 @@ enum
str_sound_module,
str_resampler,
str_equalizer_preset,
str_midi_complevel,
str_midi_reset_type,
str_mouse_accel,
@ -756,6 +758,11 @@ static void WrapSettingString(setup_menu_t *s, int x, int y, int color)
DrawMenuStringBuffer(flags, x, y, color, &menu_buffer[index]);
y += M_SPC;
s->lines++;
if (s->lines > 1)
{
break;
}
}
else
{
@ -1665,19 +1672,19 @@ static setup_menu_t weap_settings2[] = {
.strings_id = str_weapon_slots_selection,
.action = UpdateWeaponSlotSelection},
MI_GAP_HALF,
MI_GAP_EX(4),
MI_WEAPON_SLOT(0, "weapon_slots_1_1"),
MI_WEAPON_SLOT(1, "weapon_slots_1_2"),
MI_WEAPON_SLOT(2, "weapon_slots_1_3"),
MI_GAP_HALF,
MI_GAP_EX(4),
MI_WEAPON_SLOT(3, "weapon_slots_2_1"),
MI_WEAPON_SLOT(4, "weapon_slots_2_2"),
MI_WEAPON_SLOT(5, "weapon_slots_2_3"),
MI_GAP_HALF,
MI_GAP_EX(4),
MI_WEAPON_SLOT(6, "weapon_slots_3_1"),
MI_WEAPON_SLOT(7, "weapon_slots_3_2"),
MI_WEAPON_SLOT(8, "weapon_slots_3_3"),
MI_GAP_HALF,
MI_GAP_EX(4),
MI_WEAPON_SLOT(9, "weapon_slots_4_1"),
MI_WEAPON_SLOT(10, "weapon_slots_4_2"),
MI_WEAPON_SLOT(11, "weapon_slots_4_3"),
@ -2432,7 +2439,7 @@ static setup_menu_t gen_settings1[] = {
{"Exclusive Fullscreen", S_ONOFF, CNTR_X, M_SPC, {"exclusive_fullscreen"},
.action = ToggleExclusiveFullScreen},
MI_GAP,
MI_GAP_EX(6),
{"Uncapped FPS", S_ONOFF, CNTR_X, M_SPC, {"uncapped"},
.action = UpdateFPSLimit},
@ -2443,7 +2450,7 @@ static setup_menu_t gen_settings1[] = {
{"VSync", S_ONOFF, CNTR_X, M_SPC, {"use_vsync"},
.action = I_ToggleVsync},
MI_GAP,
MI_GAP_EX(5),
{"FOV", S_THERMO | S_THRM_SIZE11, CNTR_X, M_THRM_SPC, {"fov"},
.action = UpdateFOV},
@ -2502,6 +2509,7 @@ static void SetMidiPlayer(void)
S_RestartMusic();
}
static void MN_Midi(void);
static void MN_Equalizer(void);
static setup_menu_t gen_settings2[] = {
@ -2512,7 +2520,7 @@ static setup_menu_t gen_settings2[] = {
{"Music Volume", S_THERMO, CNTR_X, M_THRM_SPC, {"music_volume"},
.action = UpdateMusicVolume},
MI_GAP,
MI_GAP_EX(6),
{"Sound Module", S_CHOICE, CNTR_X, M_SPC, {"snd_module"},
.strings_id = str_sound_module, .action = SetSoundModule},
@ -2528,15 +2536,19 @@ static setup_menu_t gen_settings2[] = {
{"Resampler", S_CHOICE, CNTR_X, M_SPC, {"snd_resampler"},
.strings_id = str_resampler, .action = I_OAL_SetResampler},
{"Equalizer Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Equalizer},
MI_GAP,
MI_GAP_EX(6),
// [FG] music backend
{"MIDI Player", S_CHOICE | S_ACTION | S_WRAP_LINE, CNTR_X, M_SPC,
{"MIDI Player", S_CHOICE | S_ACTION | S_WRAP_LINE, CNTR_X, M_SPC * 2,
{"midi_player_menu"}, .strings_id = str_midi_player,
.action = SetMidiPlayer},
MI_GAP_EX(6),
{"MIDI Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Midi},
{"Equalizer Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Equalizer},
MI_END
};
@ -2547,6 +2559,84 @@ static const char **GetResamplerStrings(void)
return strings;
}
static const char *midi_complevel_strings[] = {
"Vanilla", "Standard", "Full"
};
static const char *midi_reset_type_strings[] = {
"No SysEx", "General MIDI", "Roland GS", "Yamaha XG"
};
static setup_menu_t midi_settings1[] = {
{"Native MIDI Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC,
{"midi_gain"}, .action = UpdateMusicVolume},
{"Native MIDI Reset", S_CHOICE | S_ACTION, CNTR_X, M_SPC,
{"midi_reset_type"}, .strings_id = str_midi_reset_type,
.action = SetMidiPlayer},
{"Compatibility Level", S_CHOICE | S_ACTION, CNTR_X, M_SPC,
{"midi_complevel"}, .strings_id = str_midi_complevel,
.action = SetMidiPlayer},
{"SC-55 CTF Emulation", S_ONOFF, CNTR_X, M_SPC, {"midi_ctf"},
.action = SetMidiPlayer},
MI_GAP,
#if defined (HAVE_FLUIDSYNTH)
{"FluidSynth Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC, {"mus_gain"},
.action = UpdateMusicVolume},
{"FluidSynth Reverb", S_ONOFF, CNTR_X, M_SPC, {"mus_reverb"},
.action = SetMidiPlayer},
{"FluidSynth Chorus", S_ONOFF, CNTR_X, M_SPC, {"mus_chorus"},
.action = SetMidiPlayer},
MI_GAP,
#endif
{"OPL3 Gain", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC, {"opl_gain"},
.action = UpdateMusicVolume},
{"OPL3 Number of Chips", S_THERMO | S_THRM_SIZE4 | S_ACTION, CNTR_X,
M_THRM_SPC, {"num_opl_chips"}, .action = SetMidiPlayer},
{"OPL3 Reverse Stereo", S_ONOFF, CNTR_X, M_SPC,
{"opl_stereo_correct"}, .action = SetMidiPlayer},
MI_END
};
static setup_menu_t *midi_settings[] = {midi_settings1, NULL};
static setup_tab_t midi_tabs[] = {{"MIDI"}, {NULL}};
static void MN_Midi(void)
{
SetItemOn(set_item_on);
SetPageIndex(current_page);
MN_SetNextMenuAlt(ss_midi);
setup_screen = ss_midi;
current_page = GetPageIndex(midi_settings);
current_menu = midi_settings[current_page];
current_tabs = midi_tabs;
SetupMenuSecondary();
}
void MN_DrawMidi(void)
{
inhelpscreens = true;
DrawBackground("FLOOR4_6");
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
DrawTabs();
DrawInstructions();
DrawScreenItems(current_menu);
}
static const char *equalizer_preset_strings[] = {
"Off", "Classical", "Rock", "Vocal", "Custom"
};
@ -2558,12 +2648,12 @@ static setup_menu_t eq_settings1[] = {
{"Preset", S_CHOICE, CNTR_X, M_SPC_EQ, {"snd_equalizer"},
.strings_id = str_equalizer_preset, .action = I_OAL_EqualizerPreset},
MI_GAP_HALF,
MI_GAP_EX(4),
{"Preamp dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_preamp"}, .action = I_OAL_EqualizerPreset},
MI_GAP_HALF,
MI_GAP_EX(4),
{"Low Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_low_gain"}, .action = I_OAL_EqualizerPreset},
@ -2577,7 +2667,7 @@ static setup_menu_t eq_settings1[] = {
{"High Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_high_gain"}, .action = I_OAL_EqualizerPreset},
MI_GAP_HALF,
MI_GAP_EX(4),
{"Low Cutoff Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_low_cutoff"}, .action = I_OAL_EqualizerPreset},
@ -2755,23 +2845,15 @@ static const char *curve_strings[] = {
static void MN_PadAdv(void);
static void MN_Gyro(void);
#define MI_GAP_GAMEPAD {NULL, S_SKIP, 0, 6}
static setup_menu_t gen_settings4[] = {
{"Advanced Options", S_FUNC, CNTR_X, M_SPC, .action = MN_PadAdv},
{"Gyro Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Gyro},
MI_GAP_GAMEPAD,
{"Free Look", S_ONOFF, CNTR_X, M_SPC, {"padlook"},
.action = MN_UpdatePadLook},
{"Invert Look", S_ONOFF, CNTR_X, M_SPC, {"joy_invert_look"},
.action = I_ResetGamepad},
MI_GAP_GAMEPAD,
MI_GAP_EX(4),
{"Turn Speed", S_THERMO | S_THRM_SIZE11, CNTR_X, M_THRM_SPC,
{"joy_turn_speed"}, .action = I_ResetGamepad},
@ -2779,7 +2861,7 @@ static setup_menu_t gen_settings4[] = {
{"Look Speed", S_THERMO | S_THRM_SIZE11, CNTR_X, M_THRM_SPC,
{"joy_look_speed"}, .action = I_ResetGamepad},
MI_GAP_GAMEPAD,
MI_GAP_EX(4),
{"Movement Deadzone", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC,
{"joy_movement_inner_deadzone"}, .action = I_ResetGamepad},
@ -2787,11 +2869,17 @@ static setup_menu_t gen_settings4[] = {
{"Camera Deadzone", S_THERMO | S_PCT, CNTR_X, M_THRM_SPC,
{"joy_camera_inner_deadzone"}, .action = I_ResetGamepad},
MI_GAP_GAMEPAD,
MI_GAP_EX(4),
{"Rumble", S_THERMO, CNTR_X, M_THRM_SPC, {"joy_rumble"},
.strings_id = str_rumble, .action = UpdateRumble},
MI_GAP,
{"Advanced Options", S_FUNC, CNTR_X, M_SPC, .action = MN_PadAdv},
{"Gyro Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Gyro},
MI_END
};
@ -3311,6 +3399,7 @@ static setup_menu_t **setup_screens[] = {
enem_settings,
gen_settings, // killough 10/98
comp_settings,
midi_settings,
eq_settings,
padadv_settings,
gyro_settings,
@ -3440,6 +3529,7 @@ static void ResetDefaultsSecondary(void)
{
if (setup_screen == ss_gen)
{
ResetDefaults(ss_midi);
ResetDefaults(ss_eq);
ResetDefaults(ss_padadv);
ResetDefaults(ss_gyro);
@ -4667,6 +4757,8 @@ static const char **selectstrings[] = {
sound_module_strings,
NULL, // str_resampler
equalizer_preset_strings,
midi_complevel_strings,
midi_reset_type_strings,
NULL, // str_mouse_accel
gyro_space_strings,
gyro_action_strings,