[directmusic] Re: Creating, downloading and unloading segments with DirectMusic

  • From: Abhijit Patait <abhijit_patait@xxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Fri, 2 Jul 2004 10:36:27 -0700 (PDT)

Hello Vytautas
 
I cannot comment on the problem of downloading too many segments (as I haven't 
encountered this problem).
 
One thing I can suggest about Audiopaths is that you should manualy activate 
and de-activate the audiopaths when they are used/unused. I read somewhere 
(don't remember where) that even if you are not playing anything on an 
audiopath, it still keeps sending silence frames to the synthesizer, and takes 
up CPU resources. You can use the API IDirectMusicAudiopath8::Activate(...) to 
de-activate the audiopath. You should see significant reduction in system 
resource usage after de-activating the paths.
 
Abhijit
Vytautas Leonavicius <vytas@xxxxxxxxxxxxx> wrote:
Hello Group,
I'll be very thankful for any help, cause I really need it.

I am developing sound subsystem in our game. It uses DirectMusic API. I got 
lots of troubles with DirectMusic, so I begin to suspect that the main problem 
is in my wrong model of using DirectMusic. I addition to lack of information on 
that's going on inside DM, I got stuck finally.

I started this way - I loaded all segments from files based on list of 
filenames. Later, I downloaded them all onto performance. The problem was with 
download - it failed if too many sounds were downloaded. Then I introduced some 
kind of cache, that managed all segments, and unloaded least useful, while 
downloading new ones. That worked. For some time.
Later, I faced another problem. Instead of creating all segment files at 
startup, I created them on first use. After this modfication, I found that now 
I am able to download much more segments than prior to that! So, looks like 
IDirectMusicLoader and IDirectMusicSegment::Download, affect each other - the 
less segments you load from file, the more segments downloaded onto performance 
successfully and vice versa.
Another weird thing, is that both loader and segment downloading fail with same 
return value. : DMUS_E_LOADER_FAILEDOPEN File open failed because the file does 
not exist or is locked. From above, looks like CreateSegmentFromFile and 
Download affect some shared memory or resource, however, return value is saying 
nothing about memory etc.

So it looks like I am doing something wrong, cause while searching forums, I 
found no topics with similar problems.

When should I create segments from wave files? Should I destroy/create them 
again during runtime, and that's more important, how many of them could be 
created at once, without being afraid of crash? When should I download and 
unload them? Is DMUS_E_LOADER_FAILEDOPEN saying: "too many segments created, 
release some then retry"?

Another problem is with audiopaths. I am using separate audiopath per each 
sound with separate volume. And I noticed, that even if I don't use audiopaths, 
just create them, they slow down application. I suppose I'll going to implement 
some audiopath sharing between sounds, however, what is 'too many audiopaths"? 
How many audiopaths are allowed without noticeable perfromance penalty?

Weird thing, I don't know how many segments are allowed to be created from file 
at once, I don't know how many of them could be downloaded at once, and same 
thing with audiopaths. In DM documentation no single word about all these 
things...

Vytautas


                
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!


Other related posts: