All my audio render callbacks use the C-function-pointer-to-call-named-selector 
trick in JambaLaya. (http://audiofreakshow.com)  

In fact, the entire app is written in Objective-C.  Between SnoizeMIDI, 
MTCoreAudio, and my own private TBAudioUnits framework - I deal with C or C++ 
almost never.

In fact, SnoizeMIDI (http://snoize.com/) is a great example of something that 
most people would think would be too slow. It takes the high performance data 
structures like MIDIMessageList variable length structs, then converts them 
into NSArray's of Objective-C objects (one per message), then dispatches them 
through a chain of Objective-C implemented filters using polymorphism. I end up 
stashing them in a set of NSArray implemented queues (protected by NSLock) from 
which they are pulled during that "probably too slow" Objective-C implemented 
render callback -then dispatched to the audio units, and then released.

Very low latency, feels like hardware, and all Objective-C.

There is no good reason not to have the base classes for AudioUnit be in 
Objective-C rather than C++ other than the personal biases of certain CoreAudio 
team members.  I can't fault them, they use what they know and they do a great 
job, but their way isn't the only one and a nice Objective C wrapper for the 
whole thing that hides the C++ is both doable and a long standing feature 
request.

On Feb 28, 2010, at 7:46 PM, Kyle Sluder wrote:

> On Sun, Feb 28, 2010 at 7:24 PM, Erik Buck <erik.b...@sbcglobal.net> wrote:
>> I disagree.  I have written very low latency device drivers in Objective-C.  
>> Why do you think Objective-C has too much "latency" for audio?  When 
>> properly used, Objective-C programs are no more likely to be preempted than 
>> any other kind of program.  Message dispatch generally has constant time and 
>> is only 2.5 times the cost of a C function call.  There aren't many function 
>> calls or messages sent in audio processing anyway.  Signal processing 
>> routines tend to be long loops.  Objective-C _IS_ C which means it is likely 
>> usable in any situation where C is usable.
> 
> I am simply relaying the wisdom I received from the CoreAudio folks
> over on coreaudio-api. Frequently people ask about using ObjC in their
> render callbacks, and the engineers are quick to put the kibosh on
> that idea.
> 
> --Kyle Sluder
> _______________________________________________
> 
> 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/eagleoffshore%40mac.com
> 
> This email sent to eagleoffsh...@mac.com

_______________________________________________

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