Archived

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

Rhapsodus

DirectSoundCreate8 takes over 15 seconds

Recommended Posts

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 );

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites