【发布时间】:2018-10-30 10:14:19
【问题描述】:
我已成功简化 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++ 互操作 dll,但我没有做任何事情使它与 Unity 一起工作。
我可以做些什么来让 Jacobi.Vst.Interop dll 与 Unity 很好地配合使用吗?
【问题讨论】:
-
我对Unity一无所知,但也许Interop dll是混合代码(.NET + C++)的事实被检测到并且在unity中不允许......? (假设你已经部署)