6

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?

cause4concern
  • 63
  • 1
  • 1
  • 3

5 Answers5

7

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

oo_dev
  • 777
  • 7
  • 20
obiwanjacobi
  • 2,413
  • 17
  • 27
  • 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. – cause4concern Jan 11 '14 at 19:29
  • 3
    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). – obiwanjacobi Jan 12 '14 at 08:14
3

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.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 1
    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 Jan 12 '14 at 08:11
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

Christian Findlay
  • 6,770
  • 5
  • 51
  • 103
0
  1. If working with one specific dll, use p/invoke to create a wrapper, implementing functions as detailed in the VST SDK.
  2. If using a generic method for a set of VSTs, create a mixed mode ref class wrapper, passing the filename as an argument - you need to do this in C++. This class marshals data between managed and unmanaged memory.
  3. Since VST3 is the latest VST standard, and is COM compatible, instantiate using COM. For some ideas, see How do I go about instantiating a COM Object in C# by CLSID?
Toby Speight
  • 27,591
  • 48
  • 66
  • 103
  • 1
    Annnnd this isn't an answer, shouldn't be posted as such BUT as a comment, if you can't comment then try answering whenever you can with complete and detailed post since as it is right know you are not helping the site in any way but encouraging bad behavior and polluting the site. If you want to talk about community related things, then head towards the meta. Answers and comment are not here for that. – N.K May 22 '18 at 13:21
  • just want an answer to the question, recommendations for VST.NET are all anyone gets when asking this particular question. Nothing technical about an advert. –  May 22 '18 at 13:30
  • Yet it answers the OP's question well enough for him to chose an "ad" as the correct answer to it's problem, aswell as admitting it helped under the comment section. You are not here to decide whether or not an answer is usefull to the OP's problem and neither am I, we are here to flag useless answers posted as such not more. Each problem is different, specific in a way or another, if you are not happy with the answers on this post, create your own question as you don't need any rep to do that, and specify that you don't want to use VST.NET. – N.K May 22 '18 at 13:38
  • Is VST3 really COM compatible? That would make it Windows only. AFAIK, if you read the docs properly, it is mentioned that VST-MA "mimics" COM. A VST3 DLL doesn't expose `DllRegisterServer` and friends needed for COM, nor do they need to be registered or have a side-by-side manifest – demberto Sep 23 '21 at 11:37
-7

The reason is simple. C++ is one of the lowest level high level languages. C# and Java are often the best tools for a web app or a business app. Never for a multimedia app where the size of the footprint is exponentially and inversely proportional to its performance. ;)

madhtr
  • 23
  • 3
  • 4
    Can you cite references to support your opinion? – Brent Washburne Mar 14 '15 at 00:14
  • 3
    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. – increddibelly Apr 26 '16 at 07:31