No announcement yet.

DirectSound Output FAQ

  • Filter
  • Time
  • Show
Clear All
new posts

  • DirectSound Output FAQ

    1. General questions.

    Q: What does setting <...> do ?
    A: Rule #1: if built-in help doesn't seem clear enough, you shouldn't touch those settings you don't understand, you will probably only break things if you change them.

    Q: Why do none of the changes I make seem to take effect
    A: Most changes only take effect after playback is restarted.

    Q: What's the difference between DirectSound and waveOut ?
    A: Short version: you should use waveOut on win95/98/me/nt4 and DirectSound on win2k/xp/.
    Long version:
    waveOut is old, outdated API (Application Programming Interface) for playing digital sounds in 32bit Windows OS's. Old OS's (all win9x and nt4) have good waveOut implementation; you should use waveOut output on those for best performance. waveOut features are limited; it doesn't even natively support mixing multiple streams. It appears that waveOut is provided in win2k/xp only for compatibility with old software - win2k/xp waveOut implementation is rather bad, it doesn't use any kind of hardware acceleration; all mixing is performed by software (may interrupt sound when CPU usage is high).
    DirectSound is the new "modern" sound playback API, built into all recent versions of 32bit Windows OS's, available as redistributable for older ones (though nt4 directsound is badly broken from my experience). DirectSound natively supports mixing multiple streams, independent volume control, hardware acceleration layer & hardware emulation layer (features which aren't supported by hardware are emulated by software, so the programmer doesn't have to worry if his new l33t code will work right on old sb16). DirectSound should be generally fine to use everywhere except for nt4, as long as you have latest DirectX version for your OS and proper soundcard drivers installed. DirectSound is preferred over waveOut on win2k/xp, because their DirectSound implementation is relatively good (eats less CPU than waveOut and is free of win2k/xp waveOut implementation glitches). DirectSound was originally designed to let games utilize hardware acceleration available on your system without having to touch low-level hardware functions directly (like any other component of DirectX).

    Q: What do all those device info numbers mean ?
    A: Quick explaination:
    "Certified" - shows if the driver is certified by Microsoft or not (doesn't imply that the driver is bug-free, it just means that MS people have been testing the code you are running)
    "Emulated" - if you don't have proper DirectSound drivers installed for your soundcard, your device will show as "emulated" and DirectSound functionality will be emulated using waveOut functions (happens only with old OS's). If your device shows as "emulated", you should use waveOut output instead for better performance.
    "Supports sample rates from %A Hz to %B Hz" - what range of sample rates can be mixed by hardware (sample rates outside this range will be resampled by software to specs accepted by hardware). This DOES NOT indicate output specs of your soundcard. Note that DirectSound itself supports up to 100000Hz, you can't use higher sample rates with DirectSound no matter what you do.
    "Supports continuous sample rates" - all sample rates between min and max (see above) are supported.
    "Hardware memory" - onboard memory of the device, usually not available for PCI soundcards (they use system memory instead).
    "Hardware mixing" - shows how many simultaneous sound streams can be mixed by hardware. Note that they don't limit total amount of simultaneously played sounds because newly created streams are mixed in software when there are no hardware resources available.
    "Speaker setup" - your speaker setup according to what you have set in windows control panel.

    Q: How do i get rid of gaps between tracks ?
    A: Increase "buffer-ahead on track change" value in config.

    Q: Are there any differences in audio quality between DirectSound and waveOut ?
    A1: In win2k/xp (WDM), waveOut and DirectSound are just 2 different pathes of passing PCM data to windows kernel mixer. WaveOut uses software mixing only, which makes it less prone to system-specific probmlems (see below), while DirectSound can use hardware mixing if available, which is known to cause sound qualtiy issues with certain configs (since out_ds v2.2.4 hardware mixing is disabled by default so this is not a problem with out_ds).
    A2. In win9x OS line, DirectSound driver system is completely separated from waveOut, and does low-level hw access on its own, so it's like you are using two different drivers for waveOut and for DirectSound. There are known "problems" with DirectSound downsampling to 22khz 8bit (or something similar) to save ISA bandwidth on old cards, you can workaround that by enabling "create primary buffer" option (which is enabled by default on win9x).

    Q: What's the difference between software and hardware mixing ?
    A: As for DirectX 8.1 and Windows XP SP1, hardware mixing is highly buggy in both Microsoft's DirectSound core and per-driver implementations. There are confirmed "problem samples" where using hardware mixing in Windows XP causes pops at the beginning of stream, tested on different soudncards. Particular drivers have far worse problems (famous "Audigy skipping", static noise with some Audigy configs, crippled sound quality with certain other setups, God knows what else). For stable operation, it is strongly recommended that you leave hardware acceleration disabled; it's disabled by default starting from v2.2.4.
    Hardware mixing can be toggled by changing "allow hardware acceleration" on device tab. Enabling that option doesn't mean that you are actually using it (DirectSound will fallback to software mixing when out of resources); see status display for exact info about currently used mixing type.

    2003 Update
    Note that hardware acceleration is now better supported by the latest sound drivers and DirectX 9.x. This option is required for multiple speaker output, especially with onboard sound chips. SB Audigy users should still use this feature at their own risk (see below).

    Q: What do all those weird numbers in status display mean ?
    A: Here's a quick explaination of some of them:
    "amount of data buffered" - shows how long we can play after decoding gets nuked by high cpu usage / slow file access, how long fadeout we can perform, or how much silence at the end of track we can remove at given point.
    "buffer locks done" - how many times we've been modifying contents of the buffer.
    "underruns" - how many times the playback got stopped because there was not enough data to play (also affected by "skipping" syndrome, see above). Note that with out_ds v2.2.0+ you might get holes in sound without triggering an underrun (new way of handling underruns).

    Q: Why there's no thread priority setting in out_ds config ?
    A: Thread priority is hardcoded to max. AFAIK it doesn't cause any problems, changing it would only degrade performance when running other CPU-intensive stuff. Nothing to configure here. If you think you are having problems with thread priority, change settings in your input plugins instead. Might also help to change Winamp process priority class, but that setting is kind of dangerous, don't touch it unless you really have to (may lead to OS instability).

    Q: Is out_ds/cnv_pcmdsound sourcecode available ?
    A: No, out_ds sourcecode belongs to AOL/Nullsoft, i can't give it away.

    Q: But SSRC is LGPL...
    A: SSRC library used by out_ds_ssrc is an exact copy (literally) of the one used by out_wave, which is opensource.

    Q: How do I get status display to show in Winamp3 ?
    A: This is somewhat tricky in current builds. Left click on "DirectSound" in preferences, then press right cursor key to make additional items show (also applies to some other components, eg. diskwriter).

    2. Troubleshooting.

    Q: I get really bad sound quality with my .
    A: Short explaination: device tab, "create primary buffer".
    Long explaination: DirectSound tends to perform aggressive downsampling to save ISA bandwidth when using old ISA soundcards. Enabling "Create primary buffer" will force sound format played by hardware to be the same as format of played stream. This affects only really old devices.

    Q: I get only static noise with new audigy drivers...
    A: Disable hardware acceleration (device tab).

    Q: Why is DirectSound always quieter than waveOut ?
    A: On win2k/xp, changing waveOut volume seems to change global wave volume setting, while DirectSound has independent volume control; in other words - you play with waveOut, set volume to 50%, you get 50%, then you switch to DirectSound, set volume to 50%, and get 25% of your max volume. Solution: don't use waveOut and set wave volume to max in windows volume control.

    Q: I get weird hiss with DirectSound...
    A: Uninstall TotalRecorder shit, it breaks a lot of things. (thanks to Thor for researching this one)

    Q: What's the deal with "skipping" / "stuttering" / other playback glitches ?
    A: Playback glitches divide into following types:
    1. Pausing and/or repeating the buffer a few times - something else takes CPU from us (repeating) or file access is too slow (pausing). Try increasing buffer size. If other cpu-hogging programs are causing trouble, it might help to increase Winamp's process priority class in Winamp's preferences (WARNING: do this on your own risk, if Winamp freezes/crashes for some reason, it may freeze your entire OS).
    2. "skipping" - $#!@ broken playback position reporting function (huge kudos to JSheridan for helping me to research this one). Affects audigy and possibly some others. Basically it's caused by the function which is supposed to retrieve current playback position randomly returning garbage instead, making output code think that the buffer has wrapped and writing data ahead. Disabling hardware acceleration fixes it.
    3. "popping"/"crackling" - hardware conflict, something interrupts the data stream being sent to your audio device.
    4. static noise, hiss - severe problems on driver side. It sometimes helps to disable hardware acceleration.

    Q: But some earlier out_ds versions (2.0.x/2.1.x in particular) didn't skip on my audigy so there must a bug in 2.2.x...
    A: Wrong. 2.0.x/2.1.x had hacks to avoid "audigy skipping", but these hacks were breaking a lot of other configs just to fix problems with audigy. Just don't enable hardware acceleration and you will be fine.

    Q: Blah blah i still keep getting underruns whenever i use other resource-hogging software blergh....
    A: Set buffer to 20 seconds. Enable "CPU usage control" on buffering tab to prevent insane Winamp's CPU usage when starting/seeking/etc. Increase buffer-ahead on track change to reduce underrun possibility when changing tracks.

    Q: Is there a setting that mutes all system sounds when playing ?
    A: No, it's simply not possible in win2k/xp and newer or on win9x if your soundcard is capable of mixing multiple streams.

    Q: I keep getting error messages when trying to play any file...
    A: Update soundcard drivers and DirectX.

    HOW TO GET HELP (read me before posting tech support questions)
    If you have a problem and this FAQ doesn't help you, please post full system specs, including soundcard type, exact windows OS version, DirectX version and version of used soundcard drivers, and out_ds settings you use (if hardware acceleration is enabled or not, etc). This information is required if you want to get quick and useful reply.

    resampling stuff (for out_ds_ssrc)

    To shut lamers up, this section got removed. Resampling feature is provided only for hardware-related experiments. Putting extra resampler never actually *improves* quality of produced output signal, except for particular rare cases of bad hardware or poorly-written drivers. It is recommended that you don't use it unless you really know what you are doing. If you want more info, search hydrogenaudio forums.