On Nov 29, 2009, at 6:07 PM, James Pengra wrote:

The class Foo has a number of variables defined in its header. In the code file Foo.m, and.preceding the @implementation block, the following structure is defined:

        typedef struct
        {
           @defs(Foo);
        } getFoo;

Also preceding the @implementation is a C procedure called IOProc which is the call-back procedure used in audio processing. IOProc contains a pointer def defined as

     getFoo *def;

which is used to get at Foo's variables with statements like def- >varname.

The latest version of Xcode (v.3.2) does not permit use of the @defs keyword.

Does anyone know of a work around I might use so that IOProc can get access to Foo's variables? IOProc fills the input buffer with data which defines the audio signal. The bulk of the code in Foo (in the @implementation block) initializes Core Audio and handles the start and stop of the sound.

Just move the IOProc into the @implementation, have it use a Foo* variable or parameter, and reference the members through that. A C function inside the @implementation is deemed a member of the class and can access private ivars, etc.

You could also just have the IOProc be a trampoline to an actual method of the object by invoking a message on it.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to