vb host?

Topics: Host Development
Mar 14, 2011 at 3:11 AM
Edited Mar 14, 2011 at 3:12 AM

Hi,

I am trying to make an app in vb.net that will pass audio from the microphone into a vst plug-in.  I have tried converting the sample host to vb.net but I get lots of errors.  Has someone made a host with vb.net?

Thanks

Coordinator
Mar 14, 2011 at 7:21 AM

A simple trick is to load the sample host assembly into Reflector (Red Gate) and view the source code in VB.

There are even add-ins for Reflector that save a complete project back to disk.

Hope it helps,
Marc

Mar 15, 2011 at 12:00 AM

I tired using Reflector but I keep getting lots of errors. HostCommandStub has the most.  I have tired using an online converter too but yet there are errors in it.

Thanks

Coordinator
Mar 15, 2011 at 9:47 AM

What (kind of) errors are you getting?

And what is your VB experience level? (beginner/intermediate/senior/expert)

Mar 16, 2011 at 3:10 AM
Edited Mar 16, 2011 at 3:11 AM

I have programmed a few applications in VB before but only at the beginner level.

 

These are the errors I am getting, everything was exported from Reflector.

'AddHandler' definition missing for event 'PluginCalled'.

Statement cannot appear within an event body. End of event assumed. (this happens for public function under where it says methods)

Identifier expected. (This happens where it says "<PluginContext>"

 

        ' Events
        Public Custom Event PluginCalled As EventHandler(Of PluginCalledEventArgs)

            ' Methods
        Public Function BeginEdit(ByVal index As Integer) As Boolean
            Me.RaisePluginCalled(("BeginEdit(" & index & ")"))
            Return False
        End Function


        ' Fields
        <CompilerGenerated> _
        Private <PluginContext>k__BackingField As IVstPluginContext

Thank you.

Coordinator
Mar 16, 2011 at 9:31 AM

The bottom part is compiler generated code for a property of type PluginContext. You will have to change that into something VB understands.

The way the event is declared is not correct. I think you should remove "Custom" ...?
I'm not a VB coder ;-) Check online for examples.

Hope it helps.

Mar 19, 2011 at 9:34 PM

Hi,

I gave up on trying to port the app to vb.net so I just downloaded visual c# express.  Now when I try to build the sample host in c# I get an error each time "{ get; set; }" is in the code.  Do you know what this means?

 

Error    1    'Jacobi.Vst.Samples.Host.HostCommandStub.PluginContext.get' must declare a body because it is not marked abstract or extern    HostCommandStub.cs    31    50
Error 2 'Jacobi.Vst.Samples.Host.HostCommandStub.PluginContext.set' must declare a body because it is not marked abstract or extern HostCommandStub.cs 31 55
Error 3 'Jacobi.Vst.Samples.Host.PluginCalledEventArgs.Message.get' must declare a body because it is not marked abstract or extern HostCommandStub.cs 235 33
Error 4 'Jacobi.Vst.Samples.Host.PluginCalledEventArgs.Message.set' must declare a body because it is not marked abstract or extern HostCommandStub.cs 235 46
Error 5 'Jacobi.Vst.Samples.Host.EditorFrame.PluginCommandStub.get' must declare a body because it is not marked abstract or extern EditorFrame.cs 26 79 Error 6 'Jacobi.Vst.Samples.Host.EditorFrame.PluginCommandStub.set' must declare a body because it is not marked abstract or extern EditorFrame.cs 26 84 Error 7 'Jacobi.Vst.Samples.Host.PluginForm.PluginContext.get' must declare a body because it is not marked abstract or extern PluginForm.cs 16 49
Error 8 'Jacobi.Vst.Samples.Host.PluginForm.PluginContext.set' must declare a body because it is not marked abstract or extern PluginForm.cs 16 54

Thank you

 

Coordinator
Mar 21, 2011 at 7:09 AM

Not sure. It seems that the short syntax for delcaring properties is not recognized.

Normally you can type "public string MyProperty { get; set; }" and the compiler will generate the backing field for it (thats what you saw in your reverse-enginered VB code).

You can always try implementing the properties yourself... something like:

private Type _myProperty;

public Type MyProperty
{
    get { return _myProperty; }
    set { _myProperty = value; }
}

Hope it helps,
Marc

Mar 23, 2011 at 1:14 AM

I got it to work thanks!

I downloaded C# express 2005 because I have an old computer.  That's probably why short hand for declaring properties doesn't work.