问题描述
我有一个 vstplugin 来消除噪音。 我将它与输入设备和输出设备连接起来,效果很好。 加载 vst 函数
public static void Loadplugin(string path,out VstPluginContext plugin)
{
var hcs = new HostCommandStub();
hcs.PluginCalled += new EventHandler<PluginCalledEventArgs>(HostCmdstub_PluginCalled);
try
{
plugin = VstPluginContext.Create(path,hcs);
plugin.Set("PluginPath",path);
plugin.Set("HotCmdstub",hcs);
plugin.PluginCommandStub.Commands.open();
plugin.PluginCommandStub.Commands.MainsChanged(true);
_logger.Info("Load VST Plugin successful");
}
catch (Exception ex)
{
plugin = null;
_logger.Error("Failed to load VST Plugin",ex);
}
}
创建连接:
public static void ConnectPlugin(bool restartDevice = false,bool byPass = false,bool debug = false)
{
_IsConnecting = true;
try
{
_currentConfig = new CurrentConfig
{
InputDeviceNum = _currentInput?.DeviceNumber ?? 0,OutputDeviceNum = _currentOutput?.DeviceNumber ?? 1,ByPass = byPass,Debug = debug
};
if (!restartDevice && waveIn != null) return;
disconnectDevices();
if (_currentInput == null || _currentOutput == null) return;
sampleRate = 48000f;
blockSize = (int)(4800);
waveIn = new WaveInEvent();
waveIn.BufferMilliseconds = 100;
waveIn.DataAvailable += Plugin_DataAvailable;
waveIn.DeviceNumber = _currentConfig.InputDeviceNum;
waveIn.WaveFormat = new WaveFormat((int)sampleRate,16,1);
waveProviderout = new BufferedWaveProvider(waveIn.WaveFormat) { discardOnBufferOverflow = true };
int inputCount = _vstPlugin.PluginInfo.AudioInputCount;
int outputCount = _vstPlugin.PluginInfo.AudioOutputCount;
var inputMgr = new vstaudioBufferManager(inputCount,blockSize);
var outputMgr = new vstaudioBufferManager(outputCount,blockSize);
_vstPlugin.PluginCommandStub.Commands.SetBlockSize(blockSize);
_vstPlugin.PluginCommandStub.Commands.SetSampleRate(sampleRate);
_vstPlugin.PluginCommandStub.Commands.SetProcessprecision(VstProcessprecision.Process32);
// set value for bypass
_vstPlugin.PluginCommandStub.Commands.SetBypass(_currentConfig.ByPass);
// set value for debug - index = 0
_vstPlugin.PluginCommandStub.Commands.SetParameter(0,_currentConfig.Debug ? 1f : 0);
inputBuffers = inputMgr.Buffers.ToArray();
outputBuffers = outputMgr.Buffers.ToArray();
waveOut = new WaveOutEvent();
waveOut.DesiredLatency = 100;
waveOut.DeviceNumber = _currentConfig?.OutputDeviceNum ?? 1;
waveOut.Init(waveProviderout);
waveOut.Play();
waveIn.StartRecording();
//SetScheduleForReset(1800000); // reset plugin every 2 hours (7200000 ms)
}
catch (Exception ex)
{
}
_IsConnecting = false;
Autofix();
}
目前我想添加一个从新输入设备到具有相同插件但具有不同旁路参数的新输出设备的连接..我试图克隆上面的代码以创建一个新连接,它工作正常,但是它似乎没有收到旁路参数。请帮帮我
- 1 个 vst 插件(消除噪音)
- 连接
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)