VOGONS


First post, by cyberwalker

User metadata
Rank Newbie
Rank
Newbie

Here is the code from sblaster.c:
case DSP_DMA_16_ALIASED:
if (sb.dma.stereo)
{
sb.chan->AddSamples_s16(read>>2,sb.dma.buf.b16);
} else {
sb.chan->AddSamples_m16(read>>1,sb.dma.buf.b16);
}
break;

Last edited by cyberwalker on 2005-06-26, 03:25. Edited 1 time in total.

Reply 3 of 4, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Not necessarily, especially since I don't think it compiles with -Wall by default. Here's some more info from the latest CVS:

sblaster.c line 344:

static void GenerateDMASound(Bitu size) {
Bitu read;Bitu done=0;Bitu i=0;
if (sb.dma.left<=sb.dma.min) {
size=sb.dma.left;
}
switch (sb.dma.mode) {

The code cyberwalker posted is inside that switch block. Also, in case anyone suggests that maybe a reference or pointer is being passed, here is the function prototype for AddSamples_s16:

./hardware/mixer.cpp:void MixerChannel::AddSamples_s16(Bitu len,Bit16s * data) {

Finally, I don't know how Bitu is defined for all platforms, but a grep shows the following for MSVC++:

./platform/visualc/config.h:typedef unsigned int                Bitu;

Translation: I think cyberwalker is correct.

Reply 4 of 4, by Srecko

User metadata
Rank Member
Rank
Member

Function should initialise "read" variable by calling
read=sb.dma.chan->Read(... );
Obviously, that part is missing in case of DSP_DMA_16_ALIASED.
Certainly a bug (because "read" is local non-static variable).