Re: AudioUnit RenderCallback Scope Issues
Re: AudioUnit RenderCallback Scope Issues
- Subject: Re: AudioUnit RenderCallback Scope Issues
- From: Brian Willoughby <email@hidden>
- Date: Tue, 12 Aug 2008 14:30:20 -0700
Daniel,
This is basic C programming. A system API like this must have a
consistent declaration, and thus it cannot be changed to your
specific object. However, within your implementation of the
callback, you are free to cast the void pointer to a specific pointer
to your object. You can either do this inline in the statement, or
you can define a local variable of the correct type, and assign the
parameter after casting.
ObjectType *self = (ObjectType *)inputProcRefCon;
Brian Willoughby
Sound Consulting
On Aug 12, 2008, at 12:54, Daniel Elliott wrote:
Ok I have given this a go and passing a pointer does work. However,
it passes a void pointer to the callback without knowing what type of
object is being passed. If I pass a pointer to the object by doing
myStruct.inputProcRefCon = self;
....then the callback still can't access the member functions and
variables directly can it? If you try and dereference a void pointer,
the compiler complains (cos you cant do that).
----- Original Message ----
From: Peter Rebholz
Daniel,
If you haven't figured it out yet, try setting the inputProcRefCon
property of the AURenderCallbackStruct with a pointer to an instance
of your class you want to be able to access in the callback function.
This pointer will be passed into your callback function as the
inRefCon parameter.
Hope that helps,
Peter
_______________________________________________
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