Re: Robust audio playback using NSSound...
Re: Robust audio playback using NSSound...
- Subject: Re: Robust audio playback using NSSound...
- From: m <email@hidden>
- Date: Fri, 12 Aug 2005 12:44:24 -0700
On Aug 12, 2005, at 8:00 AM, patrick machielse wrote:
- (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...
mid, mov, text, htm, and pdf are perfectly reasonable formats for
Quicktime. NSSound is probably using Quicktime under the hood for these.
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 :-(
You'll need to go beyond Cocoa (though QTKit may be of some help;
haven't looked at it yet myself). Why don't you use NSMovie, grab the
Movie inside it (QTMovie) and see if has any tracks that contain
sound media? If you want to really narrow it down to pure sound files
(in other words, you want to exclude movies that have sound), just
exclude files that also have "visible" media. The documentation
should help; these concepts are more than 4 years old.
_murat
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden