• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Stream Format Calculation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Stream Format Calculation
      • From: Jeremy Sagan <email@hidden>
  • Prev by Date: Is it possible to provide AudioUnits a Short Name?
  • Next by Date: Re: Stream Format Calculation
  • Previous by thread: Re: Is it possible to provide AudioUnits a Short Name?
  • Next by thread: Re: Stream Format Calculation
  • Index(es):
    • Date
    • Thread