shithub: choc

Download patch

ref: 42fa6a211c6820004e4530b67f728729a1216e28
parent: 725c9b8ab73131f2d8a527e90ebc2938b6093948
author: ceski <56656010+ceski-1@users.noreply.github.com>
date: Wed Dec 14 06:39:11 EST 2022

win midi: Reduce messages sent on startup/reset (#1559)

* Update reverb and chorus defaults

* Don't send volume twice on startup

--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -122,6 +122,7 @@
     unsigned int elapsed_time;
     unsigned int saved_elapsed_time;
     unsigned int num_tracks;
+    boolean registered;
     boolean looping;
     boolean ff_loop;
     boolean ff_restart;
@@ -1226,7 +1227,7 @@
 
     volume_factor = sqrtf((float)volume / 120);
 
-    update_volume = true;
+    update_volume = song.registered;
 }
 
 static void I_WIN_StopSong(void)
@@ -1392,6 +1393,7 @@
     {
         song.tracks[i].iter = MIDI_IterateTrack(file, i);
     }
+    song.registered = true;
 
     ResetEvent(hBufferReturnEvent);
     ResetEvent(hExitEvent);
@@ -1419,6 +1421,7 @@
     song.elapsed_time = 0;
     song.saved_elapsed_time = 0;
     song.num_tracks = 0;
+    song.registered = false;
     song.looping = false;
     song.ff_loop = false;
     song.ff_restart = false;
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -82,8 +82,8 @@
 static int midi_num_devices;
 static int midi_index;
 char *winmm_midi_device = NULL;
-int winmm_reverb_level = 40;
-int winmm_chorus_level = 0;
+int winmm_reverb_level = -1;
+int winmm_chorus_level = -1;
 #endif
 
 // DOS specific variables: these are unused but should be maintained