• 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
mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)


  • Subject: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • From: Chris Adamson <email@hidden>
  • Date: Mon, 04 Mar 2013 08:53:11 -0500

Glad to hear you got it figured out.

FYI, the format flags are a bit field, which allows them to combine behaviors. Sounds like maybe you're not familiar with these? For example, on iOS, kAudioUnitFlagsCanonical is defined (in CoreAudioTypes.h) like this:

kAudioFormatFlagsCanonical = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked

Each of these is a value with one bit turned on:

    kAudioFormatFlagIsSignedInteger             = (1 << 2),     // 0x4
    kAudioFormatFlagIsPacked                    = (1 << 3),     // 0x8

(kAudioFormatFlagsNativeEndian is hidden behind an #ifdef that causes it to either be kAudioFormatFlagIsBigEndian, which is 0x02, or 0 for little-endian)

When you logically OR these values together, as the definition of kAudioFormatFlagsCanonical does, the presence of the whichever bit is set gets preserved.

kAudioFormatFlagIsSignedInteger 0000 0100
kAudioFormatFlagIsPacked        0000 1000
OR                              ---------
                                0000 1100 (0x0c, decimal 12)

So, by OR'ing the flags together, you can combine behaviors. For example, if we also wanted this format to be non-interleaved, we'd OR in that flag:

kAudioFormatFlagIsSignedInteger    0000 0100
kAudioFormatFlagIsPacked           0000 1000
kAudioFormatFlagIsNonInterleaved   0010 0000
OR                                 ---------
                                   0010 1100 (0x2c, decimal 44)

If you want to test for the interleaved flag, you can't just use equality; you need to apply the logical AND.

someOutputFormatIJustGot (0x2c)    0010 1100
kAudioFormatFlagIsNonInterleaved   0010 0000
AND                                ---------
                                   0010 0000 (0X20, decimal 32)

In code this would be something like:

if (myFormat & kAudioFormatFlagIsNonInterleaved) {...}

After performing the AND, you can just check to see if the result is 0, since the only bit that can survive the AND operation is the one you're interested in.

Not sure if this was the issue that made your output unit and the render call incompatible, but hope it helps nonetheless.

--Chris

On Mar 4, 2013, at 8:10 AM, David Blake <email@hidden> wrote:

Success!!!! The key was setting the output scope for the generic output unit it seems! All seems to render fine now.

FYI the mFormatFlag was 12, which I assume isn't 0x20, so interleaved?

The ASBD printout shown below.

Many thanks!!
David

 Initializing the audio processing graph
   Sample Rate:              44100
   Format ID:                 lpcm
   Format Flags:                 C
   Bytes per Packet:             2
   Frames per Packet:            1
   Bytes per Frame:              2
   Channels per Frame:           1
   Bits per Channel:            16


 _______________________________________________
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: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
      • From: Kyle Sluder <email@hidden>
    • Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
      • From: David Blake <email@hidden>
References: 
 >Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: Chris Adamson <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: Chris Adamson <email@hidden>)
 >Re: Offline rendering in a AUGraph using a Generic Output node on iOS (From: David Blake <email@hidden>)

  • Prev by Date: Re: Offline rendering in a AUGraph using a Generic Output node on iOS
  • Next by Date: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Previous by thread: Re: Offline rendering in a AUGraph using a Generic Output node on iOS
  • Next by thread: Re: mFormatFlags (was: Re: Offline rendering in a AUGraph using a Generic Output node on iOS)
  • Index(es):
    • Date
    • Thread