Re: Stream format
Re: Stream format
- Subject: Re: Stream format
- From: Jeff Moore <email@hidden>
- Date: Wed, 26 Mar 2003 16:02:22 -0800
A good programming practice I've found is to not write code based on
assumptions about how something behaves when there are ways of finding
out programmatically how that thing will truly behave. This applies
here I think. The HAL can tell you what exactly to expect format wise
in your IOProc. So, rather than always assuming that it is going to
always be the same and hard coding things that way, you will end up
with better quality and more maintainable code if you evaluate the info
the HAL gives you and base your decisions on that while you are running.
On Wednesday, March 26, 2003, at 03:33 PM, Steven Spencer wrote:
Thanks for your reply Jeff.
I'm still a bit confused. I understand that the format flags will
change what's in the IOProc,
but I've read in
http://lists.apple.com/archives/coreaudio-api/2001/Dec/20/
actualstreamvsphysicalst.002.txt
that if the sample format is linearPCM then the data in the IOProc is
always native endian 32bit float
(presumably with values of -1.0 to +1.0).
Can this no longer be assumed ?
I'm using OS 10.1.5 if that makes any difference.
- Steven Spencer
On Tuesday, March 25, 2003, at 09:50PM, Jeff Moore <email@hidden>
wrote:
On Tuesday, March 25, 2003, at 01:15 PM, Steven Spencer wrote:
Does this mean that for linear PCM, the stream format flags change
the
type of
float32 presented in the IOProc ?
Of course. For one, the format flags are how you know that it is
floating point as opposed to some integer format. The endianness and
packed flags will also be set as appropriate.
I ask this because I'm writing a programme to monitor the input from
an audio device and
send it to the default output unit as follows :
input -> ring buffer -> mixer -> default output
and need to know if it is necessary to use one or more audio
converters to change the input IOProc data to a
common type before it is written to the ring buffer (so all channels
have the same data type for the mixer).
If audio converters are required, I don't think they need to do
sample
rate conversion since this will be done
by the default output unit and the input streams share the same
sample
rate.
Are audio converters required ?
The Output Audio Units are totally hooked in to the AudioConverter to
handle massaging the data provided via the input proc into the form
the
audio device wants. Note that this doesn't supply just rate
conversion.
It also includes sample format conversion and channelization as well.
Check out the sample code to see how the AudioConverter in the Output
AU is used under various circumstances. Given what you are doing, you
might want to also check out the PlayEffect sample code in particular.
On Tuesday, March 25, 2003, at 07:48PM, Jeff Moore <email@hidden>
wrote:
Everything about the ASBDs returned via
kAudioDevicePropertyStreamFormat and friends applies. You should be
paying attention to everything they say.
If you are doing output, you should probably be using the HAL output
Audio Unit. It will take care of a lot of the work that goes in to
being a client of the HAL. It also interfaces with the
AudioConverter
to massage the data into the form the device wants.
On Tuesday, March 25, 2003, at 08:37 AM, Steven Spencer wrote:
In AudioHardware.h, it states that linear PCM streams are presented
as
floating point
data in the IOProc. Do the stream format flags (big endian, packed
etc.)
affect the floating point formatting in the IOProc or do these just
apply to the
stream hardware formatting ?
--
Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.