I have some old turbo pascal code which makes use of the so-called "direct-dac" and mixer control feature of SB cards a lot. It essentially is a mixer (as in windows mixer) application to control the sb16's channels volume (master, voice, midi, cd, line-in), and the cd-audio colume of mscdex. In addition to that, it uses sampling via direct-dac to display the recording volume. It can also control the playing of cd-audio.
The cd-audio code works since dosbox 0.71 (thanks btw 😀) . However, neither the code to control the sb's channels volume (simply does nothing), nor the code to aquire samples from the sound card work (hangs on waiting for input).
I can imagine the emulation simply doesnt go that far and the features havent been added to dosbox yet. Maybe my code just sucks, I was kinda young at the time 🤣
I can supply code samples or the source of the whole app if you need more concrete examples.
the mixer should be functional. at least it works in games 😀
You could post some code samples if you want. Preferable samples as the whole source will be a lot to read through.
After a bit of testing the master, voice and midi channels now work (tweaked one line of code), tho not as my old puter handled it. While playing cd or feeding it something via line-in, the master volume controlled the overall volume of sound. I guess dosbox doesnt route the cd-audio through its emulated sound device and thus the control of that volume is impossible.
-- Code samples (Turbo Pascal... $ means Hex like 0x in C, comments in {})
1 RESETPORT=$226; 2 READPORT=$22A; 3 WRITEPORT=$22C; 4 STATUSPORT=$22C; { its odd that these two have the same value, but the code worked on a real machine} 5 DATADAPORT=$22E; 6 7 8function resetDSP:boolean; 9var maxv:byte; 10 drw:byte; 11begin 12 maxv:=100; 13 drw:=0; 14 while (drw<>$AA) and (maxv<>0) do begin 15 port[RESETPORT]:=1; 16 delay(10); { waits 10 milliseconds } 17 port[RESETPORT]:=0; 18 drw:=readfromDSP; 19 dec(maxv); { maxv-- } 20 end; 21 if maxv=0 then resetDSP:=FALSE 22 else resetDSP:=TRUE; 23end; 24 25procedure write2DSP(command:byte); 26begin 27 while ((port[STATUSPORT] and $80)<>0) do ; 28 port[WRITEPORT]:=command; 29end; 30 31function readfromDSP:byte; 32begin 33 while ((port[DATADAPORT]and $80)<>$80) do ;{<-- hangs here <-- } 34 readfromDSP:=port[READPORT]; 35end; 36 37{ samples can then be aquired this way: } 38if not resetDSP then fail; 39while weWantSamples do begin 40 write2DSP($20); 41 sample:=readfromDSP; 42end; 43 44