]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
eliminated qbyte type, now uses unsigned char throughout the engine for this purpose
[xonotic/darkplaces.git] / snd_mix.c
index 2f1a7d43d200c9d3e70464edbd3096c844993915..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,12 +34,12 @@ 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
@@ -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;