mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
Fix some undefined symbols in snd_alsa.c.
Serves me right for testing with only my debug build :P
This commit is contained in:
parent
6f4d918c66
commit
881d4babce
8 changed files with 33 additions and 33 deletions
|
@ -78,9 +78,12 @@ struct dma_s {
|
|||
int framepos; //!< position of dma cursor
|
||||
unsigned char *buffer; //!< destination for mixed sound
|
||||
/** Transfer mixed samples to the output.
|
||||
\param endtime sample end time (count = endtime - snd_paintedtime)
|
||||
\param paintbuffer The buffer of mixed samples to be transferred.
|
||||
\param count The number of sample to transfer.
|
||||
\param volume The gain for the samples.
|
||||
*/
|
||||
void (*xfer) (int endtime);
|
||||
void (*xfer) (portable_samplepair_t *paintbuffer, int count,
|
||||
float volume);
|
||||
/** Optional data for the xfer function.
|
||||
*/
|
||||
void *xfer_data;
|
||||
|
|
|
@ -73,26 +73,25 @@ static general_data_t plugin_info_general_data;
|
|||
static snd_output_funcs_t *snd_output_funcs;
|
||||
|
||||
static void
|
||||
s_xfer_paint_buffer (int endtime)
|
||||
s_xfer_paint_buffer (portable_samplepair_t *paintbuffer, int count,
|
||||
float volume)
|
||||
{
|
||||
int count, out_idx, out_max, step, val;
|
||||
float snd_vol;
|
||||
int out_idx, out_max, step, val;
|
||||
float *p;
|
||||
|
||||
p = (float *) snd_paintbuffer;
|
||||
count = (endtime - snd_paintedtime) * snd_shm->channels;
|
||||
p = (float *) paintbuffer;
|
||||
count *= snd_shm->channels;
|
||||
out_max = (snd_shm->frames * snd_shm->channels) - 1;
|
||||
out_idx = snd_paintedtime * snd_shm->channels;
|
||||
out_idx = snd_shm->framepos * snd_shm->channels;
|
||||
while (out_idx > out_max)
|
||||
out_idx -= out_max + 1;
|
||||
step = 3 - snd_shm->channels;
|
||||
snd_vol = snd_volume->value;
|
||||
|
||||
if (snd_shm->samplebits == 16) {
|
||||
short *out = (short *) snd_shm->buffer;
|
||||
|
||||
while (count--) {
|
||||
val = (*p * snd_vol) * 0x8000;
|
||||
val = (*p * volume) * 0x8000;
|
||||
p += step;
|
||||
if (val > 0x7fff)
|
||||
val = 0x7fff;
|
||||
|
@ -106,7 +105,7 @@ s_xfer_paint_buffer (int endtime)
|
|||
unsigned char *out = (unsigned char *) snd_shm->buffer;
|
||||
|
||||
while (count--) {
|
||||
val = (*p * snd_vol) * 128;
|
||||
val = (*p * volume) * 128;
|
||||
p += step;
|
||||
if (val > 0x7f)
|
||||
val = 0x7f;
|
||||
|
|
|
@ -258,13 +258,10 @@ s_channel_stop (channel_t *chan)
|
|||
}
|
||||
|
||||
static void
|
||||
snd_jack_xfer (int endtime)
|
||||
snd_jack_xfer (portable_samplepair_t *paintbuffer, int count, float volume)
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
float snd_vol = snd_volume->value;
|
||||
|
||||
count = endtime - snd_paintedtime;
|
||||
if (snd_blocked) {
|
||||
for (i = 0; i < count; i++) {
|
||||
*output[0]++ = 0;
|
||||
|
@ -274,8 +271,8 @@ snd_jack_xfer (int endtime)
|
|||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
/* max is +/- 1.0. need to implement clamping. */
|
||||
*output[0]++ = snd_vol * snd_paintbuffer[i].left;
|
||||
*output[1]++ = snd_vol * snd_paintbuffer[i].right;
|
||||
*output[0]++ = volume * snd_paintbuffer[i].left;
|
||||
*output[1]++ = volume * snd_paintbuffer[i].right;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,8 @@ SND_PaintChannels (unsigned endtime)
|
|||
}
|
||||
|
||||
// transfer out according to DMA format
|
||||
snd_shm->xfer (end);
|
||||
snd_shm->xfer (snd_paintbuffer, end - snd_paintedtime,
|
||||
snd_volume->value);
|
||||
|
||||
memmove (snd_paintbuffer, snd_paintbuffer + end - snd_paintedtime,
|
||||
max_overpaint * sizeof (snd_paintbuffer[0]));
|
||||
|
|
|
@ -140,22 +140,19 @@ clamp_8 (int val)
|
|||
}
|
||||
|
||||
static void
|
||||
SNDDMA_ni_xfer (int endtime)
|
||||
SNDDMA_ni_xfer (portable_samplepair_t *paintbuffer, int count, float volume)
|
||||
{
|
||||
const snd_pcm_channel_area_t *areas;
|
||||
int count, out_idx, out_max;
|
||||
float snd_vol;
|
||||
int out_idx, out_max;
|
||||
float *p;
|
||||
|
||||
areas = sn.xfer_data;
|
||||
|
||||
p = (float *) snd_paintbuffer;
|
||||
count = (endtime - snd_paintedtime);
|
||||
p = (float *) paintbuffer;
|
||||
out_max = sn.frames - 1;
|
||||
out_idx = sn.framepos;
|
||||
while (out_idx > out_max)
|
||||
out_idx -= out_max + 1;
|
||||
snd_vol = snd_volume->value;
|
||||
|
||||
if (sn.samplebits == 16) {
|
||||
short *out_0 = (short *) areas[0].addr;
|
||||
|
@ -163,14 +160,14 @@ SNDDMA_ni_xfer (int endtime)
|
|||
|
||||
if (sn.channels == 2) {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_16 ((*p++ * snd_vol) * 0x8000);
|
||||
out_1[out_idx] = clamp_16 ((*p++ * snd_vol) * 0x8000);
|
||||
out_0[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
out_1[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
} else {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_16 ((*p++ * snd_vol) * 0x8000);
|
||||
out_0[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
p++; // skip right channel
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
|
@ -182,14 +179,14 @@ SNDDMA_ni_xfer (int endtime)
|
|||
|
||||
if (sn.channels == 2) {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_8 ((*p++ * snd_vol) * 0x80);
|
||||
out_1[out_idx] = clamp_8 ((*p++ * snd_vol) * 0x80);
|
||||
out_0[out_idx] = clamp_8 ((*p++ * volume) * 0x80);
|
||||
out_1[out_idx] = clamp_8 ((*p++ * volume) * 0x80);
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
} else {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_8 ((*p++ * snd_vol) * 0x8000);
|
||||
out_0[out_idx] = clamp_8 ((*p++ * volume) * 0x8000);
|
||||
p++; // skip right channel
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
|
|
|
@ -406,8 +406,9 @@ SNDDMA_GetDMAPos (void)
|
|||
s /= sn.channels;
|
||||
|
||||
s %= sn.frames;
|
||||
sn.framepos = s;
|
||||
|
||||
return s;
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -171,7 +171,8 @@ SNDDMA_GetDMAPos (void)
|
|||
return (0);
|
||||
}
|
||||
|
||||
return ((info.play.samples * sn.channels) % sn.frames);
|
||||
sn.framepos = ((info.play.samples * sn.channels) % sn.frames);
|
||||
return sn.framepos;
|
||||
}
|
||||
#if 0
|
||||
static int
|
||||
|
|
|
@ -298,8 +298,9 @@ SNDDMA_GetDMAPos (void)
|
|||
s /= sn.channels;
|
||||
|
||||
s %= sn.frames;
|
||||
sn.framepos = s;
|
||||
|
||||
return s;
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue