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

1d3c50cac59ac38fe57eac3ee91aba76
0
bjut 101 Oct 12, 2004 at 07:26

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!

4 Replies

Please log in or register to post a reply.

A4564b5cb1c01f4d0731f7bdf007246b
0
Lynn 101 Feb 06, 2005 at 13:48

Hi.

I know I am responding to an old post, but I’ve had trouble with the same issues.

I was wondering if you figured out how to use DirectMusic with VisualStudio.Net applications.

I know some VB.Net and now I’m learning C#.NET. This semester I am doing a game programming project using Managed DirectX.

My first programming class used VB.NET and VisualStudio 2003 last semester, so I am very new at programming. I downloaded DirectMusic Producer and started playing around with it, only to figure out the hard way that it probably wouldn’t work with Managed Direct X!

Please let me know what you have found out. I work full-time so I don’t have time to learn “old” programming stuff.

I don’t have to worry about coming up with music, I have lots of it. (Composing music has been my long-time hobby and I’ve been an Apple/Mac person since 1985. I have a Motif 8 and Digital Performer 4 (MOTU) on my mac and have composed using MIDI sequencing software for about 13 years.)

A4564b5cb1c01f4d0731f7bdf007246b
0
Lynn 101 Feb 06, 2005 at 13:49

@bjut

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!

[snapback]12688[/snapback]

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Feb 06, 2005 at 17:25

what exactly is your problem with getting managed directx to play your music ?

1d3c50cac59ac38fe57eac3ee91aba76
0
bjut 101 Feb 16, 2005 at 01:39

@anubis

what exactly is your problem with getting managed directx to play your music ? [snapback]15823[/snapback]

hello! wow someone replied to my post hehe…anyway, we pushed through with C++ instead of .NET already. thanks for everyone who replied.

The problem before was that the DirectMusic objects couldn’t be directly instantiated in .NET because it needed to be initialized and created by COM (particularly the Performance and Loader objects). I guess a .NET wrapper class would work ( I have no idea how to do it though) but it would require added work for wrapping the objects up. so we decided to go with C++ instead and get the benefit of more speed and power and less overhead (due to the .NET framework) in exchange for faster UI production when using .NET.