Re: coreaudio in cocoa/objC/objC++/c++
Re: coreaudio in cocoa/objC/objC++/c++
- Subject: Re: coreaudio in cocoa/objC/objC++/c++
- From: paul webb <email@hidden>
- Date: Sat, 4 Dec 2004 05:52:08 -0800 (PST)
hi michael,
I have been looking through your MT code.
Can you point me do the direction in your code of an
example where the refcon is cast to id.
thanks
paul
--- Michael Thornburgh <email@hidden> wrote:
>
> hi Paul.
>
> i'd like to suggest that you take a look at the
> implementation of
> MTCoreAudio (my objc wrapping around the HAL). it's
> plugged into most
> of the HAL's callbacks (including IOProcs) and uses
> several common
> c<-->objc tricks to convert from C callback land to
> the creamy,
> chocolatey Cocoa constructs that we all love
> (notifications, delegate
> messaging, target/selector for IOProcs). in
> general, they all work in
> the manner John describes: a simple C function in
> the .m file that
> casts the refcon to id and sends it messages.
> remember that "id" is
> just a pointer -- in fact, it's defined in
> <objc/objc.h> as
>
> typedef struct objc_object {
> Class isa;
> } *id;
>
> i'll admit that some of my constructions aren't
> entirely the most
> efficient ways to get things done -- in particular,
> i use
> NSNotifications to broadcast HAL device & stream
> notifications to all
> MTCoreAudioDevice instances, where every instance
> then figures out if
> the notification was for its HAL device and then
> passes them to the
> instance's delegate via the usual
> respondsToSelector: -> send pattern.
> however, the mapping of a single IOProc callback to
> multiple
> IOProcs/IOTargets in MTCoreAudioIOProcMux.m is
> pretty cool if i do say
> so myself! :)
>
> -mike
>
>
> On Dec 3, 2004, at 8:14 PM, john wrote:
>
> > Hey Paul,
> >
> > BTW, you can use the refcon parameter in the
> callback function as a
> > reference to an object. What I do is just
> immediately call a method in
> > my class from the C callback using the object and
> do the work there -
> > it almost feels seem-less :)
> >
> > -- John
> >
> >
> >> I am using C++ so I can take an OOD approach to
> the
> >> design of my digital sound renderers and filters.
> As
> >> the callback has to be as a C function or C++
> method I
> >> am choosing c++ so I can design OOD classes and
> use
> >> OOD techniques for the design of the code that
> renders
> >> the sound data. For example I have class sets of
> >> different random number generators, so instead of
> >> having to write a different C callback for
> eachtype of
> >> random number or provide a bunch of case
> statement I
> >> can provide an object.
> >>
> >>
> >>
> >>
> >>
> >> And its not that the code is messy its more work
> to
> >> keep it from being messy and as I said I keep
> >> duplicating new classes I create as I keep
> needing
> >> things for c++ as I come up with new ideas.
> >>
> >> I think resorting to C for callbacks is even
> worse as
> >> just removes being able to do any OOP in the
> >> callbacks. What is it the 1970s. (sorry for the
> >> scarcasm:-)
> >>
> >>
> >> And I would prefer it if I could keep it all in
> just
> >> objC.
> >>
> >>
> >> Is this any more clear.
> >> Apart from this small gripe (its not that big a
> >> headache) I am pretty happy with core audio.
> >>
> >>
> >> thanks
> >> paul
>
> _______________________________________________
> 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
>
=====
....................................................................................
http://www.fexia.com
http://www.nicetoanimals.org/
.....................................................................................
__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
_______________________________________________
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