使用VST.net和Unity3d创建一个简单的VST主机

问题描述 投票:0回答:1

我已成功简化了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很好地配合?

c# unity3d dll vst
1个回答
0
投票

VST.Net依赖于VC110.CRT包。该错误可能是因为没有安装VC运行时。

https://github.com/obiwanjacobi/vst.net/blob/master/docs/Using_VST.NET.md

© www.soinside.com 2019 - 2024. All rights reserved.