Originally Posted by c0d3h4x0r
As of Windows Vista, DirectSound isn't what it used to be. It is no longer hardware-accelerated, but is instead emulated in software in the audio driver. It looks like Microsoft deprecated DirectSound with Vista because it had so many problems and limitations and was so difficult for programmers to get right (as evidenced by Nestopia), but of course they had to still support it through emulation for legacy compatibility reasons.

Any programs written using DirectSound need to provide a dedicated background thread to continuously supply new audio data to the DirectSound playback buffer to avoid skips or breaks in the audio playback.

Wrong. Yes, DirectSound was rewritten in Vista, but the results are that in the normal case it's significantly more reliable and breaks up less.

There are tens of thousands of games, emulators, and audio editing/production programs which use DirectSound and show no audio drama on Vista/7 without the use of a separate thread. This includes MAME/MESS, FBA, Raine, ElSemi's Model 2 emulator, bsnes, pSX, and pretty much anything else you might have played.

Nestopia does all the DirectSound work on the main emulation thread, which sets up an unpredictable race condition between the main emulation loop and the audio playback buffer.

Unless the system is too slow to maintain 100% frame rate, there is no problem. All the programs cited above show this principle quite nicely.

1) Do a significant re-write of Nestopia's audio stack to offload all the DirectSound audio buffer stuff to a background thread, and create an intermediary audio buffering system, very similar to what FCEUX does.

And in the process destroy the audio/video cycle sync that is the heart of NEStopia.

2) Do a significant re-write of Nestopia's audio stack to use Microsoft's new XAudio API instead of DirectSound. XAudio's API set is designed to eliminate exactly this kind of problem, and the driver support should be much better for it.

This might fix it by accident, but the real problem is simply that there is a bug in recent versions of NEStopia. This is proven by the fact that these sound problems don't exist in e.g. 1.08 on the same PCs that exhibit problems with 1.41.

That said, the part about "stop fiddling with NEStopia, you can't fix it" is true. Use an older version of NEStopia or some other emulator (MESS runs most NES games very nicely nowadays and it's on this same forum).