Created
June 20, 2010 15:17
-
-
Save atsushieno/445909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Text; | |
using Jacobi.Vst.Core; | |
using Jacobi.Vst.Interop.Host; | |
using Jacobi.Vst.Samples.Host; | |
namespace Commons.Music.Midi.Vst | |
{ | |
public class Driver | |
{ | |
public static void Main (string [] args) | |
{ | |
var player = new VsqPlayer (args [0]); | |
} | |
} | |
public class VsqPlayer | |
{ | |
public VsqPlayer (string pluginPath) | |
{ | |
GetContext (pluginPath); | |
} | |
VstPluginContext GetContext (string pluginPath) | |
{ | |
HostCommandStub hostCmdStub = new HostCommandStub(); | |
hostCmdStub.PluginCalled += new EventHandler<PluginCalledEventArgs>(HostCmdStub_PluginCalled); | |
VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub); | |
// add custom data to the context | |
ctx.Set("PluginPath", pluginPath); | |
ctx.Set("HostCmdStub", hostCmdStub); | |
// actually open the plugin itself | |
ctx.PluginCommandStub.Open(); | |
return ctx; | |
} | |
void HostCmdStub_PluginCalled (object sender, PluginCalledEventArgs e) | |
{ | |
HostCommandStub hostCmdStub = (HostCommandStub) sender; | |
// can be null when called from inside the plugin main entry point. | |
if (hostCmdStub.PluginContext.PluginInfo != null) | |
Debug.WriteLine ("Plugin " + hostCmdStub.PluginContext.PluginInfo.PluginID + " called:" + e.Message); | |
else | |
Debug.WriteLine ("The loading Plugin called:" + e.Message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment