DirectSoundCreate8 takes over 15 seconds

Started by
5 comments, last by Rhapsodus 19 years, 10 months ago
Is this a normal thing or is there a way to cut out uneeded fat in DirectSound ??? My load times are being slaughtered as just this one function is taking well over 15 - 20 seconds... I am using it to only play back ogg files too which is pretty simple and works well enough... I tried putting this call on its own thread but that didn''t have much effect on the call time ... I am making the call : DirectSoundCreate8( NULL, &m_pDirectSound, NULL );
Advertisement
u must be doing something wrong, mine takes like a second or lesss
Yeah, I just confirmed it by compiling and running one of the direct sound examples...

this is a strange bug indeed...

I think I found it but I am not sure why it occurs... Basically I had a thread to initialize and load all textures, 1 for sounds, and 1 for miscellaneous 1 time claculations like terrain generation.

Whenever I call DirectSoundCreate8 ( in the function LoadSounds ) from a thread such as :

::_beginthread( LoadSounds, 0, this );

it will take 15 seconds. Even if the first line of code in the thread is the Create call but if I do this:

DirectSoundCreate8( NULL, &m_pDirectSound, NULL );
::_beginthread( LoadSounds, 0, this );

it returns almost immediately...

i only use one thread to load all and run my games, how come u need to use multiple?
I use multiple threads to cut down on the load times...

Why wait around for all textures to be created before you start loading up sound files? You can load them up at the ''same time'' so that everything finishes relatively close...

It is pretty simple to do and it may save you a lot of time.

If you have sounds that take 5 seconds to load, textures that take 8, and calculations (maps, terrain, etc...) that take 5, you only have to wait 8 seconds instead of 18...

That is over half the time
quote:Original post by Rhapsodus
If you have sounds that take 5 seconds to load, textures that take 8, and calculations (maps, terrain, etc...) that take 5, you only have to wait 8 seconds instead of 18...

That is over half the time


Nop, unless you have 3 processors, it may even take more then 18secs due to thread switching.

I''m not totally sure about this, but the bottleneck when loading a new sound is the actual read from disk, right? Once it''s in memory, the process of decompression/buffer filling is pretty fast, or at least can be done on-the-fly.

If that''s true, then you don''t need to run it all on a seperate thread - you just need to have a seperate thread to load it into memory. Then you can use your main thread to create the object from an in-memory source.

Might make things a little easier.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement