From 6678e67f054fc70f9df7835692b9820d14b73043 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 25 Mar 2007 01:02:03 +0000 Subject: [PATCH] clamp the default renderer to 44100 too, and spew messages when running out of channels. --- libs/audio/renderer/snd_channels.c | 10 +++++++--- libs/audio/renderer/snd_dma.c | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 0a7803577..b5207541e 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -81,8 +81,6 @@ SND_AllocChannel (void) channel_t **free = &free_channels; channel_t *chan; - if (!*free) // definitely nothing free - return 0; while (*free) { if (!(*free)->sfx) // free channel break; @@ -92,8 +90,14 @@ SND_AllocChannel (void) Sys_Error ("SND_AllocChannel: bogus channel free list"); free = &(*free)->next; } - if (!*free) + if (!*free) { + int num_free = 0; + for (free = &free_channels; *free; free = &(*free)->next) { + num_free++; + } + Sys_Printf ("SND_AllocChannel: out of channels. %d\n", num_free); return 0; + } chan = *free; *free = chan->next; if (chan->sfx) { diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index 39903916f..f282f10bd 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -351,6 +351,10 @@ s_startup (void) return; } snd_shm->xfer = s_xfer_paint_buffer; + if (snd_shm->speed > 44100) { + Sys_Printf ("FIXME clamping Sps to 44100 until resampling is fixed\n"); + snd_shm->speed = 44100; + } sound_started = 1; }