Jump to content
  • Advertisement
Sign in to follow this  
adam23

DirectMusic question?

This topic is 4511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm pretty sure this post should go here. I am learning how to create a sound class for my project using DirectMusic. I have a question on the call to CoCreateInstance. I have two variables: IDirectMusicLoader8 *m_loader; CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (void**)&m_loader ); This is probably a dumb question buy why is m_loader cast with (void**). I don't understand the reason or what this is accomplishing. Thanks in advance for the help.

Share this post


Link to post
Share on other sites
Advertisement
Hmmm maybe I'm not right, but I think that's because DirectX stuff innherits from IUnknown interface. So you have to pass void pointer to it because IUnknown interface does not know which type you are using so interface use void*. That's why is there another pointer to reference (void**)& to get proper adress of DirectX interface (in this example DirectMusic).

But maybe I'm wrong [smile]

Share this post


Link to post
Share on other sites
CoCreateInstance can actually create COM objects of any type depending on the other parameters, so it expects a void** to put the result into instead of a IDirectMusicLoader8** or whatever.

tj963

Share this post


Link to post
Share on other sites
Thanks for the help, I remember reading about the IUnknown.

Thanks again for the quick replies.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!