This project has moved and is read-only. For the latest updates, please go here.

new base VST

Topics: Getting Started
Feb 14, 2014 at 2:09 PM
Edited Feb 25, 2014 at 1:15 PM
I built a harness bare VST that does nothing so I can test if Sonar picks it up and shows it in the VST list. After telling sonar to look in the folder with my compiled VST DLL it does not recognize it. Any idea why?
Feb 14, 2014 at 4:44 PM
Lets first try to get one of the VST.NET sample plugins to load.
Put the plugin and VST.NET dlls in one folder and point to the [plugin-name].dll to open it in the DAW.

The dlls are:
[plugin-name].dll (this is Jacobi.Vst.Interop renamed to represent your plugin).
[plugin-name].net.vstdll (this is your managed assembly)

Once you have successfully opened one of the sample plugins, we can try to get your own plugin to work.

Hope it helps,
Feb 14, 2014 at 9:45 PM
Ah.. I must have missed the "Jacobi.Vst.Interop.dll" since it wasn't in the AnyCPU folder. Just noticed that there is one in the x64 and one in the x86 folders of the "VST.NET". Which one should I use if compiling for AnyCPU?
Feb 15, 2014 at 8:24 AM
The Jacobi.Vst.Interop is the first assembly to load and determines what CLR flavor is used (CLR2 or CLR4). In that respect it is important to choose the one that suites your project. (probably CLR4 if you use VS2010 or higher).

The x86/x64 are the 32/64 bit versions. Normally with .net you hardly ever need to worry about 32/64 bit because you code is compiled to IL. But because the Jacobi.Vst.Interop assembly is a hybrid of managed and unmanaged C++ code it becomes important. If you have a 64 bit host - choose the 64 bit assembly, otherwise 32 bit is fine.

Hope it helps.
Feb 15, 2014 at 11:12 AM
Edited Feb 15, 2014 at 11:38 AM
I am running Win 7 64 bit with Sonar. I compiled the Source\Samples\Jacobi.Vst.Samples.Delay.VB project and renamed it "". Copied it to the VST folder along with the "..core.dll" and "..framework.dll". I also used the interop from Code\CLR4\x86\Release\ and placed it in the same folder renamed as "test.dll". Opened Sonar and I get an error during the "scanning test.dll" phase:

Feb 15, 2014 at 1:28 PM
Edited Feb 15, 2014 at 1:30 PM
"An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. [..]"

Looks to me like the folder your loading from is not local on your PC...?

For now the solution seems to be to make a local folder on your PC - also check the security properties of the folder and make sure the current user has access.

I will look into enabling loading from remote sources (as the error describes).

EDIT: ah you may also want to check the file properties of the Jacobi.Vst.* dlls. Make sure you "Unblock" them!
Feb 17, 2014 at 7:02 AM
All the files are local. In fact they are on my desktop. I did "Unblock" them though. They were blocked as you had suspected. The above error is gone, however I now get a different error while SONAR X3 is scanning form my plugin. The error is:

Feb 17, 2014 at 8:38 AM
What plugin are you trying to load?

Attach the debugger and post the call stack so we can see what VST.NET method was called...

Feb 17, 2014 at 5:46 PM
The crash window is from FXTeleport which is used to deal with non local files Vst.
Feb 18, 2014 at 6:32 AM
YuryK, all the VST dlls are in a folder on the desktop, so nothing is non local.
Feb 18, 2014 at 6:50 AM
obiwanjacobi, I am using the sample plugin "Jacobi.Vst.Samples.Delay.VB", but I tried the others including my own bare one and all cause the same exception. How do you propose I attach the debugger to the SONAR VST scanner when the app crashes the moment SONAR starts no allowing me to have a chance to attach to it. Has anyone got one of these VSTs to work with SONAR X3 successfully? Maybe there is a compatibility issue.

