[directmusic] Re: Help! Problem when loading scripts

  • From: <tomas.elf@xxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Fri, 25 Feb 2005 14:17:31 +0000

> You called SetObject on the script right?  You make it clear that you
> called it for all references.

Yep, I run SetObject on all objects.

> Also, I just want you to be aware if you are not that the pStream
> pointer you use when using SetObject is an IStream pointer.

Actually, I didn't use any kind of stream. I simply tried to load it from a 
file through the GetObject function.
 
> The way I got this working was to create an IStorage file containing all
> my files and loading from that.  Otherwise I couldn't get an Istream
> stream.  I think the alternate method would have been to implement my
> own IStream interface...which was more work than I wanted to do.

That does sound like an interesting solution, though :). Thanks for the tip. 
Maybe that'll come in handy some day, even though it was too much work for you 
:).

> I know that probably didn't help. :(  Hopefully Todor or someone will
> pipe in.

Hey, I appreciate all the help I get :D. It's too bad this list is so silent 
these days, though. It seems like I was about 2 years to late :/.

Anyways, now that I've done some experimenting, I've managed to make it work. 
The problem was that I needed to load all objects, on which the script depends, 
through GetObject. Not just point them out using SetObject. That way the 
objects are cached in the loader, and the script seems to find them. The really 
strange part is that I get a lot of DirectX error messages, like "<filename> 
not found", in the output window for all my segments and for my audiopath. But 
obviously, the files are found - and loaded - or else they wouldn't be played 
when I execute the script.

Also, now I've also made DirectMusic load everything through memory buffers by 
loading all files (except the wav:s, them I just point out using SetObject. 
Since they have no DirectMusic interface - only a DirectSound interface - I've 
never been able to load them through GetObject) into memory buffers and then 
giving pointers to these buffers to GetObject. Even the script loads perfectly 
through the memory buffer. Well... Almost perfectly. There's still the matter 
of the error messages. And when loading my Audiopath through GetObject it even 
returns E_NOINTERFACE. The audiopath still seem to be loaded into the loader 
though, since I explicitly refer to the audiopath in my script (e.g when 
playing segments). I would think that the script would complain if the 
audiopath weren't loaded. Has anybody else had any problems with this?


Now, let's see if we can make it stream audio too (preferrably from a 
compressed source). The thing is that I can't load all the audio data into 
memory at the same time, so I guess I would need to stream it. I suppose that I 
need to provide the GetObject with a IStream pointer that it can stream from? 
Any other ideas? :)

Thanks a lot for the quick response and all the help :D!

//Tomas



Other related posts: