shithub: choc

Download patch

ref: ad116c05d87fe788cd459df2b1c229bfcf6928a4
parent: bf67262a1fa5a49fbf384a2c08f74d930080308b
author: Jonathan Dowland <jon+github@alcopop.org>
date: Fri Jun 26 03:26:37 EDT 2015

Switch channels_playing to track allocated_sound_t

channels_playing is an internal array in i_sdlsound which
used to track sfxinfo_t. The callers often had to look up
the allocated_sound_t from the sfxinfo_t. Track the
allocated_sound_t instead.

--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -59,7 +59,7 @@
 
 static boolean sound_initialized = false;
 
-static sfxinfo_t *channels_playing[NUM_CHANNELS];
+static allocated_sound_t *channels_playing[NUM_CHANNELS];
 
 static int mixer_freq;
 static Uint16 mixer_format;
@@ -285,9 +285,9 @@
 
 static void ReleaseSoundOnChannel(int channel)
 {
-    sfxinfo_t *sfxinfo = channels_playing[channel];
+    allocated_sound_t *snd = channels_playing[channel];
 
-    if (sfxinfo == NULL)
+    if (snd == NULL)
     {
         return;
     }
@@ -294,7 +294,7 @@
 
     channels_playing[channel] = NULL;
 
-    UnlockAllocatedSound(sfxinfo->driver_data);
+    UnlockAllocatedSound(snd);
 }
 
 #ifdef HAVE_LIBSAMPLERATE
@@ -885,7 +885,7 @@
 
     Mix_PlayChannel(channel, &snd->chunk, 0);
 
-    channels_playing[channel] = sfxinfo;
+    channels_playing[channel] = snd;
 
     // set separation, etc.