Sound Blaster 16 Emulation Failure

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Sound Blaster 16 Emulation Failure

Post by Martin »

The biggest hurdle for this problem is that there don't seem to be many paying customers who need this feature in old real mode / 16bit operating systems.
over_clox
Volunteer
Posts: 167
Joined: 5. Apr 2008, 22:43
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP, Ubuntu 10.04, Legacy Testing

Re: Sound Blaster 16 Emulation Failure

Post by over_clox »

I've done a little further testing with different formats of PCM audio, and it now seems to regard something to do with buffer size calculations in DevSB16.cpp - sb16WriteAudio:

Counter Stuck At:
16-bit Stereo 44.1KHz - 0x1fff
16-bit Mono 44KHz - 0x1fff
8-bit Stereo 44KHz - 0x3fff

I've also noticed that in lines 1519-1520, sb16WriteAudio doesn't even seem to have any values being passed to it to indicate whether the data passed to it is supposed to be 8 or 16 bit!

Line 1519: static int sb16WriteAudio(PSB16STATE pThis, int nchan, uint32_t dma_pos, uint32_t dma_len, int len)

So I speculate the problem is probably in combination between an improper buffer size (should support 64KB for the 8237A DMA controller) and a complete oversight in bit depth.
This is a little beyond me to provide a complete fix for, but maybe this can be a starting point for someone more oriented in VBox code internals than myself.

Please refer back to page 2, last post of this thread for links to official documentation regarding both SB16 and DMA standards. I hope this helps shine a light on the issue.
over_clox
Volunteer
Posts: 167
Joined: 5. Apr 2008, 22:43
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP, Ubuntu 10.04, Legacy Testing

Re: Sound Blaster 16 Emulation Failure

Post by over_clox »

I have filed a bug ticket with my findings here:
Sound Blaster 16 Issues Located
tauro
Posts: 6
Joined: 26. Jul 2011, 11:56
Primary OS: Debian Sid
VBox Version: OSE other
Guest OSses: Win98, WinXP, Win7, Win10

Re: Sound Blaster 16 Emulation Failure

Post by tauro »

I was experiencing the same problem both in VBox and qemu when I used my original SB16 drivers.

The solution is to use the drivers contained in the file sbbasic.exe, easily found on Google.

I hope this will help people in the future!
over_clox
Volunteer
Posts: 167
Joined: 5. Apr 2008, 22:43
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows XP, Ubuntu 10.04, Legacy Testing

Re: Sound Blaster 16 Emulation Failure

Post by over_clox »

This problem is much more an issue for old DOS games and similar software which directly drove the SB16, regardless if ANY drivers were installed. At that time in sound systems, it was much more common for games and programs to have their own "drivers" compiled right into their programs. The DOS "drivers" that came with the card were mostly to provide volume mixing controls, a music and CD player, ability to configure the BLASTER environment variable intuitively, and offer better MIDI support. The driver itself wasn't even necessary under DOS, drivers only became necessary under Windows due to their developing hardware abstraction layer. The SB16 would work just fine on real hardware in DOS even without any drivers installed, as long as the BLASTER environment variable was set correctly in AUTOEXEC.BAT. The fact that it doesn't work right in VBox but does on real hardware proves that VBox is not faithfully emulating the card to specifications.

To prove this point, I offer a simple challenge.. get 3 old school DOS games working under SB16 emulation, any choice of driver. It won't work. You'll be lucky if you find even one game that does work, and if so, it isn't using the SB16 chips in the way the engineers intended in regards to figuring out when a sound buffer has finished playing.

The proper solution isn't to change the driver, that's simply not possible as every old DOS game would have to be recompiled around this bug somehow. The proper fix is to address the issues in VBox emulation.
crazii_he
Posts: 7
Joined: 21. Jul 2018, 02:06

Re: Sound Blaster 16 Emulation Failure

Post by crazii_he »

Since it's a zombie thread, first I apology for bumping this up.
Second I am not a paying customer either, but I guess vbox still has an OSE distribution so any unpaying user is legitimate to issue a bug report on a flawed feature.

Just like not all app users write reviews/feedbacks(some just unistall and walk away), not all vbox users encountering this problem are willing to post/discuss this issue here in the forum/this thread. Me for instance, I don't remember how many times during these years I've tried to setup vbox with win9x guest and all end up some kind of disappointment, and I didn't even ask for help but simply googled to find if there's any solutions. I'm posting this now just because I finally registered to this forum for some reason.

