Interfacing an AudioHardwarePlugin with another pull-IO system
Interfacing an AudioHardwarePlugin with another pull-IO system
- Subject: Interfacing an AudioHardwarePlugin with another pull-IO system
- From: Daniel Mack <email@hidden>
- Date: Tue, 05 Apr 2011 20:09:41 +0200
Hi,
I'm working on a HAL AudioHardwarePlugin driver to interface a network
protocol. I took the SampleHardwarePlugin project as a base to start
with, and I'm able to access audio buffers for both playback and
record streams. Thank you very much for providing this example code,
it really helped a big deal.
The interface I want to connect this driver to works in a fairly
similar fashion than what CoreAudio does on a user client side: I get
a callback whenever the system wants me to push some audio data and
another one when recorded audio material is available. With some time
measurement, calculation and filtering, I can approximate the actual
sample rate of the other system.
I tweaked around in the sample code - mostly by overloading
GetCurrentActualSampleRate() to report what I measured and returning a
sane value for mRateScalar in the timing related functions
GetCurrentTime(), TranslateTime(), and GetNearestStartTime(). My
filter code increases and decreases the reported sample rate
constantly to keep the internal buffers at a certain threshold. It
somehow works sometimes, but the code looks cumbersome, and got the
feeling that there might be an easier way to achive what I'm trying to
do.
What I'm thinking about is handling the remote side in a ring buffer
and whenever there is enough data available to serve the CoreAudio
client application, call its IOProcs directly. The thread doing that
could sleep as long as there hasn't been any callbacks from the
network side, which would be very much a direct translation between
both worlds. Is there any official way to bypass most of the HAL's
logic that way? Or is this frowned upon for reasons I'm not
considering?
If that's not a good way, what would be the easiest approach to take
for such an implementation? Is there public sample code anywhere?
Thanks for any pointer,
Daniel
_______________________________________________
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