SONAR does its VST scan immediately when it starts up. After the crash its VST scanning component freezes in memory and is stuck until the process is killed from the task manager.
Feb 18, 2014 at 6:54 AM
Try specifying the (sonar).exe as a startup program in your debug tab of the VS project settings...
Feb 18, 2014 at 7:43 AM
Edited Feb 18, 2014 at 7:44 AM
Just saying if you have a crash window from Teleport Server (FXTeleport), you might want to investigate what this third party software does.
Feb 24, 2014 at 7:43 PM
Used the "CLR4\x64\Release" DLLs and now I get no crash. Sonar claims it found the new VST but I don't see it in its PlugIns list. There are three categories: Audio FX, Midi FX, Instruments, and Rewire. Where and how should I see it listed if I defined my plugin like this? :
Friend Class Plugin
    Inherits VstPluginWithInterfaceManagerBase

    Public Sub New()
        MyBase.New("MIDI Staff Plugin", New VstProductInfo("MIDI Staff Plugin", "ACME Systems", 1000), VstPluginCategory.Analysis, VstPluginCapabilities.None, 0, 902936407)
    End Sub

    Protected Overrides Function CreateMidiProcessor(instance As IVstMidiProcessor) As IVstMidiProcessor
        If instance Is Nothing Then Return New MidiProcessor(Me)
        Return instance
    End Function

    Protected Overrides Function CreateEditor(instance As IVstPluginEditor) As IVstPluginEditor
        If instance Is Nothing Then Return New PluginEditor(Me)
        Return instance
    End Function

    Public ReadOnly Property ChannelCount() As Integer
            Dim objHostMidiProcessor As IVstMidiProcessor = Nothing
            If Me.Host IsNot Nothing Then objHostMidiProcessor = Me.Host.GetInstance(Of IVstMidiProcessor)()
            If objHostMidiProcessor IsNot Nothing Then Return objHostMidiProcessor.ChannelCount
            Return 0
        End Get
    End Property

End Class
Feb 25, 2014 at 8:34 AM
Under the covers of VST.NET the VST interface communicates the plugin capabilities using some flags and 'CanDo's. The VST.NET Framework looks at the implementation of the plugin - what interfaces are supported - and some extra flags (VstPluginCapabilities) to automatically communicate these capabilities.

I don't know how Sonar interprets Audio Fx, Midi Fx, and instruments - but I suspect that
  • Audio Fx are plugins that support the IVstPluginAudioProcessor (I/O),
  • Midi Fx are plugins that support IVstMidiSource (output) and the IVstPluginMidiProcessor (input) and
  • Instrument Fx are plugins that receive Midi input and output audio (synth).
    Rewire is a different concept/standard not related to VST.
Looking at you code you only implement a Midi output (IVstMidiSource) - My guess is that this confuses Sonar...?
Try also implementing the IVstPluginMidiProcessor - if only a dummy implementation...

Hope it helps,
Feb 25, 2014 at 1:14 PM
Actually it is quite the opposite. I am only implementing IVstMidiProcessor and not IVstMidiSource. The purpose of my VST is to show notes on a score sheet as they are being played so I only need to read MIDI not output it. Here is the MidiProcessor class implementation:
Class MidiProcessor
    Implements IVstMidiProcessor

    Private _objPlugin As Plugin

    Public Sub New(objPlugin As Plugin)
        _objPlugin = objPlugin
    End Sub

    Public ReadOnly Property ChannelCount() As Integer Implements IVstMidiProcessor.ChannelCount
            Return _objPlugin.ChannelCount
        End Get
    End Property

    Public Sub Process(objEvents As VstEventCollection) Implements IVstMidiProcessor.Process
        For Each objEvent As VstEvent In objEvents.Where(Function(e) e.EventType = VstEventTypes.MidiEvent)
            Dim objMidiEvent As VstMidiEvent = objEvent
            If (objMidiEvent.Data(0) And &HF0) = &H80 OrElse (objMidiEvent.Data(0) And &HF0) = &H90 Then
                'capture MIDI events here
            End If
    End Sub

End Class
Feb 25, 2014 at 1:52 PM
Ah, you're right of course.

I would suggest you implement a dummy IVstPluginAudioProcessor - that will work for most hosts out there. There are some sample plugins that do that also.