foxygit / doom Log in
commit ad116c05d87fe788cd459df2b1c229bfcf6928a4
Author:     Jonathan Dowland <jon+github@alcopop.org>
AuthorDate: Fri Jun 26 07:26:37 2015 +0100
Commit:     Jonathan Dowland <jon+github@alcopop.org>
CommitDate: Mon Jul 6 20:00:47 2015 +0100

    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.
---
 src/i_sdlsound.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index 105ae64c..f9188b2c 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -59,7 +59,7 @@ static boolean setpanning_workaround = false;

 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,16 +285,16 @@ static void UnlockAllocatedSound(allocated_sound_t *snd)

 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;
     }

     channels_playing[channel] = NULL;

-    UnlockAllocatedSound(sfxinfo->driver_data);
+    UnlockAllocatedSound(snd);
 }

 #ifdef HAVE_LIBSAMPLERATE
@@ -885,7 +885,7 @@ static int I_SDL_StartSound(sfxinfo_t *sfxinfo, int channel, int vol, int sep, i

     Mix_PlayChannel(channel, &snd->chunk, 0);

-    channels_playing[channel] = sfxinfo;
+    channels_playing[channel] = snd;

     // set separation, etc.