From fd6a856ae17fe105330c125f924b8d007cdd509e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 8 May 2007 09:33:24 +0000 Subject: [PATCH] clean out some old debug code that's confusing me --- libs/audio/renderer/snd_channels.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 7b6be1c80..dc24a0fe5 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -330,27 +330,34 @@ static channel_t * s_pick_channel (int entnum, int entchannel, int looped) { channel_t *ch, **_ch; - int count; // check for finished non-looped sounds - for (count = 0, _ch = &dynamic_channels; *_ch; ) { + for (_ch = &dynamic_channels; *_ch; ) { + if (!(*_ch)->sfx || (*_ch)->done) { + SND_ChannelStop (unlink_channel (_ch)); + continue; + } + _ch = &(*_ch)->next; + } + // check for finished looped sounds + // normally, this wouldn't happen, but when using the non-threaded mixer + // it seems to + for (_ch = &looped_dynamic_channels; *_ch; ) { if (!(*_ch)->sfx || (*_ch)->done) { SND_ChannelStop (unlink_channel (_ch)); continue; } _ch = &(*_ch)->next; - count++; } // non-looped sounds are used to stop looped sounds on an ent channel - for (count = 0, _ch = &looped_dynamic_channels; *_ch; ) { + for (_ch = &looped_dynamic_channels; *_ch; ) { if ((*_ch)->entnum == entnum && ((*_ch)->entchannel == entchannel || entchannel == -1)) { SND_ChannelStop (unlink_channel (_ch)); continue; } _ch = &(*_ch)->next; - count++; } _ch = looped ? &looped_dynamic_channels : &dynamic_channels; if ((ch = SND_AllocChannel ())) {