Archived

This topic is now archived and is closed to further replies.

DirectXAudio (DirectSound) Performance

This topic is 5336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The "old" DirectX 8.1 docs used to mention that one thing to do to increase the performance of DirectSound is to match the secondary buffer formats (sampling rate and channels only) to that of the primary buffer. DirectX 9 docs no longer mention this... why not? Has it changed? My main question though is about this particular optimization. My primary buffer is 22KHz, 16-bit, Stereo, since I''m also using DirectMusic, which really wants to make it stereo... as of now, the Wave files that I load in are 8-bit, 22KHz, mono, and the only buffer flag that I use is for Volume. Would it help any to convert the Wave files to stereo, even though it will double their size with no actual benefit? It seems odd to have to match that particular feature (channels) when controls like Pan seem to imply that it is normal to use Mono data and let the application pan for you... Thoughts/Suggestions?

Share this post


Link to post
Share on other sites
From what I read about DirectSound in an OLD book. Your sounds should always be in mono, DS will convert stereo into mono internally anyway, otherwise it'd have trouble using them with effects such as panning.

[edited by - Illumini on May 5, 2003 12:45:38 AM]

Share this post


Link to post
Share on other sites
If you pass the wrong type of wav in then it must be converted by DirectSound. It isn''t a huge performance hit but if you can avoid it then you''re obviously best doing so.

The panning feature is there to allow developers to control the panning of mono sounds in real time. If the panning is to remain static then it is probably better to read in a stereo sound and save the processor having to calculate the stereo image at runtime.

To expand on Illumni''s comments sounds *must* be mono for 3D positioning, as they are effectively a point in space. 2D sounds can be either mono or stereo. As far as I''m aware, DS will only convert a stereo sound into mono if the pan flag is set.

Cheers,
John

John Reynolds
www.zejo.com

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why does Direct Music only support MIDI playback? What about mp3? I know Direct Media does it, but hey..

Share this post


Link to post
Share on other sites
Ok so since I''m using a stereo buffer here, you''d recommend that I convert all of my sounds to 8-bit, 22KHz, stereo, even though they won''t have any extra information (and it will inflate the file sizes)? Well that is reasonable I guess, just a bit odd.

BTW, DirectMusic supports WAV and a pile of other formats as well (since DirectX 8 I think), but MP3 is a more complex and often streaming format, which means that you need an actual codec to read it, which is what DirectShow is set up for.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The fact that a sound is mono in a stereo environment won''t change anything much. The important things to check out is the frequence and resolution of the sound (ie 22khz 16bit)

ZixThree

Share this post


Link to post
Share on other sites
Odd, the docs seem to imply that you DON''T have to match the bit rate, but you DO have to match the number of channels... well at least you do for optimal performance.

Share this post


Link to post
Share on other sites