I'm fairly certain that there are no examples of a plain C AudioUnit. There has 
been much talk over the decades about the possibilities, but I do not recall 
anyone ever completing the task, much less sharing their results.

If you have very little C++ experience, then you have no hope of converting the 
existing C++ examples into plain C, even though it is theoretically possible.

You mention Swift, and I'd say that is the language you should avoid when 
writing an AudioUnit. Stick with the C++ examples for AudioUnits, and learn 
enough about C++ to add your member variables in the right places, and 
implement your very simple processing in the Render() function. This will get 
you the furthest with minimal effort.

You don't really need to design any new C++ classes to implement a simple 
AudioUnit. But you will need to have a reasonable understanding of a couple of 
the classes in the AudioUnit example code. That's because some of your 
variables might be shared across all channels (such as filter coefficients), 
while other variables will surely be specific to a single channel (such as 
filter state). e.g., I wrote some dynamics processing AudioUnits, and I needed 
to make the overall volume the same for all channels, particularly for stereo 
and surround instances of my plugin. Those variables are declared in a 
different object than the channel object.

If you want to use Swift in a full application, that's fine, but remember that 
AudioUnits are plugin components. You're probably going to find it more 
difficult to implement an AudioUnit with mixed C++/Swift than either pure C++ 
or even plain C.

Brian Willoughby
Sound Consulting


On Jan 31, 2016, at 1:08 PM, Charles Constant <[email protected]> wrote:
> Does anyone know of any sample code for an AudioUnit written in plain C (as 
> opposed to C++, or Obj-C)? ...assuming that is even possible.
> 
> The most relevant references I've found, so far, for what I need to do are 
> Apple's "AUBase.cpp" and "ReverseOfflineUnitVersion.cpp" examples. I have 
> very little C++ experience, and have no idea how I could implement this in C.
> 
> I realize C++ is "the" choice writing AudioUnits. However (a) the AudioUnit I 
> need to write is very simple (not much more than an offline mixer) (b) I can 
> reuse some code from my existing C render procs (c) C++ would add extra time 
> for me to get up to speed with a mixed C++/Swift project. My guess is that 
> plain C would work better in my current project, if there's some sample code 
> of a pure C AudioUnit.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to