Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Robust audio playback using NSSound...



I'm developing a component which should (try to) play back arbitrary sound files. The file formats should be the regular Quicktime suspects: aiff, wav, mp3, au, etc. I'm using the NSSound class, which advertises its sound file support through the method -[NSSound soundUnfilteredFileTypes].

At first I created NSSound objects using:

- (id)initWithContentsOfFile:(NSString *)path byReference:(BOOL)byRef
Sound objects created this way play all promised file formats, and even go beyond the 'documentation' by also supporting .mid and .mov file playback. However, file support goes over the top when NSSound objects happily start playing .txt, .htm., and .pdf files...


I then resorted to creating NSSound object with:

- (id)initWithData:(NSData *)data

These sound objects will correctly refuse to 'play' text files. New problem: some mp3 files that played earlier will no longer play, and I am not able to play _any_ .m4a files (no DRM) which also play fine when I use initWithContentsOfFile.

I hope someone has tackled these problems and knows a workaround. The documentation sure doesn't help; it's about 4 years out of date :-(

patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.