foxygit / doom Log in
commit 4cc346a039467562339afbb22d70af13a9db4083
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Tue Mar 21 12:56:34 2023 -0400
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Tue Mar 21 13:59:23 2023 -0400

    Add separate errors for MUS and MIDI
---
 src/i_flmusic.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/i_flmusic.c b/src/i_flmusic.c
index 4058497c..ee89380d 100644
--- a/src/i_flmusic.c
+++ b/src/i_flmusic.c
@@ -186,6 +186,13 @@ static void *I_FL_RegisterSong(void *data, int len)
     if (IsMid(data, len))
     {
         result = fluid_player_add_mem(player, data, len);
+
+        if (result == FLUID_FAILED)
+        {
+            fprintf(stderr,
+                    "I_FL_RegisterSong: FluidSynth failed to load MIDI.\n");
+            return NULL;
+        }
     }
     else
     {
@@ -206,12 +213,13 @@ static void *I_FL_RegisterSong(void *data, int len)

         mem_fclose(instream);
         mem_fclose(outstream);
-    }

-    if (result != FLUID_OK)
-    {
-        fprintf(stderr, "I_FL_RegisterSong: FluidSynth failed to load song.\n");
-        return NULL;
+        if (result == FLUID_FAILED)
+        {
+            fprintf(stderr,
+                    "I_FL_RegisterSong: FluidSynth failed to load MUS.\n");
+            return NULL;
+        }
     }

     Mix_HookMusic(FL_Mix_Callback, NULL);