Yes an OSE software welcomes any useful contributions, especially useful code patches, but what if most of the users encountering this problem are not familiar with programming? Fewer exist with experiences in EMU field. Besides pointing out an valid bug for the software is contributing already. and you guys really should be glad for that, or at least please pretend to, and not discourage/negate such requests.

EDIT: I tried vbox with win9x guests again recently, and I'm glad that it has improvements, although it is still not perfect. thanks to the vbox team, hope it gets better and better, even for retro gamers.

SB audio emulation still BROKEN, simple proof is that: you install a fresh Win98SE guest with SB audio driver and run "dxdiag" to test sounds, I confirm that the test will fail (no sound can be heard) with HW Acceleration, it only pass with soft emulation of Direct Sound.

In comparison, When using AC97 emulation and with driver installed, everything works fine.

P.S. (for gamers only) AC97 is almost done there except it only works for win9x applications by its nature(it works perfect for those), dos games are still muted (EDIT: NOTE: This is an expected behavior since AC97's official driver doesn't support DOS/NTVDM, that's what I means by 'by its nature'. Even in real machine with DOS/Win98/XP, AC97 don't have sound for DOS games.). VDMSound for win9x (there's an ancient thread about that if you googled) can fix some of the games but still not perfect.
Last edited by crazii_he on 22. Jul 2018, 14:57, edited 6 times in total.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Sound Blaster 16 Emulation Failure

Post by mpack »

I'm afraid that makes little sense to me.
  1. If the SoundBlaster hardware emulation was broken then it would affect all OS's which use that hardware, principally DOS.
  2. DxDiag is a test of the DirectSound API, not a test of basic audio, and basic audio definitely works because I use it myself in my Win98SE VM.
  3. Even in a supported OS you have to install the GAs before you can use DirectX. However there are no GAs for Win98.
So, translation: I guess you don't have working DirectX drivers for SoundBlaster and Win98.

Regarding support: even if you were a paying customer there is no support for WinDOS windows variants. I have managed to get Win98SE working reasonably well, but nobody is promising anything.
Tom B
Posts: 6
Joined: 23. Oct 2015, 14:36

Re: Sound Blaster 16 Emulation Failure

Post by Tom B »

I have the same issue on a Windows XP guest: a soundblaster 16 cannot be emulated in DOS applications correctly. There are several issues:

1) The sound crackles
2) The sound is delayed by about 0.5 seconds
3) (possibly application related) the DOS game freezes for 3-5 seconds every 2 minutes or so.


Each of these seems to be because the DOS program running cannot detect the sound card correctly.

Other sounds in the OS (e.g. watching a youtube video in Firefox) work fine.

I'm trying to play Carmageddon 1 3dfx in Virtualbox. It works perfectly if the sound is disabled but with sound has the problems as above. There is definitely a problem with emulated audio within guest OS'.

The DOS sndsetup.exe from carmageddon cannot detect the sound card from within winxp and I think that's part of the problem.


edit: I will say that the only way I can get audio to work is using AC97, if I select SB16 I get no audio in my XP guest.
crazii_he
Posts: 7
Joined: 21. Jul 2018, 02:06

Re: Sound Blaster 16 Emulation Failure

Post by crazii_he »

But it is common sense to me. if it makes little sense to you, then allow me to explain.
If the SoundBlaster hardware emulation was broken then it would affect all OS's which use that hardware, principally DOS.
This thread already talked about DOS, as far as I can see, it doesn't working properly on DOS.
DxDiag is a test of the DirectSound API, not a test of basic audio, and basic audio definitely works because I use it myself in my Win98SE VM.
Legacy Direct Sound's HWA(HW Acceleration) is simply based on the hardware and driver, especially for SB audio which exist long before direct x, there's no such thing as "direct x compatible" for SB16, it should already works. if the "basic audio" works but direct sound HWA test fails, then it's true that it is whether a HW(emulation) problem or a driver problem, or HW/driver mismatch. Possibilities for the latter two are rare.
Even in a supported OS you have to install the GAs before you can use DirectX. However there are no GAs for Win98.
Not precisely. Only VM provided custom hardware must need GAs/extra driver. Emulation for a specific known & supported hardware by guest doesn't necessarily need extra drivers to get the HWA working. It should be working since there's a well known hardware(emulated), and official driver for it, why not? The actually performance may needs GAs to tune to get better, but that's totally a different thing, its optional.

Since SB16 is a real world hardware, it should work with existing driver made for win98(or XP), like all real-world SB16 cards at that time. if it's not, then its an HW(emulation) problem. For AC97 its the same. Actually AC97's Direct Sound HWA is working fine without GAs in win98.If things are going as you said, then Why AC97's HWA is working well for win98 DirectX, without GAs? Is it just by chance/luck? -no.

