DirectSound and i810 soundcards

Francois Gouget fgouget at codeweavers.com
Sat Dec 28 02:46:12 CST 2002


There is a problem with Directsound and i810 soundcards. The test I just 
sent to wine-patches illustrates it very well.

Basically sounds are being played too fast.

Here's my understanding of the problem (if my memory and understanding 
of the logs is correct):

When DSound initializes it create a primary sound buffer and invokes 
winmm to actually get access to a sound device. The default format of
the primary buffer is 22050x16x2 (i.e. 22050Hz, 16 bit sound, stereo). 
This means the device it's going to get will be handled by msacm.drv 
which will be responsible for performing the conversions on the fly.

However during the primary buffer creation DSDB_MapPrimary gets invoked 
in wineoss and does an mmap of the hardware sound buffer.

So when we then play sound in a secondary sound buffer, this sound gets 
mixed into the primary buffer, but because of the mmap this then goes 
straight to the sound card with no further conversion. So you end up 
with a chipmunk sound effect since you play a 22050x16x2 sound at 
48000x16x2.

I will try to make more tests to confirm this but does it seem to make 
sense? Should I look in some other direction? Any suggestion about a fix?

If you have an i810 soundcard you can reproduce by doing the following:
  * apply "Add WINETEST_INTERACTIVE" from wine-patches
  * apply "Add 'audiophile' DirectSound tests" from wine-patches
  * cd dlls/dsound/tests
  * make
  * WINETEST_INTERACTIVE=1 ../../../tools/runtest -P wine -M dsound.dll 
-T ../../.. -p dsound_test.exe.so dsound.c

(you can also set WINETEST_DEBUG=2 to get more debug info about the 
test's buffer management, though this is probably not relevant here)

Alternately, you can download the latest Windows test binaries from my 
site (http://fgouget.free.fr/wine/winetests.zip) and run them using 
Wine, or on Windows:

set WINETEST_INTERACTIVE=1
dsound_test dsound

Actually I would be interested in the results of this test on Windows:
  * the test tone is usually played three times. Are all three, and 
especially the first one, at the right pitch?
  * what is the output of the test? I'm interested in reported 
capabilities as stated by Windows and Wine for instance (to determine 
whether the primary buffer is emulated for instance).
  * what is the primary buffer's default format? 22050x16x2? (that's not 
supported by the sound card!)
  * does the winmm test work?
    set WINETEST_INTERACTIVE=1
    winmm_test wave
  * in particular, what happens when the test tone is played with 
WAVE_FORMAT_DIRECT on Windows? (except Win9x platforms which don't 
support that flag)


-- 
Francois Gouget
fgouget at codeweavers.com





More information about the wine-devel mailing list