Archived

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

Metus

DirectX Audio: Primary Buffer Format

Recommended Posts

I''m in the school now and the teacher talks about DirectX Audio. He said that the primary buffer should be the same as the secondary buffers so DXAudio doesn''t need to convert the audio data. My question is: Should i use 44KHz + 16bit Stereo? is there any specific memory limits so that i shoul use 22KHz instead? please just don''s answer but tell me why i should use the named formats!

Share this post


Link to post
Share on other sites
Modern Soundcards don''t have on-board memory in the same way as Graphics cards do. Soundcards just DMA into the system memory. Therefore, on a modern PC, audio memory tends not to be an issue. You will generally run out of hardware accelerated voices before you run out of memory.

So, with that in mind, you can go for 44.1KHz, 16 bit without too many worries. Indeed some games have gone higher, with the latest SoundBlaster cards cupporting 24bits this is now an option, and 48KHz sample frequency is becoming increasingly popular too.

However, one phrase I have been using a lot is ''modern''. A reason for supporting 22Khz is for the lower-end of the market. By that I mean PCs over 3 years old. They will typically have less system memory (probably less than 128MB), less hardware accelerated voices - if any, and the soundcard would probably be treating samples as 44Khz, 16 bit internally.

Therefore, it is good to allow the player to choose how they want the samples played. You could either have a couple of versions of the samples installed (22KHz and 44.1KHz), or you could convert the samples at load time.

Using 22KHz instead of 44.1KHz does not result in much loss of audio quality within the context of a game. The quality is worse, of course, but not noticably so. However, switching the number of bits does make quite a difference. Avoid moving down to 8 bits if you can.

I hope this helps.

John

John Reynolds
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Aren''t you wrong now? the primary buffer is ALWAYS placed in the SRAM (if there is any) and you can specify in CreateSoundBuffer wheter or not you''d like to create the buffer in the SRAM. My Hercules Forissimo III and my previous SBLive Player 1024 had onboard SRAM.

But if i set the primary sound buffer (or the user selects) 44100Hz, directsound has to convert the secondary buffers to 44100Hz (if the sound i''m loading is 22050hz) wich results in extra cpu calculations...

Share this post


Link to post
Share on other sites
Yes, there is a small amount of SRAM. Generally speaking though, the size of audio data is a System Memory consideration, and is not limited by the Soundcard.

Having the sounds in the wrong format is a performance hit but this is only at load time. So, provided you are not loading sounds in on-the-fly you should be OK.

Cheers,
John

Share this post


Link to post
Share on other sites