Re: A simple 'Device Through' app (need some help).
Re: A simple 'Device Through' app (need some help).
- Subject: Re: A simple 'Device Through' app (need some help).
- From: Brian Willoughby <email@hidden>
- Date: Fri, 27 Jun 2008 00:39:25 -0700
Hi Glenn,
I recently simplified CAPlayThrough to deal with an 20-in, 22-out
device (of which I only needed 7 in and 2 out). However, I've got
some bad news for you: The only way to simplify things is when you
have a device where input and output are not separate. Since you've
already told us that input and output are separate devices (this is a
USB-Audio device, right? - well, you can thank the designers of the
USB specification for that harsh reality), then you really have no
choice but to implement everything that's in CAPlayThrough.
If you take the time to understand all the working parts of
CAPlayThrough, and do a little experimentation, you'll find that all
the parts are necessary. I am working with a FireWire device, and I
was successful in significantly streamlining CAPlayThrough so that it
works with nothing but an AUGraph and no callbacks whatsoever. You
don't have this luxury, unfortunately.
1. In my opinion, the task of converting from a GUI application to
command line has nothing to do with CoreAudio. Even with a command-
line program, you'd need some sort of looping in place of the GUI
RunLoop, otherwise your audio would stop immediately.
2. It would be possible to code directly to the HAL, and I've done
that in the past (record only, not play through), but I don't think
it would be any simpler. In fact, the code would be more complicated
working directly at the HAL layer.
P.S. I thought of asking the powers that be for a
CASimplePlayThrough sample, but that wouldn't really help you with
your specific hardware. I'll probably kick myself if I ever try to
use my program with a device like yours, but I needed to avoid SRC.
Basically, the way USB devices are designed forces the code to be
this complex. You basically need a sample rate converter between the
input and output, because USB-Audio does not sync the two halves - at
least that's my understanding.
Brian Willoughby
Sound Consulting
On Jun 26, 2008, at 23:44, Glenn McCord wrote:
Hi. I'm trying to make a simple application whereby I can just copy
the input buffers of my soundcard to the output buffers. It's a 6 in 6
out and the input channels are regarded as a separate device to the
output channels. Essentially the goal is to grab some audio from the
soundcard at 64 frame per callback, do something with the audio, then
return it to the soundcard. At the moment, I'm just ommiting and
processing and just passing the audio straight through.
Unfortunately Coreaudio is proving a lot more difficult that ASIO and
Portaudio, so here I am.
I've read some of the core audio documentation and played around with
the sample code from :
http://developer.apple.com/samplecode/CAPlayThrough/
The following post was also quite useful.
http://www.wodeveloper.com/omniLists/macosx-dev/2000/September/
msg00262.html
I have played around with the CAPlayThrough sample code but have
failed to strip it down and make it simpler for my needs. I had a bit
of success with the code used in that post (from the link above) and
was at least able to get a callback to get called, albeit with a
buffer size of zero.
Basically I have two questions.
1. Is there some nice simple, 'run in a command line' styled sample
code out there that I can peruse?
2. My understanding is that AudioUnits are quite high level
abstractions. If this is true, what should I be doing in order to make
a through application that is way down at the HAL layer? Although
simple first is fine by me.
_______________________________________________
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