[directmusic] Script dynamic loading bugs

  • From: "Scott Morgan" <scott@xxxxxxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Mon, 2 Sep 2002 22:26:45 -0500

I've been doing a lot of work with downloading and unloading sound data through 
scripting lately since I can use a lot more samples if I'm swapping instruments 
out dynamically.  Unfortunately this is yet another buggy area it seems.  I'm 
afraid I'm going to have to abandon it to avoid leaks.

If a script turns off the option to download all segments when the script 
loads, will the segments leak if the script doesn't unload what it loaded?

If so I'm in trouble because sometimes things just won't unload no matter how 
many times I call unload on them.

I've uploaded two projects demonstrating my problems.  There are DMDemo exes in 
the project folders that have buttons and commentaries on the various bugs.

Sorry its such a large download.  I'm trying to make a point with memory usage.

http://Morganstudios.com/Load&UnloadBugs.zip

I've listed the bugs in order of priority to me.

Bug#1 (in LoadScript&UnloadBug2)
The worst one is one where if you download and unload some segments several 
times, they get to where you can never unload them again.  I don't know what 
the distinguishing thing is that makes a segment do this.  I can't figure it 
out for the life of me.  Oh, the engine behaves like the data was unloaded 
since playback no longer happens, but if you look at task manager the memory is 
still taken.

Bug#2 (in UnloadBug)
An instrument will not unload if a note is still playing.  What if a note gets 
stuck?  I actually went in and got rid of all my NoCutoff flags and 
Don'tCuttOff options on all notes in paranoia.  I'm afraid the real source of 
my pain was Bug#1 though.

Bug#3 (in UnloadBug)
An instrument can partially load (via a band's instrument's range), but they 
don't seem to partially unload. The engine waits until all segments with that 
instrument have been unloaded before any data is unloaded from that instrument. 
 That really limits the usefulness of the range feature (which I thought was 
such a good idea!)

Bug#4 (in both projects)
Once data has been downloaded, it seems a certain percentage of it never goes 
away.  This can be anywhere from 50k to 600k depending on the DLS collection.

Bug#5 (in LoadScript&UnloadBug2)
If a script is told not to automatically download all segments when loaded, it 
cannot directly load a second script.  You have to call the 2nd script via a 
segment's script track or something to make it load.  Even script.load doesn't 
work.  Again scripts have no problems loading other scripts if you have the 
first script load everything automatically.

I know MS is listening, I know I was when I was a bug hunter up there :)  hehe 
thanks guys.

-Scott Morgan
http://Morganstudios.com




Other related posts: