• 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: How Do I Use NSCoding with Core Audio Data Types?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How Do I Use NSCoding with Core Audio Data Types?


  • Subject: Re: How Do I Use NSCoding with Core Audio Data Types?
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 21 Jun 2013 18:04:39 -0700

On Fri, Jun 21, 2013, at 05:04 PM, n ketter wrote:
> I've created a class that contains three properties that are Core Audio
> types:
>
>     @interface AudioFilePlayer : NSObject <NSCoding>
>
>     @property (assign) AudioUnit                        mAudioUnit;
>     @property (assign) AUNode                           mNode;
>     @property (assign) AudioStreamBasicDescription      mStreamFormat;
>
>     @end
>
> My app holds an array of objects of type AudioFilePlayer and I want to
> archive and unarchive them using NSCoding. I've written the
> encodeWithCoder: and initWithCoder: methods as follows:

You can't just willy-nilly archive raw bytes to disk and expect decoding
them to make any sense. AudioUnits and AUNodes are pointers into living
objects in an AU graph.

On the other hand, an AudioStreamBasicDescription is just a compendium
of values describing a particular file format, so it is okay to write
those values to disk. However, writing raw C structs to disk is a risky
proposition; you have to worry about padding, alignment, and endianness.

--Kyle Sluder
 _______________________________________________
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: How Do I Use NSCoding with Core Audio Data Types?
      • From: n ketter <email@hidden>
References: 
 >How Do I Use NSCoding with Core Audio Data Types? (From: n ketter <email@hidden>)

  • Prev by Date: How Do I Use NSCoding with Core Audio Data Types?
  • Next by Date: Re: How Do I Use NSCoding with Core Audio Data Types?
  • Previous by thread: How Do I Use NSCoding with Core Audio Data Types?
  • Next by thread: Re: How Do I Use NSCoding with Core Audio Data Types?
  • Index(es):
    • Date
    • Thread