• 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: NSSound initWithData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSound initWithData?


  • Subject: Re: NSSound initWithData?
  • From: Jason Wright <email@hidden>
  • Date: Fri, 31 Oct 2003 01:42:00 -0500

The code snippet below is my attempt to use NSSound initWithData to play 5 seconds of silence. I craft what I believe is a valid WAV file, but no sound is played (and 'play' returns NO). Am I missing something here? I'm relatively new to programming under MacOS, but no stranger to programming generally.

Bah, appears I've answered my own question... WAV isn't supported by initWithData, so I'll be consing up an AIFF instead, which looks surprisingly familiar except for issues like byte order and rearranging fields. It's quite annoying that the manual pages for this class describe it as supporting SND, WAV, and AIFF but fail to mention that only AIFF is really supported by one of the methods.

...
- (id)initWithData:(NSData *)data;
/* Whether the data comes in from disk, or via this method, NSSound
* expects it to have a proper magic number, sound header, and data.
* Only uncompressed AIFF data is currently supported. */
...

--Jason L. Wright
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >NSSound initWithData? (From: Jason Wright <email@hidden>)

  • Prev by Date: Re: VST to AU plug matching in Logic
  • Next by Date: Re: VST to AU plug matching in Logic
  • Previous by thread: NSSound initWithData?
  • Next by thread: Initializing input
  • Index(es):
    • Date
    • Thread