From 4449f10c0a517be9401ab0f85e8c85e358e166e0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 15 Aug 2010 05:15:47 +0000 Subject: [PATCH] get alsa and sdl working, though sdl seems to be mono only --- libs/audio/renderer/snd_dma.c | 4 ++-- libs/audio/targets/snd_alsa.c | 2 +- libs/audio/targets/snd_oss.c | 2 +- libs/audio/testsound.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index f339db73c..77caad8e6 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -81,8 +81,8 @@ s_xfer_paint_buffer (int endtime) p = (float *) snd_paintbuffer; count = (endtime - snd_paintedtime) * snd_shm->channels; - out_mask = snd_shm->frames - 1; - out_idx = snd_paintedtime * snd_shm->channels & out_mask; + out_mask = (snd_shm->frames * snd_shm->channels) - 1; + out_idx = (snd_paintedtime * snd_shm->channels) & out_mask; step = 3 - snd_shm->channels; snd_vol = snd_volume->value; diff --git a/libs/audio/targets/snd_alsa.c b/libs/audio/targets/snd_alsa.c index a4e0f9362..51bf65efd 100644 --- a/libs/audio/targets/snd_alsa.c +++ b/libs/audio/targets/snd_alsa.c @@ -405,7 +405,7 @@ SNDDMA_Submit (void) if (snd_blocked) return; - nframes = count / sn.channels; + nframes = count; qfsnd_pcm_avail_update (pcm); qfsnd_pcm_mmap_begin (pcm, &areas, &offset, &nframes); diff --git a/libs/audio/targets/snd_oss.c b/libs/audio/targets/snd_oss.c index 6f21b03e8..d4c2dbfe6 100644 --- a/libs/audio/targets/snd_oss.c +++ b/libs/audio/targets/snd_oss.c @@ -326,7 +326,7 @@ SNDDMA_GetDMAPos (void) } // sn.samplepos = (count.bytes / (sn.samplebits / 8)) & (sn.samples-1); // fprintf(stderr, "%d \r", count.ptr); - sn.framepos = count.ptr / (sn.samplebits / 8) / sn.channels; //XXX??? + sn.framepos = count.ptr / (sn.samplebits / 8); return sn.framepos; diff --git a/libs/audio/testsound.c b/libs/audio/testsound.c index c3b951c7b..007b204e2 100644 --- a/libs/audio/testsound.c +++ b/libs/audio/testsound.c @@ -109,11 +109,11 @@ main (int argc, const char *argv[]) COM_InitArgv (argc, argv); init (); Cbuf_Execute_Stack (testsound_cbuf); -// while (1) { + while (1) { Cbuf_Execute_Stack (testsound_cbuf); S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin); - sleep(100); -// } + usleep(20 * 1000); + } Sys_Quit (); }