🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectSound sampling rates

Started by
2 comments, last by GameDev.net 24 years, 7 months ago
Hello fjord

You can use the GetCaps function from IDirectSound to determine a lot of information about the installed sound card. Look at the structure DSCAPS.

VirtualNext

Advertisement

The DSCAPS struct does not include info about the sampling rate the card supports. There are fields to determine what range of rates a secondary buffer in HW can be mixed at, and I suppose you could assume that the card can play the primary buffer at the same rates. But if a card does not support HW mixing of secondary bufs, then there is no info available.
Trying to set the wave format of the primary and using failure to indicate the card does support a certain rate doesn't work either because DirectSound will just emulate the requested rate.
Unless DX7 adds some fields to DSCAPS-I haven't upgraded, been lazy--I don't see that there is a method to determine what rates a card supports.
Is there an easy method to determine the sampling rates that a soundcard supports?
I don't see any method in the caps structure to determine this. If the card supports hardware mixing you can determine a range of rates for the secondary buffers, but there does not appear any way to know what the allowable rates of the primary are.

How do most people determine what rate to use? Do most people simply ask for something like 16-bit 22KHz and let DirectSound handle whatever conversion is required to match the hardware?
Hello fjord

When you call GetCaps and in the returned DSCAPS structure in the member variable dwFlags the flag DSCAPS_CONTINUOUSRATE is present then all the sample rates between the dwMinSecondarySampleRate and dwMaxSecondarySampleRate are supported by the device (HAL). If this flag isn't present but the DSCAPS_EMULDRIVER flag, all sample rates will be emulated in software. So if you want to use a sample rate which isn't supported by hardware it is done in software.

VirtualNext

This topic is closed to new replies.

Advertisement