]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
disabled memory clumping, which surprisingly improves memory use, rather than hinders...
[xonotic/darkplaces.git] / snd_mix.c
index d4dadbae3f84b654bfa1a2e59a6f14c4a9a3bcc3..cb47d1bf2262aad832826a33eccf12f5fe870364 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #endif
 
 // LordHavoc: was 512, expanded to 2048
-#define        PAINTBUFFER_SIZE        2048
+#define        PAINTBUFFER_SIZE 2048
 portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
-int            snd_scaletable[32][256];
+int snd_scaletable[32][256];
 
 /*
 // LordHavoc: disabled this because it desyncs with the video too easily
@@ -267,11 +267,11 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime);
 
 void S_PaintChannels(int endtime)
 {
-       int     i;
-       int     end;
+       int i;
+       int end;
        channel_t *ch;
-       sfxcache_t      *sc;
-       int             ltime, count;
+       sfxcache_t *sc;
+       int ltime, count;
 
        while (paintedtime < endtime)
        {
@@ -280,8 +280,8 @@ void S_PaintChannels(int endtime)
                if (endtime - paintedtime > PAINTBUFFER_SIZE)
                        end = paintedtime + PAINTBUFFER_SIZE;
 
-               // clear the paint buffer
-               memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
+               // clear the paint buffer, filling it with data from rawsamples (music/video/whatever)
+               S_RawSamples_Dequeue(&paintbuffer->left, end - paintedtime);
 
                // paint in the channels.
                ch = channels;
@@ -331,7 +331,6 @@ void S_PaintChannels(int endtime)
                                        }
                                }
                        }
-
                }
 
                // transfer out according to DMA format
@@ -343,19 +342,19 @@ void S_PaintChannels(int endtime)
 
 void SND_InitScaletable (void)
 {
-       int             i, j;
+       int i, j;
 
-       for (i=0 ; i<32 ; i++)
-               for (j=0 ; j<256 ; j++)
+       for (i = 0;i < 32;i++)
+               for (j = 0;j < 256;j++)
                        snd_scaletable[i][j] = ((signed char)j) * i * 8;
 }
 
 
 void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
 {
-       int             *lscale, *rscale;
+       int *lscale, *rscale;
        unsigned char *sfx;
-       int             i;
+       int i;
 
        if (ch->leftvol > 255)
                ch->leftvol = 255;
@@ -394,7 +393,7 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
 {
        int leftvol, rightvol;
        signed short *sfx;
-       int     i;
+       int i;
 
        leftvol = ch->leftvol;
        rightvol = ch->rightvol;