Re: AudioUnit : how to communicate from DSP to GUI ?
Re: AudioUnit : how to communicate from DSP to GUI ?
- Subject: Re: AudioUnit : how to communicate from DSP to GUI ?
- From: Bill Stewart <email@hidden>
- Date: Fri, 11 Oct 2002 16:27:28 -0700
Hmmm...
We'll, I'd be careful here.
Let me explain
C++ linkages between different libs is a dangerous and problematic area,
*especially* if an exception can be thrown across the library boundary.
There is a refCon that is associated with each Component Instance (an AU)
called ComponentInstanceStorage...
This is actually in our classes the "this" pointer to the underlying C++
implementation class' object.
We've provided a number of calls for doing what we call FastDispatch
(documented in the SDK in au-properties)
The ***C*** API calls take the ComponentInstanceStorage as their first
argument and the implemenation of those calls then turns around and calls
the appropriate C++ method that corresponds to that dispatch call.
Obviously, we don't see anything wrong with this (and this is equivalent to
what you're suggesting below - but we're not exporting any C++ methods
directly.
So, I would recommend that you don't export C++ symbols, but that you have C
wrappers for the private calls that you need to make - and you can pass in
the this argument (the ComponentInstanceStorage value)...
Alternatively, you can use private properties - or parameters to do this, if
you just need to pass data values to/from the AU and its view.
Bill
on 11/10/02 9:07 AM, Benjamin Golinvaux wrote:
>
I have added this in my overridden GetProperty call in the AUBase
>
subclass :
>
>
>
ComponentResult MyEffectAUClass::GetProperty(
>
AudioUnitPropertyID iID,
>
AudioUnitScope iScope,
>
AudioUnitElement iElem,
>
void* pData)
>
{
>
>
....
>
>
else if(iID==kArboretumAudioUnitProperty_GetPluginCPPInstance)
>
{
>
void** pThis = (void**)(pData);
>
*pThis = (void*)this;
>
return noErr;
>
}
>
return AUEffectBase::GetProperty(iID, iScope, iElem, pData);
>
}
>
>
>
This is needed too :
>
>
ComponentResult MyEffectAUClass::GetPropertyInfo(
>
AudioUnitPropertyID iID,
>
AudioUnitScope iScope,
>
AudioUnitElement iElem,
>
UInt32& iSize, Boolean& fWritable)
>
{
>
....
>
>
else if (iID== kArboretumAudioUnitProperty_GetPluginCPPInstance)
>
{
>
iSize=sizeof(void*);
>
return noErr;
>
}
>
return AUEffectBase::GetPropertyInfo(iID, iScope, iElem, iSize,
>
fWritable);
>
}
>
>
>
>
Then, in my CreateUI call, where i need the AUBase instance address, i
>
do this :
>
>
>
void* pluginAddr;
>
UInt32 dataSize = sizeof(pluginAddr);
>
>
ComponentResult err = AudioUnitGetProperty(
>
mEditAudioUnit,
>
kArboretumAudioUnitProperty_GetPluginCPPInstance,
>
kAudioUnitScope_Global,
>
0,
>
&pluginAddr,
>
&dataSize);
>
>
MyEffectAUClass* audioUnitInstance = (MyEffectAUClass*)pluginAddr;
>
>
>
And then I can access the CPP instance from the view class....
>
>
>
J'esphre que ga va t'aider ;-)
>
>
>
Benjamin Golinvaux
>
Arboretum Systems, Inc.
>
www.arboretum.com
>
>
>
>
>
>
On Friday, October 11, 2002, at 01:43 PM, email@hidden
>
wrote:
>
>
> Hi,
>
>
>
> What is the supported way with AudioUnit SDK to make a tunnel
>
> communication from an AudioUnit and an AudioUnit View ? I have some
>
> values that are calculated at different stage of the dsp processing,
>
> not only at output stage, and I have to pass it to my GUI code to make
>
> some leds blink.
>
> Is there a way to make my AudioUnit view gives a pointer to the
>
> AudioUnit dsp and vice-versa ?
>
>
>
> (I have search the archive but I couldn't find the solution. I'm
>
> surprised that the question was not asked)
>
>
>
> Thanks,
>
>
>
> Raphael
>
> _______________________________________________
>
> 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.
--
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
__________________________________________________________________________
_______________________________________________
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.