• 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
Re: Different sample types between Simulator and device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different sample types between Simulator and device


  • Subject: Re: Different sample types between Simulator and device
  • From: Nathan Vonnahme <email@hidden>
  • Date: Wed, 04 Sep 2013 22:44:03 -0800

Well, I was really hoping for more response from my big remaining question,

does anyone know how the callback should decide whether to cast mData to float* (my devices) or sInt16* (simulator)? I guess for now I will hardcode it using  #if TARGET_IPHONE_SIMULATOR. There's nothing I see in the AUGraphAddRenderNotify params to indicate the format of mData...

But in response to:

On Sep 4, 2013, at 5:10 AM, Paul Davis <email@hidden> wrote:

On Wed, Sep 4, 2013 at 6:36 AM, Nathan Vonnahme <email@hidden> wrote:

But after trying to figure out 8.24 fixed-point because everything says that is canonical within AudioGraphs,

Can you point to *anything* which says this?


What I meant in my very late night ramblings was that I thought I had specified SInt16 by setting the ASBD on both scopes of the RIO unit, but now I am wondering if I got that wrong or if there is just something different about AUGraphAddRenderNotify, about which I can find very little documentation.

But once I figured out I had 32-bit samples I first assumed they were 8.24 because, for example,

the canonical formats are those that the system is best suited to use and that Core Audio automatically converts to for its own internal use. On Mac OS X, kAudioFormatFlagsCanonical and kAudioFormatFlagsAudioUnitCanonical both use floating point samples, but floating point is a significant expense on the low-power chips of early ARM devices. So on iOS, kAudioFormatFlagsCanonical uses signed integer samples, and kAudioFormatFlagsAudioUnitCanonical uses 8.24 fixed point.

—Adamson, Chris; Avila, Kevin (2012-04-03). Learning Core Audio: A Hands-On Guide to Audio Programming for Mac and iOS (Kindle Locations 5802-5806). Pearson Education (US). Kindle Edition. 

Or more definitively, CoreAudioTypes.h says,

/*!
    @typedef        AudioSampleType
    @abstract       The canonical audio sample type used by the various CoreAudio APIs
*/
#if !CA_PREFER_FIXED_POINT
typedef Float32     AudioSampleType;
typedef Float32     AudioUnitSampleType;
#else
typedef SInt16      AudioSampleType;
typedef SInt32      AudioUnitSampleType;
#define kAudioUnitSampleFractionBits 24
#endif

and above, it's clear that CA_PREFER_FIXED_POINT is defined for all iOS devices and the Simulator

#if !defined(CA_PREFER_FIXED_POINT)
    #if TARGET_OS_IPHONE
        #if (TARGET_CPU_X86 || TARGET_CPU_X86_64 || TARGET_CPU_PPC || TARGET_CPU_PPC64) && !TARGET_IPHONE_SIMULATOR
            #define CA_PREFER_FIXED_POINT 0
        #else
            #define CA_PREFER_FIXED_POINT 1
        #endif
    #else
        #define CA_PREFER_FIXED_POINT 0
    #endif
#endif

So I was surprised to find regular old 32-bit float values in my buffer data on an iOS device. The examples I've seen are all SInt16 or 8.24, though now I know to search for it I see an example and another (both by Nik Reiman) using Float32s in an AU effect. But how come it is SInt16s in the Simulator?



 _______________________________________________
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: Different sample types between Simulator and device
      • From: Doug Wyatt <email@hidden>
References: 
 >Re: Different sample types between Simulator and device (From: Nathan Vonnahme <email@hidden>)
 >Re: Different sample types between Simulator and device (From: Paul Davis <email@hidden>)

  • Prev by Date: RE: AudioHardwarePlugIn vs AudioServerPlugIn
  • Next by Date: CAClock convert beats to secs
  • Previous by thread: Re: Different sample types between Simulator and device
  • Next by thread: Re: Different sample types between Simulator and device
  • Index(es):
    • Date
    • Thread