Every VST SDK seems to be for C++, what about C#?

13,511

Solution 1

VST.NET is not for C++. Where did you get that idea? Go to the code of VST.NET and check out the samples. That will make things clearer - I hope.

Hope it helps. Marc Author of VST.NET and MIDI.NET

Solution 2

Steinberg's VST plug-in architecture has been around a long time, first released in 1996. .NET of course would take another 6 years so of course a lot of sample code is in C++. VST v3 uses COM to make it easier to develop plug-ins in languages other than C++.

There are two kinds of COM, the "pure" kind that's based on the IUnknown interface. And the "practical" kind that's based on IDispatch, otherwise known as OLE Automation or ActiveX, these days just called Automation since the name recognition for "ActiveX" no longer instills confidence :)

The C# language works very well with the "practical" kind. Which supports type libraries, a file format that describes the types implemented by a COM server. Very easy to use in a C# program, you simply add a reference to the type library and it acts like just a normal .NET assembly. VSTs however use the pure kind, you don't have the handy type library available to import the interface declarations.

Writing plug-ins in C# is still possible, you have to re-declare the VST interface types in the C# language or use a C++/CLI wrapper to bridge the gap. Pretty painful to get this right, but it has been done before. Like in this open source project. Or this one. No idea how good they are btw, not an endorsement. The first link is for VST.NET. It is a managed wrapper, not for C++. After it is compiled anyway, it uses C++/CLI to take care of the native interop. The second wrapper isn't exactly usable anymore since it requires the Steinberg SDK. Which was discontinued just recently. Ominous sign of course.

Solution 3

I'd like to second Obiwanjacobi. I've been using VST.Net for several months, and it is excellent.

There's certainly an argument for using C++ because it does allow finer grained control of CPU optimization. But, it's a myth to say that C++ code is necessarily faster than C# code. C# does a lot of the hard work for you like memory management and so on. Basically, when someone says C++ is faster than C# they are not really comparing apples with apples. But, nonetheless, language is a personal choice.

I thought I'd add this link because if you are going to create VSTs, you will need controls. Here is a set of controls in the beta phase. They are designed for VSTs. They are skinnable and light weight.

https://bitbucket.org/MelbourneDeveloper/vst-controls-.net

Share:
13,511
Admin
Author by

Admin

Updated on June 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I want to start making VSTi's, more specifically, midi ones - those who don't produce any sounds but just output midi data to other vst plugs (arpeggiators, chord tools, etc).

    Now I've just bought books for C# thinking it would be a nice language to begin with (not just for vst programming), but everyone keeps saying C++ is the way to go, and VST.NET seems to be for C++....just seems everything is going against me on my C# road?

    I have the "programming thinking" in my head but it was years ago since I programmed, Visual Basic, Turbo Pascal, and such. So I'm at a pretty clean start.

    What's your advice here, sell my new C# books (or hide them in the bookshelves) and aim for C++, or is C# still ok? I've always thought C++ is alot more complicated than C#, to learn.

    By the way, say the VST.NET SDK for C++, can it be used for C# in some way?

  • Admin
    Admin over 10 years
    I don't know where I saw something that said VST.NET would be unsuitable. Either I thought I needed to use an old version of Visual Studio C#.net, or I saw someone say C# is too slow and i should learn C++ instead.
  • obiwanjacobi
    obiwanjacobi over 10 years
    VST comes in two flavors 2.x and 3.x. The latest is interface based and those interfaces are COM compatible. The 2.x version has nothing to do with COM and that is the version that is supported by VST.NET. Many feel that the 3.x is bloated and makes developers lifes hard for no good reason. Not all hosts support the 3.x version of VST.
  • obiwanjacobi
    obiwanjacobi over 10 years
    It is true, that if you want to do blazingly fast hand-optimized assembly with complex DPS algorithms with low CPU usage you should go for C++. Gives you far more control and less overhead than .NET - because each call between host and plugin (and visa versa) is marshalled - a C++ code layer that makes sure both worlds (managed and unmanaged) can talk to each other. But for prototyping or simpler (MIDI) plugins VST.NET has far greater productivity than native C++ VST (SDK).
  • Brent Washburne
    Brent Washburne about 9 years
    Can you cite references to support your opinion?
  • increddibelly
    increddibelly about 8 years
    this hurts my eyes. Please don't confuse opnion with fact. I think what you were trying to say is what Melbourne Developer and obionejacobi above have said - so it might have been better to not say anything at all.