Stream Format Calculation
Stream Format Calculation
- Subject: Stream Format Calculation
- From: "Chris Edgington" <email@hidden>
- Date: Fri, 3 Nov 2006 13:59:59 -0500
In the file /Developer/Examples/CoreAudio/Documentation/AudioUnits/index.html is the
following text and example source ...
---
In the following example, we are going to provide Float32, 2 channels at 44.1KHz. The
format also describes a non-interleaved format, where the eventual AudioBufferList will
contain one AudioBuffer for each channel, so the mBytesPerPacket, etc, fields, describe
the sample format for one of these AudioBuffers. The number of channels describes how many
buffers will be contained in the AudioBufferList.
AudioStreamBasicDescription theStreamFormat;
theStreamFormat.mSampleRate = 44100.0;
theStreamFormat.mFormatID = kAudioFormatLinearPCM;
theStreamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked
| kAudioFormatFlagIsNonInterleaved;
theStreamFormat.mBytesPerPacket = 4;
theStreamFormat.mFramesPerPacket = 1;
theStreamFormat.mBytesPerFrame = 4;
theStreamFormat.mChannelsPerFrame = 2;
theStreamFormat.mBitsPerChannel = sizeof (Float32) * 8;
AudioUnitSetProperty (myFilterUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&theStreamFormat,
sizeof (theStreamFormat));
---
I'm confused about the stream format calculation. If the data size is 4 bytes (Float32),
with 2 channels per frame, wouldn't that be 8 bytes per frame and 8 bytes per packet
(instead of the 4 they describe)?
Thanks,
-Chris
_______________________________________________
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