RE: Using existing VST/RTAS DSP code in AudioUnit
RE: Using existing VST/RTAS DSP code in AudioUnit
- Subject: RE: Using existing VST/RTAS DSP code in AudioUnit
- From: Muon Software Ltd - Dave <email@hidden>
- Date: Tue, 22 Feb 2011 20:42:32 +0000
- Acceptlanguage: en-US, en-GB
- Thread-topic: Using existing VST/RTAS DSP code in AudioUnit
> I'm not sure I understand what you're intending to do in the loop there. It doesn't look much like the Render code in the AUEffectBase class. That class calls
> ProcessBufferLists (possibly repeatedly via ProcessForScheduledParams, if using scheduled parameter changes), which in turn calls my Kernel object's Process
> function. I'm unsure how I can create a pair of buffers for input and another pair for output, for processing via a single call to my DSP object.
Howard,
I remember looking at this some time ago - I think Olivier's is possible referring to code suitable for a class deriving from MusicDeviceBase and so overriding Render() - his code looks really quite similar to code I use in my own instruments.
However, if you're deriving your class from one of the effect base classes, then overriding ProcessBufferLists() is the way to go if you don't want to bother with the kernel stuff. I have to say I found it hard to use those classes in the context of a cross platform project as, like you, I have an internal rendering function that expects to get a flat list of input and output pointers like you would get from VST and RTAS.
For an effect AU (in this case deriving from AUMIDIEffectBase) my ProcessBufferLists() implementation is a bit like this:-
int nChannels = (int)GetNumberOfChannels();
int nInputBuffers = (int)inBuffer.mNumberBuffers;
int nOutputBuffers = (int)outBuffer.mNumberBuffers;
if (nInputBuffers!=nOutputBuffers || nInputBuffers>2 || nOutputBuffers>2)
{
//you might not want to support formats with mismatched numbers of inputs and outputs...
return noErr;
}
int sampleFrames=(int)inFramesToProcess;
float* inputs[2];
float* outputs[2];
inputs[0]=(float*)inBuffer.mBuffers[0].mData;
outputs[0]=(float*)outBuffer.mBuffers[0].mData;
if (nInputBuffers==2)
{
inputs[1]=(float*)inBuffer.mBuffers[1].mData;
outputs[1]=(float*)outBuffer.mBuffers[1].mData;
}
else
{
//TODO: check this is OK in a mono configuration
inputs[1]=inputs[0];
outputs[1]=outputs[0];
}
I didn't bother with any of the downstream kernel classes. The above code is good for {1,1} and {2,2} configs.
Hope this helps
Dave Waugh
Managing Director
Muon Software Ltd
http://www.muon-software.com
http://muonsoftware.blogspot.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden