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

  • From: "Todor Fay" <todor@xxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Sat, 3 Jul 2004 08:52:31 -0700

This may be an issue with file handles. If the waves are over a certain
length, dmusic opens them in streamed mode and keeps the file handles
open so it can read from disk while playing them. Unfortunately, Windows
has a limit of how many file handles it can allow open at one time. The
solution would be to change these files into non-streaming (and I know
that can be done in Producer as well as possibly via the api - but I
forget how.) Or, don't open so many files at once, since you can't
possibly plan to play them all at the same time!

But, you say "crash" as opposed to "error". Is the program actually
crashing or failing to load the file?

Hope this helps,

Todor

-----Original Message-----
From: directmusic-bounce@xxxxxxxxxxxxx
[mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Vytautas
Leonavicius
Sent: Sunday, July 04, 2004 8:10 AM
To: directmusic@xxxxxxxxxxxxx
Subject: [directmusic] Re: Creating, downloading and unloading segments
with DirectMusic

My problem get narrowed to IDirectMuscicLoader only.

I created big list of files, and try to load them at startup just for
test. 
No audiopaths, no performances are created, just 
IDirectMusicLoader::LoadObjectFromFile. After loading approximately ~400

small (90kb) sounds loader crashes with MUS_E_LOADER_FAILEDOPEN return 
value.

Here are words from directX audio exposed:

"Segment
A Segment represents any playable audio. It might be a MIDI or wave
file, or 
it might be a DirectMusic Segment file authored in DirectMusic Producer.
You 
can load any number of Segments from disk, and you can play any number
of 
them at the same time. You can even play the same Segment multiple times

overlapping itself."

But for me this is not true - even more, loader's crashes are somehow 
related to manual downloading of segments.

I could manage segments and throw out least used to load other, the
problem 
is HOW MANY OF THEM IT IS SAFE TO HAVE AT ONCE? Return value is saying 
nothing about some resource exhaustion.

BTW - I had same error when I tried to do everything with DMP scripts.
When 
scripts get large enough - they crashed at load. Sometimes they crashed
with 
same return value.

I also tried to disable Loader's cache - this don't solved the problem.

Do wave files have some GUIDs?

Vytautas

----- Original Message ----- 
From: "Vytautas Leonavicius" <vytas@xxxxxxxxxxxxx>
To: <directmusic@xxxxxxxxxxxxx>
Sent: Saturday, July 03, 2004 3:15 PM
Subject: [directmusic] Creating, downloading and unloading segments with

DirectMusic


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






Other related posts: