Giter VIP home page Giter VIP logo

Comments (27)

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 3

I have found an x64 version of ijwhost.dll so I guess that means a 64 bit build is not out of the question - just VS that uses the wrong version??

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 3

Good news!

The Jacobi.Vst.Interop dll loads with dotnet core into an unmanaged DAW host! (I use vsthost for testing)

This was my major concern which now has been taken away. The code does not work yet -need an alternative for the ConfigurationManager- but that is a matter of iron out the wrinkels until the samples run.

Remember: this is still a Windows only solution.

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 2

The hardest part in porting VST.NET to anything else is the unmanaged-managed bridge. Jacobi.Vst.Interop has C++ code that interacts with .NET. These are Microsoft-specific extensions on the C++ language and are not portable (AFAIK).
I do not know enough of dotNet Core to be certain, but my understanding now is that it does not change this or has any feature that will solve it.
So my suggestion would be to do a proof of concept to first get the managed-unmanaged bridge working before you spent your time on porting the rest of the (.NET) code.

I am sure (controlling) garbage collection is not your biggest issue here. ;-)

from vst.net.

Drachenkaetzchen avatar Drachenkaetzchen commented on July 30, 2024 2

I'm also interested in this since my project PresetMagician uses vst.net and people are complaining about the lack of osx support ;)

@MelbourneDeveloper if you have something developed, I'd be more than happy to test/contribute

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 2

I am not making any promises but uhhh
https://github.com/obiwanjacobi/vst.net/tree/netcore3/Source.Core/Code

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 2

Houston, we have a problem.
Turns out that the interop assembly no longer loads in the DAW.
This may turn out to be bigger than I thought...

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 2

While I work on getting details sorted (already bumped into the next one) you guys could tell me how you want the API to look here: #21

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 2

You should now be able to clone the netcore3 branch, build the Source.Core code and run the delay sample plugin.
Please try it out and report any problems you may have. Thanks.

Edit: Added some of the other samples too.

from vst.net.

cambo2015 avatar cambo2015 commented on July 30, 2024 1

+1 .net core support would be amazing. Has there been any changes on this since .net core 3 has come out?

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

Looks like it can be done (in theory).
https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-1
There is support for the C++ .NET extensions in Core3.1.
This is still a Windows Only option, though.

Now it is a matter of trying to port the sources.

Would this also be a good time to change the API where it needs improvement?
Any parts of the API you don't like or don't use?

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

Got a little further - but only a little.
Turns out you need ijwhost.dll (some sort of .net core host) with your plugin dlls. Only problem is that I can only find a x86 version. So your plugin will be x86.
Loading interop into my favorite test host (vsthost) failed with a file-not-found. Only problem is I cannot see what file that is missing... Could be one of my dependencies (like winforms?) or...

'vsthost.exe' (Win32): Loaded '[..]\vst.net\Source.Core_SharedAssemblies\Jacobi.Vst.Interop.dll'. Symbols loaded.
'vsthost.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'.
'vsthost.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
'vsthost.exe' (Win32): Loaded '[..]\vst.net\Source.Core_SharedAssemblies\Ijwhost.dll'.
'vsthost.exe' (Win32): Unloaded '[..]\vst.net\Source.Core_SharedAssemblies\Ijwhost.dll'
'vsthost.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'.
'vsthost.exe' (Win32): Loaded '[..]\vst.net\Source.Core_SharedAssemblies\Ijwhost.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\host\fxr\3.1.1\hostfxr.dll'.
'vsthost.exe' (Win32): Unloaded 'C:\Program Files (x86)\dotnet\host\fxr\3.1.1\hostfxr.dll'
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\host\fxr\3.1.1\hostfxr.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\hostpolicy.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\coreclr.dll'.
'vsthost.exe' (Win32): Unloaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\coreclr.dll'
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\coreclr.dll'.
Exception thrown at 0x76DB3DB2 (KernelBase.dll) in vsthost.exe: 0x04242420 (parameters: 0x31415927, 0x08FA0000, 0x0018F540).
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Private.CoreLib.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\clrjit.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Runtime.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\Microsoft.DiaSymReader.Native.x86.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Threading.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Runtime.Extensions.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Runtime.CompilerServices.VisualC.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Diagnostics.Debug.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Runtime.InteropServices.dll'.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\System.Collections.NonGeneric.dll'.
Exception thrown at 0x76DB3DB2 in vsthost.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0018DE28.
Exception thrown at 0x76DB3DB2 in vsthost.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x76DB3DB2 in vsthost.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x76DB3DB2 (KernelBase.dll) in vsthost.exe: 0xE0434352 (parameters: 0x80070002, 0x00000000, 0x00000000, 0x00000000, 0x08FA0000).
Exception thrown at 0x76DB3DB2 in vsthost.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\mscordaccore.dll'.
'vsthost.exe' (Win32): Unloaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\mscordaccore.dll'
'vsthost.exe' (Win32): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\mscordaccore.dll'.
'vsthost.exe' (Win32): Unloaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\3.1.1\mscordaccore.dll'
Exception thrown at 0x76DB3DB2 in vsthost.exe: Microsoft C++ exception: CSEHException at memory location 0x0017F5C0.

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

You're a little ahead of the troops - I have not looked into the host support for dotnet-core yet.
Matching the platform (x86/x64) of your project with the Jacobi.Vst.Interop could be a good idea. VST.NET-core does not support AnyCPU anymore (because interop cannot be AnyCPU). Both plugin and host support live in interop.

You should be able to get the latest version out of the netcore3 branch and build it (Debug/Release/x86/x64). That should result in the assemblies ending up in the _SharedAssemblies folder. As a host you need Jacobi.Vst.Core and Jacobi.Vst.Interop (and ijwhost.dll). Not sure if you need the .runtimeconfig.json but it probably couldn't hurt.

I am learning dotnet-core myself as I do this, so a lot is new to me (too).

Clr2 and Clr4 are project versions of the CLR for the .NET full-framework. Those are not dotnet-core.
I ported the code by creating a new dotnet-core project and copying in the code (*.cs). Most of the code compiled straight away.

The Host sample is not a working host - it just demonstrates how to call the API. Let me know how you like that API ;-)

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

Progress:
I have changed the config to json.
Struggling to create a good nuget package and get deployment of plugins sorted.
Added the host sample and got it working //cc @sirjeppe (thanks for the ijwhost.dll tip!)

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

You can't. It's still Windows only.
That has to do with the mixed C++/CLI project. Until we find a better way of doing the interop VST.NET is not cross platform.
Sorry.

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024 1

It was my plan to try to get the VST3 code cross platform - but I do not have any ideas at the moment how to get there.
Currently the VST3 implementation requires COM-interop and a very thin C++/CLI interop to get things bootstrapped. It is unlikely that Microsoft will invest in COM interop on other platforms however. I do not have any clue how to do this differently.

While I really appreciate donations, I do have a full time job and a family. So throwing money at the problem will not get it done quicker if it is just me. To my knowledge nobody is looking into getting true cross platform support.

from vst.net.

sirjeppe avatar sirjeppe commented on July 30, 2024

I'm also interested in .NET Core 3 support :-)

from vst.net.

sirjeppe avatar sirjeppe commented on July 30, 2024

That sounds very promising :-)

I'm afraid I have not yet started the integration of VST.NET so I have no feedback to you on the API at this moment. I'm sorry! I really appreciate the quick response and question :-)

Thank you!

from vst.net.

cambo2015 avatar cambo2015 commented on July 30, 2024

@obiwanjacobi Understandable. Thank you! 😎 This is great.

from vst.net.

sirjeppe avatar sirjeppe commented on July 30, 2024

Wow! You work lightning fast :-D This is great news indeed. Looking forward to taking it for a spin when it's ready :-) Thank you so much!

from vst.net.

sirjeppe avatar sirjeppe commented on July 30, 2024

Hi!

I have started integrating VST.NET (making a host) and I had to apply the following patch to get the Interop project to build successfully:

diff --git a/Source.Core/Code/Jacobi.Vst.Interop/Jacobi.Vst.Interop.vcxproj b/Source.Core/Code/Jacobi.Vst.Interop/Jacobi.Vst.Interop.vcxproj
index 2435ec7..1ac7492 100644
--- a/Source.Core/Code/Jacobi.Vst.Interop/Jacobi.Vst.Interop.vcxproj
+++ b/Source.Core/Code/Jacobi.Vst.Interop/Jacobi.Vst.Interop.vcxproj
@@ -54,6 +54,7 @@
     <PlatformToolset>v142</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <CLRSupport>NetCore</CLRSupport>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -164,6 +165,7 @@ xcopy "$(TargetDir)ijwhost.dll" "$(SolutionDir)..\_SharedAssemblies\ijwhost.dll*
       <ConformanceMode>true</ConformanceMode>
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
       <DisableSpecificWarnings>4691</DisableSpecificWarnings>
+      <AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

Is there something else I should have done instead? It seems to be working at least. And after some, heavy, modifications to the Host sample (Clr4, what does that stand for?) I also managed to actually load and show a plugin in my dotnet Core 3.1 WPF host application. ... after tearing my hair over getting a BadImageFormatException without any additional clues and after finding some obscure post somewhere that explained that I needed to copy the ijwhost.dll to the output folder of my application, and that finally made it come through all the way! :)

from vst.net.

sirjeppe avatar sirjeppe commented on July 30, 2024

Thank you for the info :-)

I got a host up and running from your branch, so everything is going well for me. I just wanted to let you know that I required to alter the settings of the Interop project for it to build. I couldn't build it out of the box after checking out your branch.

Right now I'm struggling with getting the VST plugin to render inside a win32 window inside a UserControl instead of the main window. Just getting a white background at the moment.

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024

I just wanted to let you know that I required to alter the settings of the Interop project for it to build. I couldn't build it out of the box after checking out your branch.

What setting did you change -can't make out the diff you posted-...?
/Zc:twoPhase- ??

Right now I'm struggling with getting the VST plugin to render inside a win32 window inside a UserControl instead of the main window. Just getting a white background at the moment.

Could be they expect a top-window (with a frame etc). Maybe just use a (Windows) Form and pass the Handle to the plugin? The rendering of WPF works on DirectX (if I understood correctly) - totally different than the GDI based drawing of native Windows... (which is what the plugin expects) [2c]

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024

Closing this. If you want to discuss details, join the VST.NET Discord server or post a new issue.

from vst.net.

MelbourneDeveloper avatar MelbourneDeveloper commented on July 30, 2024

@obiwanjacobi so stoked about this! I plan to resurrect my project and redo the UI with Avalonia UI.

Are there any resources on what it would take to get this working on macOS? Is anyone in the community working on it at all?

from vst.net.

MelbourneDeveloper avatar MelbourneDeveloper commented on July 30, 2024

@obiwanjacobi yes, I understand, but what I mean is: is there any effort underway to get to that point?

Is anyone in the community looking at it? What if there were funding for it?

from vst.net.

MelbourneDeveloper avatar MelbourneDeveloper commented on July 30, 2024

@obiwanjacobi I don't think too many DAWs even support VST3.

I assume that you would need to write C++ interop on Mac. It will be possible. It's just a matter of finding the time.

The fact that you have it running on .NET Core is a very good starting point though. That means I can start porting my UI to Avalonia UI which is 100% cross-platform, and as soon as there is interop for Mac, it will just work.

Appreciate your hard work. I'm resurrecting my old code at the moment.

from vst.net.

obiwanjacobi avatar obiwanjacobi commented on July 30, 2024

I resurrected the VST3 code because Steinberg dropped VST2 from their SDK. I also think that all the major brand DAW's currently support VST3 and it is where the future of VSTs is going.

The C++ interop allows you to create a .NET class instance and interact with it. That currently only works on Windows. Note this is NOT P/Invoke! - it is the reverse (the other way around) of that. So until .NET (core or 5) natively supports something like DllExport (the opposite of the P/Invoke DllImport) I see no way to get this going on anything but Windows.

I have looked into libraries that say they support DllExport for .NET core. How ever I have not been able to get it to work with my VST3 sample plugin. If anyone knows how to get a DllExport scenario working (cross-platform), I think I can get VST3 to work cross platform (assuming the basic COM interop (calling COM components) works on linux and mac?) and probably VST2 too - but I have to look into that more.

So no - I don't think it will just work but I would love to proven wrong.

from vst.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.