shithub: zelda3

Download patch

ref: 01c9115aebef9d1b08a307cdc309368e315f2e74
parent: 093ab2c4c0a3eab435f3d366d24cedc2e95022c2
author: Snesrev <[email protected]>
date: Mon Oct 3 12:58:10 EDT 2022

Improve performance when SDL volume is set to max
 - And remove another #if

--- a/main.c
+++ b/main.c
@@ -181,13 +181,12 @@
       g_audiobuffer_end = g_audiobuffer + g_frames_per_block * g_audio_channels * sizeof(int16);
     }
     int n = IntMin(len, g_audiobuffer_end - g_audiobuffer_cur);
-#if SYSTEM_VOLUME_MIXER_AVAILABLE
-    memcpy(stream, g_audiobuffer_cur, n);
-#else
-    // Ensure destination audio stream is empty/silence.
-    SDL_memset(stream, 0, n);
-    SDL_MixAudioFormat(stream, g_audiobuffer_cur, AUDIO_S16, n, g_sdl_audio_mixer_volume);
-#endif
+    if (g_sdl_audio_mixer_volume == SDL_MIX_MAXVOLUME) {
+      memcpy(stream, g_audiobuffer_cur, n);
+    } else {
+      SDL_memset(stream, 0, n);
+      SDL_MixAudioFormat(stream, g_audiobuffer_cur, AUDIO_S16, n, g_sdl_audio_mixer_volume);
+    }
     g_audiobuffer_cur += n;
     stream += n;
     len -= n;