snd_mix.c: General whitespace and formatting tidy up.

(DWORD): Deleted macro.
(S_TransferStereo16): Removed unnecessary pbuf pointer and used shm-> buffer
directly.
(S_TransferPaintBuffer): Removed unnecessary pbuf pointer and used shm-> buffer
directly. Removed the shadowing instance of snd_vol and used the global var.
(S_PaintChannels): Replaced Q_memset with memset.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@179 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-06-03 16:28:30 +00:00
parent b2b771b19f
commit a68e196950

View file

@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#define DWORD unsigned long
#define PAINTBUFFER_SIZE 512
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
int snd_scaletable[32][256];
@ -62,20 +60,18 @@ void S_TransferStereo16 (int endtime)
{
int lpos;
int lpaintedtime;
DWORD *pbuf;
snd_vol = volume.value * 256;
snd_p = (int *) paintbuffer;
lpaintedtime = paintedtime;
pbuf = (DWORD *)shm->buffer;
while (lpaintedtime < endtime)
{
// handle recirculating buffer issues
lpos = lpaintedtime & ((shm->samples >> 1) - 1);
snd_out = (short *) pbuf + (lpos<<1);
snd_out = (short *)shm->buffer + (lpos << 1);
snd_linear_count = (shm->samples >> 1) - lpos;
if (lpaintedtime + snd_linear_count > endtime)
@ -93,14 +89,9 @@ void S_TransferStereo16 (int endtime)
void S_TransferPaintBuffer(int endtime)
{
int out_idx;
int count;
int out_mask;
int out_idx, out_mask;
int count, step, val;
int *p;
int step;
int val;
int snd_vol;
DWORD *pbuf;
if (shm->samplebits == 16 && shm->channels == 2)
{
@ -114,11 +105,10 @@ void S_TransferPaintBuffer(int endtime)
out_idx = paintedtime * shm->channels & out_mask;
step = 3 - shm->channels;
snd_vol = volume.value * 256;
pbuf = (DWORD *)shm->buffer;
if (shm->samplebits == 16)
{
short *out = (short *) pbuf;
short *out = (short *)shm->buffer;
while (count--)
{
val = (*p * snd_vol) >> 8;
@ -133,7 +123,7 @@ void S_TransferPaintBuffer(int endtime)
}
else if (shm->samplebits == 8)
{
unsigned char *out = (unsigned char *) pbuf;
unsigned char *out = shm->buffer;
while (count--)
{
val = (*p * snd_vol) >> 8;
@ -163,10 +153,9 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime);
void S_PaintChannels (int endtime)
{
int i;
int end;
int end, ltime, count;
channel_t *ch;
sfxcache_t *sc;
int ltime, count;
while (paintedtime < endtime)
{
@ -176,7 +165,7 @@ void S_PaintChannels(int endtime)
end = paintedtime + PAINTBUFFER_SIZE;
// clear the paint buffer
Q_memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
// paint in the channels.
ch = channels;
@ -224,7 +213,6 @@ void S_PaintChannels(int endtime)
}
}
}
}
// transfer out according to DMA format