please help me how to convert VSTaudiobuffer to PCMStream Buffer i tried from http://vstnet.codeplex.com/Thread/View.aspx?ThreadId=216682 but to no avail.
int inputCount = PluginContext.PluginInfo.AudioInputCount;
int outputCount = PluginContext.PluginInfo.AudioOutputCount;
int blockSize = bytesWritten;
VstAudioBufferManager inputMgr = new VstAudioBufferManager(inputCount, blockSize);
VstAudioBufferManager outputMgr = new VstAudioBufferManager(outputCount, blockSize);
foreach (VstAudioBuffer buffer in inputMgr.ToArray())
{
for (int i = 0; i < blockSize; i++)
{
buffer[i] = (float)destBuffer[i] / 128.0f - 1.0f;
}
}
PluginContext.PluginCommandStub.SetBlockSize(blockSize);
PluginContext.PluginCommandStub.SetSampleRate(44.8f);
PluginContext.PluginCommandStub.StartProcess();
PluginContext.PluginCommandStub.ProcessReplacing(inputMgr.ToArray(), outputMgr.ToArray());
PluginContext.PluginCommandStub.StopProcess();
foreach (VstAudioBuffer buffer in outputMgr.ToArray())
{
for (int i = 0; i < blockSize; i++)
{
destBuffer[i] = Convert.ToByte(((float)buffer[i] + 1.0f) * 128.0f);
}
}
inputMgr.ClearBuffer(inputMgr.ToArray()[0]);
inputMgr.ClearBuffer(inputMgr.ToArray()[1]);
inputMgr.Dispose();
outputMgr.ClearBuffer(outputMgr.ToArray()[0]);
outputMgr.ClearBuffer(outputMgr.ToArray()[1]);
outputMgr.Dispose();