Jump to content
  • Advertisement
Sign in to follow this  
bjut

DirectMusic in a .NET environment (C# or C++.NET)?

This topic is 5393 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

hi guys! Is it possible to use DirectMusic in either C# or C++.NET? If any of you has done it already, could you show me some snippets as to how I would be able to do common stuff (creating objects, accessing the DMusic interfaces, etc.) because its really confusing trying to use COM in .NET. Here's what I've learned so far: I've read somewhere that DMusic is a "pure" COM object so you could only use it in C++ and so far, that's quite correct. COM interop samples in MSDN always talked about having to reference the type library of the COM object into your project. DMusic, however, doesn't have a type library. All I have are the Header files (dmusici.h, etc.) which you could include in your typical C++ projects, of course, but not in C#. Adding a reference to dmusic.dll directly also didn't work. haha. It was worth a try. So referencing DMusic is also a problem in .NET. The reason why we're trying to push with .NET is because coding the user interface in C++ takes so much work as compared to the visual tools in c++.NET and c# and also to take advantage of the .NET framework benefits. There are a couple of solutions that could work like simply putting your whole Dmusic code into a C++ DLL and then just access it in c# using DllImport. Problem is, the DLL would need to do a lot of work like managing the numerous audiopaths that the application would create and the operations you would do to each of them, etc. Compared to this solution, doing it in plain c++ would be better and less complicated. So back to the question, has anyone used Dmusic in .NET? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
ey maega!

Thanks a lot for the reply! So it's possible to use DMusic in .NET if you wrap the interfaces in a .NET compatible class. Problem is, it's going to take a lot of work to wrap ALL the interfaces of DMusic just for the sake of using it in .NET.

Thanks again for the info!

Share this post


Link to post
Share on other sites
bjut, you can generate a Run-Time Callable Wrapper with tools that are included in the .NET Framework SDK (namely, tblimp). This should speed up the process quite a bit. Just use tblimp to generate a managed wrapper around a COM Component, and then tweak as necessary. No reason to code it all yourself :).

Share this post


Link to post
Share on other sites
hi bL0wF1sH!

yup i've read about tblimp.exe and it doesn't work. i've tried this:
tblimp.exe dmusic.dll /out:dmusicnet.dll /verbose

it gave an error saying:
TlbImp error: The input file "dmusic.dll" is not a valid type library.

I also tried adding it through the "Add Reference" option when you right-click a project icon in solution explorer. It doesn't show up among the list of COM components so I browsed for the DLL instead. It also gave an error saying that dmusic.dll is not a valid COM component.

The only thing that worked so far is by importing the header files in C++ (and in C++.NET as maega posted). I guess you really need to go through the header files to be able to use it.

Anyway, we've decided to go with C++ now and I think that it's also a good thing, in terms of experience, for a programmer to get his hands dirty on C++. Just keep saying that to keep myself from going crazy with all this cryptic code. hehe

Now I wonder how you could make a button in c++? oh boy...haha

Thanks again!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!