From f3ce1aad1cb97d59e8425002065086a221d05814 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 29 Oct 2024 13:31:29 +0100 Subject: [PATCH] demote some messages to debug verbosity (#1962) * demote some messages to debug verbosity Fixes #1959 * report music lump format in S_ChangeMusic() messages * apply patch by @rfomin, thanks * remove some unneccessary includes --- src/g_game.c | 12 ++++++------ src/i_flmusic.c | 10 ++++++++++ src/i_midimusic.c | 18 +++++++++++++++++- src/i_oalmusic.c | 10 ++++++++++ src/i_oalstream.h | 1 + src/i_oplmusic.c | 10 ++++++++++ src/i_printf.h | 3 +++ src/i_sndfile.c | 23 +++++++++++++++++++++++ src/i_sound.c | 9 +++++++++ src/i_sound.h | 3 +++ src/i_xmp.c | 13 +++++++++++++ src/p_setup.c | 2 +- src/s_sound.c | 12 ++++++++---- 13 files changed, 114 insertions(+), 12 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 39aec4b2..d389b009 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2015,7 +2015,7 @@ static void G_DoPlayDemo(void) M_ReadFile(filename, &demobuffer); demolength = M_FileLength(filename); demo_p = demobuffer; - I_Printf(VB_INFO, "G_DoPlayDemo: %s", filename); + I_Printf(VB_DEMO, "G_DoPlayDemo: %s", filename); } else { @@ -2024,7 +2024,7 @@ static void G_DoPlayDemo(void) int lumpnum = W_GetNumForName(lumpname); demolength = W_LumpLength(lumpnum); demobuffer = demo_p = W_CacheLumpNum(lumpnum, PU_STATIC); // killough - I_Printf(VB_INFO, "G_DoPlayDemo: %s (%s)", lumpname, W_WadNameForLump(lumpnum)); + I_Printf(VB_DEMO, "G_DoPlayDemo: %s (%s)", lumpname, W_WadNameForLump(lumpnum)); } // [FG] ignore too short demo lumps @@ -2790,12 +2790,12 @@ static void PrintLevelTimes(void) { if (totalleveltimes) { - I_Printf(VB_INFO, "(%d:%02d) ", + I_Printf(VB_DEBUG, "(%d:%02d) ", ((totalleveltimes + leveltime) / TICRATE) / 60, ((totalleveltimes + leveltime) / TICRATE) % 60); } - I_Printf(VB_INFO, "%d:%05.2f", leveltime / TICRATE / 60, + I_Printf(VB_DEBUG, "%d:%05.2f", leveltime / TICRATE / 60, (float)(leveltime % (60 * TICRATE)) / TICRATE); } @@ -2804,7 +2804,7 @@ static void G_DoLoadGame(void) if (DoLoadGame(false)) { const int slot_num = 10 * savepage + savegameslot; - I_Printf(VB_INFO, "G_DoLoadGame: Slot %02d, Time ", slot_num); + I_Printf(VB_DEBUG, "G_DoLoadGame: Slot %02d, Time ", slot_num); PrintLevelTimes(); MN_SetQuickSaveSlot(savegameslot); } @@ -2814,7 +2814,7 @@ static void G_DoLoadAutoSave(void) { if (DoLoadGame(true)) { - I_Printf(VB_INFO, "G_DoLoadGame: Auto Save, Time "); + I_Printf(VB_DEBUG, "G_DoLoadGame: Auto Save, Time "); PrintLevelTimes(); } } diff --git a/src/i_flmusic.c b/src/i_flmusic.c index 37d23788..276c16cf 100644 --- a/src/i_flmusic.c +++ b/src/i_flmusic.c @@ -317,6 +317,8 @@ static boolean I_FL_InitStream(int device) return true; } +static const char *music_format = "Unknown"; + static boolean I_FL_OpenStream(void *data, ALsizei size, ALenum *format, ALsizei *freq, ALsizei *frame_size) { @@ -344,6 +346,7 @@ static boolean I_FL_OpenStream(void *data, ALsizei size, ALenum *format, if (IsMid(data, size)) { result = fluid_player_add_mem(player, data, size); + music_format = "MIDI (FluidSynth)"; } else { @@ -364,6 +367,7 @@ static boolean I_FL_OpenStream(void *data, ALsizei size, ALenum *format, mem_fclose(instream); mem_fclose(outstream); + music_format = "MUS (FluidSynth)"; } if (result != FLUID_OK) @@ -481,6 +485,11 @@ static void I_FL_BindVariables(void) BIND_BOOL_MIDI(mus_reverb, false, "FluidSynth reverb"); } +static const char *I_FL_MusicFormat(void) +{ + return music_format; +} + stream_module_t stream_fl_module = { I_FL_InitStream, @@ -491,4 +500,5 @@ stream_module_t stream_fl_module = I_FL_ShutdownStream, I_FL_DeviceList, I_FL_BindVariables, + I_FL_MusicFormat, }; diff --git a/src/i_midimusic.c b/src/i_midimusic.c index 629edb99..7f0a7ae9 100644 --- a/src/i_midimusic.c +++ b/src/i_midimusic.c @@ -1412,6 +1412,8 @@ static void I_MID_ResumeSong(void *handle) SDL_UnlockMutex(music_lock); } +static const char *music_format = "Unknown"; + static void *I_MID_RegisterSong(void *data, int len) { if (!music_initialized) @@ -1419,7 +1421,15 @@ static void *I_MID_RegisterSong(void *data, int len) return NULL; } - if (!IsMid(data, len) && !IsMus(data, len)) + if (IsMid(data, len)) + { + music_format = "MIDI (Native)"; + } + else if (IsMus(data, len)) + { + music_format = "MUS (Native)"; + } + else { return NULL; } @@ -1493,6 +1503,11 @@ static midiplayertype_t I_MID_MidiPlayerType(void) return midiplayer_native; } +static const char *I_MID_MusicFormat(void) +{ + return music_format; +} + static void I_MID_BindVariables(void) { BIND_NUM_MIDI(midi_complevel, COMP_STANDARD, 0, COMP_NUM - 1, @@ -1520,4 +1535,5 @@ music_module_t music_mid_module = I_MID_DeviceList, I_MID_BindVariables, I_MID_MidiPlayerType, + I_MID_MusicFormat, }; diff --git a/src/i_oalmusic.c b/src/i_oalmusic.c index 1c848c24..a52548f8 100644 --- a/src/i_oalmusic.c +++ b/src/i_oalmusic.c @@ -486,6 +486,15 @@ static void I_OAL_BindVariables(void) } } +static const char *I_OAL_MusicFormat(void) +{ + if (active_module) + { + return active_module->I_MusicFormat(); + } + return "None"; +} + music_module_t music_oal_module = { I_OAL_InitMusic, @@ -500,4 +509,5 @@ music_module_t music_oal_module = I_OAL_DeviceList, I_OAL_BindVariables, I_OAL_MidiPlayerType, + I_OAL_MusicFormat, }; diff --git a/src/i_oalstream.h b/src/i_oalstream.h index 4e3d9a59..07204ce4 100644 --- a/src/i_oalstream.h +++ b/src/i_oalstream.h @@ -32,6 +32,7 @@ typedef struct void (*I_ShutdownStream)(void); const char **(*I_DeviceList)(void); void (*BindVariables)(void); + const char *(*I_MusicFormat)(void); } stream_module_t; extern stream_module_t stream_opl_module; diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c index 880d9926..65d616e8 100644 --- a/src/i_oplmusic.c +++ b/src/i_oplmusic.c @@ -1517,6 +1517,8 @@ static boolean I_OPL_InitStream(int device) static midi_file_t *midifile; +static const char *music_format = "Unknown"; + static boolean I_OPL_OpenStream(void *data, ALsizei size, ALenum *format, ALsizei *freq, ALsizei *frame_size) { @@ -1534,6 +1536,7 @@ static boolean I_OPL_OpenStream(void *data, ALsizei size, ALenum *format, if (IsMid(data, size) /* && size < MAXMIDLENGTH */) { midifile = MIDI_LoadFile(data, size); + music_format = "MIDI (OPL)"; } else { @@ -1558,6 +1561,7 @@ static boolean I_OPL_OpenStream(void *data, ALsizei size, ALenum *format, mem_fclose(instream); mem_fclose(outstream); + music_format = "MUS (OPL)"; } if (midifile == NULL) @@ -1685,6 +1689,11 @@ static const char **I_OPL_DeviceList(void) return devices; } +static const char *I_OPL_MusicFormat(void) +{ + return music_format; +} + static void I_OPL_BindVariables(void) { BIND_NUM_MIDI(num_opl_chips, 1, 1, OPL_MAX_CHIPS, @@ -1703,4 +1712,5 @@ stream_module_t stream_opl_module = I_OPL_ShutdownStream, I_OPL_DeviceList, I_OPL_BindVariables, + I_OPL_MusicFormat, }; diff --git a/src/i_printf.h b/src/i_printf.h index dd1f85a3..cb91c69a 100644 --- a/src/i_printf.h +++ b/src/i_printf.h @@ -19,6 +19,7 @@ #define __I_PRINT__ #include "doomtype.h" +#include "d_event.h" typedef enum { @@ -30,6 +31,8 @@ typedef enum VB_MAX } verbosity_t; +#define VB_DEMO (gameaction == ga_playdemo ? VB_INFO : VB_DEBUG) + int I_ConsoleStdout(void); void I_InitPrintf(void); diff --git a/src/i_sndfile.c b/src/i_sndfile.c index 5c8ddad8..8fb69d86 100644 --- a/src/i_sndfile.c +++ b/src/i_sndfile.c @@ -738,6 +738,28 @@ static void I_SND_BindVariables(void) ; } +static const char *I_SND_MusicFormat(void) +{ + static SF_FORMAT_INFO format_info; + + int count; + sf_command(NULL, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof(count)); + + for (int i = 0; i < count; i++) + { + format_info.format = i; + sf_command(NULL, SFC_GET_SIMPLE_FORMAT, &format_info, + sizeof(format_info)); + if (format_info.format == stream.sfinfo.format) + { + return format_info.name; + break; + } + } + + return "Unknown"; +} + stream_module_t stream_snd_module = { I_SND_InitStream, @@ -748,4 +770,5 @@ stream_module_t stream_snd_module = I_SND_ShutdownStream, I_SND_DeviceList, I_SND_BindVariables, + I_SND_MusicFormat, }; diff --git a/src/i_sound.c b/src/i_sound.c index b99359a9..5cfac311 100644 --- a/src/i_sound.c +++ b/src/i_sound.c @@ -726,6 +726,15 @@ const char **I_DeviceList(void) return devices; } +const char *I_MusicFormat(void) +{ + if (active_module) + { + return active_module->I_MusicFormat(); + } + return "Unknown"; +} + void I_BindSoundVariables(void) { M_BindNum("sfx_volume", &snd_SfxVolume, NULL, 8, 0, 15, ss_none, wad_no, diff --git a/src/i_sound.h b/src/i_sound.h index 49e92b7f..b1de0da5 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -167,6 +167,7 @@ typedef struct const char **(*I_DeviceList)(void); void (*I_BindVariables)(void); midiplayertype_t (*I_MidiPlayerType)(void); + const char *(*I_MusicFormat)(void); } music_module_t; extern music_module_t music_oal_module; @@ -207,6 +208,8 @@ boolean IsMid(byte *mem, int len); // Determine whether memory block is a .mus file boolean IsMus(byte *mem, int len); +const char *I_MusicFormat(void); + void I_BindSoundVariables(void); #endif diff --git a/src/i_xmp.c b/src/i_xmp.c index d6eddd37..199bbe9a 100644 --- a/src/i_xmp.c +++ b/src/i_xmp.c @@ -155,6 +155,18 @@ static void I_XMP_BindVariables(void) ; } +static const char *I_XMP_MusicFormat(void) +{ + if (!context) + { + return "Unknown"; + } + + static struct xmp_module_info info; + xmp_get_module_info(context, &info); + return info.mod->type; +} + stream_module_t stream_xmp_module = { I_XMP_InitStream, @@ -165,4 +177,5 @@ stream_module_t stream_xmp_module = I_XMP_ShutdownStream, I_XMP_DeviceList, I_XMP_BindVariables, + I_XMP_MusicFormat, }; diff --git a/src/p_setup.c b/src/p_setup.c index 32210116..4ebee1b5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1704,7 +1704,7 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill) R_PrecacheLevel(); // [FG] log level setup - I_Printf(VB_INFO, "P_SetupLevel: %.8s (%s), Skill %d, %s%s%s, %s", + I_Printf(VB_DEMO, "P_SetupLevel: %.8s (%s), Skill %d, %s%s%s, %s", lumpname, W_WadNameForLump(lumpnum), gameskill + 1, mapformat >= MFMT_UNSUPPORTED ? "NanoBSP" : diff --git a/src/s_sound.c b/src/s_sound.c index 81cc4269..69e0cf42 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -682,8 +682,10 @@ void S_ChangeMusic(int musicnum, int looping) I_PlaySong((void *)music->handle, looping); // [crispy] log played music - I_Printf(VB_INFO, "S_ChangeMusic: %.8s (%s)", lumpinfo[music->lumpnum].name, - W_WadNameForLump(music->lumpnum)); + I_Printf(VB_DEBUG, "S_ChangeMusic: %.8s (%s), %s", + lumpinfo[music->lumpnum].name, + W_WadNameForLump(music->lumpnum), + I_MusicFormat()); mus_playing = music; @@ -729,8 +731,10 @@ void S_ChangeMusInfoMusic(int lumpnum, int looping) I_PlaySong((void *)music->handle, looping); // [crispy] log played music - I_Printf(VB_INFO, "S_ChangeMusInfoMusic: %.8s (%s)", - lumpinfo[music->lumpnum].name, W_WadNameForLump(music->lumpnum)); + I_Printf(VB_DEBUG, "S_ChangeMusInfoMusic: %.8s (%s), %s", + lumpinfo[music->lumpnum].name, + W_WadNameForLump(music->lumpnum), + I_MusicFormat()); mus_playing = music;