Re: SR conversion and AUHAL
Re: SR conversion and AUHAL
- Subject: Re: SR conversion and AUHAL
- From: Bjorn Roche <email@hidden>
- Date: Thu, 8 Dec 2005 14:53:58 -0500 (EST)
On Thu, 8 Dec 2005, Derk-Jan Hartman wrote:
On 8-dec-2005, at 16:54, Bjorn Roche wrote:
Hey CoreAudio folks,
I've been squinting at code and docs for a long time here, so sorry
if I am missing something obvious. Anyway, I understand from here:
http://developer.apple.com/technotes/tn2002/tn2091.html#FORMATS
that AUHAL does NOT provide sample rate conversion when doing input. I
think I saw a mailing list posting to that effect as well.
However, the PDFs on CoreAudio state:
An application can use an AudioOutputUnit to interface to a device. The
DefaultOutputAudioUnit tracks the selection of a device by the user as the
default output for audio, and provides additional services such as sample
rate conversion, to provide a simpler means of interfacing to an output
device.
So my conclusion was: "AudioOutputUnit does SR conversion for output, but
not input, so I will need to take care of input SR conversion myself using
an AudioConverter"
All well and good, but when I tried, I noticed I always had buffer
under/over-runs, so I skipped the conversion and everything seems to work
fine, and I get the same number of frames in and out over the long run.
It's entirely possible that I am not setting the sample rates correctly, or
something else dumb, but I'd like to clarify:
Yes these buffer over/underruns were present in VLC as well when the AUHAL
was doing samplerate conversion.
We use an extra buffer to catch them if necessary.
https://trac.videolan.org/vlc/file/trunk/modules/audio_output/auhal.c
You are welcome to use any of that code.
Please also let me know if you find an issue with it.
Of course the VLC usage is quite limited compared to portaudio API, but the
basics would still apply.
I also still have an issue with stereo output on a multichannel capable
device, but i still need to investigate that.
Note also that it's not only AUHAL in this module, but also CoreAudio to do
the SPDIF support.
Thanks Derk-Jan and Philippe,
I already had a buffer for handling the over/unders, the trouble
was that the overs and unders just kept on coming, cycle after cycle!
I think I've traced the problem to the way I setup my audio
converter:
AudioConverterNew is defined as
extern OSStatus AudioConverterNew(
const AudioStreamBasicDescription*inSourceFormat,
const AudioStreamBasicDescription*inDestinationFormat,
AudioConverterRef*outAudioConverter);
and I think I got the formats backwards. It /seems/ to be working now,
though I've got more testing to do.
Anyway, It was very helpful to have confirmation from you guys on how you
handled the problem (and, indeed, confirmation that inputs are not SR
converted.) so THANK YOU!
Incidentally, this document:
/Developer/Examples/CoreAudio/Documentation/AudioUnits/AUHAL.rtfd/
just says:
A client can set ANY format, provided that format has a simple conversion
process. Typically, this means that a client can specify ANY variant of
the PCM formats. For example, a client could have the AUHAL's converters
do both a sample rate conversion and/or a floating-point-to-integer
conversion.
which suggests that sample rates are converted on both input and output.
bjorn
-------------
Bjorn Roche
Check out my CD Mastering Software
for Mac OS X : http://www.xowave.com
_______________________________________________
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