]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
expire internal DNS name cache entries after 5 minutes (this way a master server...
[xonotic/darkplaces.git] / snd_mix.c
index 319eebeb5ef4c70e2dc2ffea7b6ad12fa7a2eafc..d2329f408692676b5b5d17bed75e7aad239ef900 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "quakedef.h"
 #include "snd_main.h"
 
-typedef struct
+typedef struct portable_samplepair_s
 {
        int left;
        int right;
@@ -34,22 +34,22 @@ portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
 
 // FIXME: this desyncs with the video too easily
 extern qboolean cl_capturevideo_active;
-extern void SCR_CaptureVideo_SoundFrame(qbyte *bufstereo16le, size_t length, int rate);
+extern void SCR_CaptureVideo_SoundFrame(unsigned char *bufstereo16le, size_t length, int rate);
 void S_CaptureAVISound(portable_samplepair_t *buf, size_t length)
 {
        int n;
        size_t i;
-       qbyte out[PAINTBUFFER_SIZE * 4];
+       unsigned char out[PAINTBUFFER_SIZE * 4];
        if (!cl_capturevideo_active)
                return;
        // write the sound buffer as little endian 16bit interleaved stereo
        for(i = 0;i < length;i++)
        {
-               n = buf[i].left >> 2; // quiet enough to prevent clipping most of the time
+               n = buf[i].left;
                n = bound(-32768, n, 32767);
                out[i*4+0] = n & 0xFF;
                out[i*4+1] = (n >> 8) & 0xFF;
-               n = buf[i].right >> 2; // quiet enough to prevent clipping most of the time
+               n = buf[i].right;
                n = bound(-32768, n, 32767);
                out[i*4+2] = n & 0xFF;
                out[i*4+3] = (n >> 8) & 0xFF;
@@ -238,9 +238,7 @@ void S_PaintChannels(int endtime)
                        // if the channel is paused
                        if (ch->flags & CHANNELFLAG_PAUSED)
                        {
-                               size_t pausedtime;
-
-                               pausedtime = end - paintedtime;
+                               int pausedtime = end - paintedtime;
                                ch->lastptime += pausedtime;
                                ch->end += pausedtime;
                                continue;
@@ -279,7 +277,7 @@ void S_PaintChannels(int endtime)
 
                                // paint up to end
                                if (ch->end < end)
-                                       count = ch->end - ltime;
+                                       count = (int)ch->end - ltime;
                                else
                                        count = end - ltime;
 
@@ -357,7 +355,7 @@ qboolean SND_PaintChannelFrom8 (channel_t *ch, int count)
        // Stereo sound support
        if (ch->sfx->format.channels == 2)
        {
-               sfx = sb->data + (ch->pos - sb->offset) * 2;
+               sfx = (signed char *)sb->data + (ch->pos - sb->offset) * 2;
                for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += (*sfx++ * leftvol) >> 8;
@@ -366,13 +364,12 @@ qboolean SND_PaintChannelFrom8 (channel_t *ch, int count)
        }
        else
        {
-               sfx = sb->data + ch->pos - sb->offset;
+               sfx = (signed char *)sb->data + ch->pos - sb->offset;
                for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += (*sfx * leftvol) >> 8;
                        paintbuffer[i].right += (*sfx++ * rightvol) >> 8;
                }
-
        }
        ch->pos += count;
        return true;