Re: Emagic VST2AU SDK and multi-output MusicDevice
Re: Emagic VST2AU SDK and multi-output MusicDevice
- Subject: Re: Emagic VST2AU SDK and multi-output MusicDevice
- From: Art Gillespie <email@hidden>
- Date: Wed, 30 Apr 2003 10:00:28 -0400
Hi Malcolm,
I had this problem as well.
I got around this by removing the VSTAUPlugin overrides for ValidFormat
and GetStreamFormat.
VST2AUPlugin.cpp, Line 670:
const
CAStreamBasicDescription& CVST2AUPlugin::GetStreamFormat(AudioUnitScope
iScope, AudioUnitElement)
{
static CAStreamBasicDescription sDesc;
sDesc.mSampleRate = m_r64Samplerate;
sDesc.mFormatID = kAudioFormatLinearPCM;
sDesc.mFormatFlags = (kAudioFormatFlagsNativeFloatPacked |
kAudioFormatFlagIsNonInterleaved);
sDesc.mBytesPerPacket = 4;
sDesc.mFramesPerPacket = 1;
sDesc.mBytesPerFrame = 4;
sDesc.mChannelsPerFrame =
(iScope==kAudioUnitScope_Input?s_pcInfo.NumInputs():s_pcInfo.NumOutputs(
));
sDesc.mBitsPerChannel = 32;
return sDesc;
}
This returns whatever the vst reported as its number of outputs,
without asking the actual Element how it's currently configured. So
you're telling Logic, "This element is set up for n channels", so Logic
never makes the necessary call to ChangeStreamFormat. In fact, your
Element is actually set up for stereo (more than likely... you
shouldn't even assume that). So during render, when AUBase attempts to
copy the 8 buffers Logic provides into the element, it goes Boom
because there are only 2 buffers allocated in the Element.
If you look at the implementation in AUBase, it does the the Right
Thing:
AUBase.cpp, Line 1240:
const CAStreamBasicDescription &
AUBase::GetStreamFormat( AudioUnitScope inScope,
AudioUnitElement inElement)
{
//#warning "aliasing of global scope format should be pushed to
subclasses"
AUIOElement *element;
switch (inScope) {
case kAudioUnitScope_Input:
element = Inputs().SafeGetIOElement(inElement);
break;
case kAudioUnitScope_Output:
element = Outputs().SafeGetIOElement(inElement);
break;
case kAudioUnitScope_Global: // global stream description is an alias
for that of output 0
element = Outputs().SafeGetIOElement(0);
break;
default:
COMPONENT_THROW(kAudioUnitErr_InvalidScope);
}
return element->GetStreamFormat();
}
Notice that it actually queries the specified element and gets its
current StreamFormat.
Best,
Art
>>0xBA
On Wednesday, April 30, 2003, at 04:07 AM, Malcolm Haylock wrote:
Hi everyone,
I've sent the following message to Emagic developer support several
times since last November but have never received a reply. Has anyone
found the same problem and a workaround? Everything works fine with 2
outputs only.
I'm having a problem porting a multi-out VST plugin to AU using
Emagic's VST2AU SDK (LPAUSDK5).
You can duplicate the problem using the XSynth demo plugin provided in
the SDK. This will cause a segmentation fault as it seems Logic has
only allocated space for stereo outputs.
1) Set kNumOutputs = 8 in vstxsynth.h
2) Set the 'processReplacing' routine to:
/
/----------------------------------------------------------------------
-------------------
void VstXSynth::processReplacing (float **inputs, float **outputs,
long sampleFrames)
{
float* out1 = outputs[0];
float* out2 = outputs[1];
float* out3 = outputs[2];
float* out4 = outputs[3];
float* out5 = outputs[4];
float* out6 = outputs[5];
float* out7 = outputs[6];
float* out8 = outputs[7];
while (--sampleFrames >= 0)
{
*out1++ = 0;
*out2++ = 0;
*out3++ = 0;
*out4++ = 0;
*out5++ = 0;
*out6++ = 0;
*out7++ = 0;
*out8++ = 0;
}
}
Thanks,
Malcolm Haylock
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.