BloodyCactus wrote:well the DSP just an 8051 MCU with some 4kb rom and tiny amount of ram.
older SB, the 8051 did all the dac/ram/dma, later some of it was offloaded more.
dsp command 0x4x (0x40,41,41,etc) set time constant writes directly to the 8051 timer. your answers probably lie in the 8051 datasheets. this is what triggers interupts to fire
For the original Sound Blaster and Sound Blaster Pro that's pretty obvious from the Time Constant command, sure. One of the graphs posted is taken from a Sound Blaster Pro. The graph is completely smooth through the test.
I'm not so sure the Sound Blaster 16 uses the same processor. Notice from the graph that whether you use DSP command 0x40 or DSP command 0x41, the sample rate is rounded to a nearest value on a linear scale. This seems to be true on all SB16 from the first non-PnP all the way up through the AWE64. Also audible during the test is that the SB16 DSP is using some sort of oversampling or lowpass filtering at low sample rates where prior versions either did not filter (SB 2.0 and earlier), or provided a fixed lowpass filter that you could switch on/off (SB Pro).
I think Creative used a completely different design in the SB16 that isn't a countdown timer at all but probably some kind of fixed point hardware interpolation that renders out at a fixed sample rate to the DAC. That might also explain why SB16 cards have that constant DSP "busy cycle" whether the card is in use or not, where prior cards only had a "busy cycle" when the DSP was playing/recording audio.
This rounding is most visible in the SB16 non-PnP DSP command 0x41 test (that took 2 hours to run BTW) where among the "jumps" caused by a DSP bug there is a visible linear stair-step all the way across the sample rate scale. It seems to be rounding to a multiple of about 188 to 200 (haven't checked yet).
The funny thing is that while SB16 cards round the sample rate like that, the Sound Blaster Live! emulation of the SB16 appears to neither round the sample rate nor limit it to traditional sample rate limits (though you can "hang" the emulated DSP if you specify too high a sample rate in high-speed DMA playback command).
I expect Sound Blaster clones to round the sample rate in some way because clones don't necessarily run at the same clock rate and they have to convert Creative's sense of time to their own. Some do it better than others. The Gallant SC-6600 clone I tested is pretty bizarre in it's own way, especially in the flawed way it caps the time constant to SB compatible rates (highspeed vs normal).
NOTE:
The "busy cycle" is when bit 7 of port 22Ch cycles on and off on it's own whether or not your program is writing anything to the DSP. This cycle is always running on the SB16. I found during DOSBox-X development and testing that "Crystal Dream" relies on this busy cycle to detect whether the DSP is still playing audio, and fires off another DSP command 0x14 or 0x91 to keep playback going if it sees the cycle stop. Since SB16 cards never stop, Crystal Dream fails to keep audio playback going on SB16 cards and goes silent.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.