我已成功简化Vst.net host sample以直接加载vst乐器。大多数情况下,我只是剥离了GUI并使其自动触发了一些测试笔记。当我将其构建为控制台应用程序时,此代码可以正常工作。
using System;
using Jacobi.Vst.Core;
using Jacobi.Vst.Interop.Host;
using NAudio.Wave;
using CommonUtils.VSTPlugin;
namespace Jacobi.Vst.Samples.Host
{
///<Summary>
/// Gets the answer
///</Summary>
public class pianoVST
{
///<Summary>
/// Gets the answer
///</Summary>
public static VST vst = null;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
}
/// <summary>
/// Play some test notes.
/// </summary>
public void playTest()
{
var asioDriverNames = AsioOut.GetDriverNames();
if (asioDriverNames.Length > 0)
{
MidiVstTest.UtilityAudio.OpenAudio(MidiVstTest.AudioLibrary.NAudio, asioDriverNames[0]);
MidiVstTest.UtilityAudio.StartAudio();
vst = MidiVstTest.UtilityAudio.LoadVST("[path-to-vst-dll]");
for (int i = 0; i < 3; i++)
{
vst.MIDI_NoteOn(60, 100);
System.Threading.Thread.Sleep(1000);
vst.MIDI_NoteOn(60, 0);
System.Threading.Thread.Sleep(1000);
}
}
}
}
}
但是,当我将它构建为dll时,将其导入Unity,然后将其附加到一个简单的GameObject,我无法运行或构建它。我得到的错误信息是:
ArgumentException: The Assembly Jacobi.Vst.Interop is referenced by Jacobi.Vst.Samples.Host ('Assets/Jacobi.Vst.Samples.Host.dll'). But the dll is not allowed to be included or could not be found.
我已经从源代码重建了C ++ interop dll,但我没有做任何事情让它与Unity一起工作。
我能做些什么来让Jacobi.Vst.Interop dll与Unity很好地协同工作?
答案 0 :(得分:0)
VST.Net对VC110.CRT程序包具有依赖性。该错误可能是未安装VC运行时的结果。
https://github.com/obiwanjacobi/vst.net/blob/master/docs/Using_VST.NET.md