For graphics card of vbox, its different: "Virtualbox SVGA" is unknown hardware (VM provided custom hardware as I said), no such graphics card exists in real world, you can consider that vbox team is the manufacturer for that card, and GAs provides its driver. In this situation GAs is necessarily needed to get DirectX's HWA / DDraw/D3D working.
If vbox claims that it emulates S3 graphics cards, then things will be the same as SB16/AC97: Guest OS doesn't need GAs/custom drivers but only the official S3 driver to get HWA to work. if 2D HWA doesn't work, then the S3 emulation is IMPERFECT/BROKEN - it's not working as expected, not like a real S3 graphics card.

There's an example of Microsoft Virtual PC 2007(not working after Win8) which provides both S3 & SB16 emulation and by default the HWA for both Direct Sound & Direct Draw is working fine without Guest Additions.
Yet another live example is DosBox-X, it emulates SB16 & S3, and no extra GAs needed to get both DirectX's HWA working in Win98.
Things get different in vbox: SB16 is recognized by guest OS, and HWA by default is turned on. Direct Sound tests can keeps going on without error detected by guest OS, but you just cannot hear any sound.

You bought a SB16 sound card in the market and after you installed bundled SB16 driver it doesn't work, then the reseller tells you that this piece of SB16 needs a "voodoo" driver to work. Okay this is fine but is that card still a SB16, or a "voodoo" card? -just a joke. Same principle apply to emulation as well. if GAs/custom drivers are not optionally but necessarily needed for an "SB16", then it is not an SB16, you can name it anything else, i.e. "Virtualbox Sound Card" like it did for graphics card, but definitely cannot be SB16 - or you have to admit that is the emulation is broken.

So its NOT a driver issue. GAs/custom drivers are not necessary for SB16, they are only optional. Hope it makes sense to you this time.
Regarding support: even if you were a paying customer there is no support for WinDOS windows variants. I have managed to get Win98SE working reasonably well, but nobody is promising anything.
I totally understand that. But its a Windows only variants, just forget about the DOS thing. That DOS thing I said is not related for my problem described here, its just for gamers' information. Sorry its my bad not to clarify, I edited the post.
The problem is: DxDiag is not testing properly for SB16, but fine for AC97. MS official application "Age of Empires" doesn't have sound for SB16, but does for AC97. There are plenty of proof to show SB16 is not working well.
You can verify/compare with Dosbox-X, even with Microsoft Virtual PC 2007 in a XP guest in vbox.

EDIT: I forgot about PCem, which also can emulate an SB16. Guess what: the DxDiag tests fine for it, just like Dosbox-X or VPC2007. All are without any GAs.
Last edited by crazii_he on 22. Jul 2018, 14:48, edited 1 time in total.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Sound Blaster 16 Emulation Failure

Post by mpack »

tl;dr.
crazii_he
Posts: 7
Joined: 21. Jul 2018, 02:06

Re: Sound Blaster 16 Emulation Failure

Post by crazii_he »

mpack wrote:tl;dr.
So long story short, Sb16 & AC97 both don't need GAs to work with HWA in Direct Sound. AC97 works fine. SB16 don't: The SB16 emulation is BROKEN.

There're some other VM which has SB16 working fine in DirectX without GAs: Dosbox-X, PCem, and Microsoft Virtual PC 2007.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Sound Blaster 16 Emulation Failure

Post by mpack »

Thanks for the report. I'm sure the devs will leap right on it.
crazii_he
Posts: 7
Joined: 21. Jul 2018, 02:06

Re: Sound Blaster 16 Emulation Failure

Post by crazii_he »

mpack wrote:Thanks for the report. I'm sure the devs will leap right on it.
Very Much appreciated.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Sound Blaster 16 Emulation Failure

Post by michaln »

crazii_he wrote:Very Much appreciated.
In case that wasn't clear, it wasn't meant seriously. Oracle does not truly care if the SB16 emulation is broken or not.
crazii_he
Posts: 7
Joined: 21. Jul 2018, 02:06

Re: Sound Blaster 16 Emulation Failure

Post by crazii_he »

michaln wrote:In case that wasn't clear, it wasn't meant seriously. Oracle does not truly care if the SB16 emulation is broken or not.
Of course. After reading through this thread posted 10 years ago, I was clear to that before posting to the thread again.
Hope the vbox team may fix it someday, maybe another 10 years later :twisted: , maybe on their own without driven by Oracle's commercial plan, but from a perspective of user & product. Or maybe another lifetime. whatever. I'm a fan of vbox and just don't want to give up the tiny little hope.
Post Reply