O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSSound — Mac OS X 10.0

Synopsis

This class is a simple interface for playing AIFF, WAV, and NeXT sound files. An instance of this class is initialized from a file using the method initWithContentsOfFile:byReference:. The byReference: argument relates to how the sound object should be archived. If this argument is YES, only the name of the sound file will be archived; otherwise, the object data will be archived. There are four methods for controlling playback of the sound: play, pause, resume, and stop. Instances of NSSound may take a delegate object, which will be notified when the sound has finished playing.

image with no caption

@interface NSSound : NSObject <NSCoding, NSCopying>
                                  // Convenience Constructors
   + (id)soundNamed:(NSString *)name;
   + (NSArray *)soundUnfilteredFileTypes;
   + (NSArray *)soundUnfilteredPasteboardTypes;
                                  // Initializers
   - (id)initWithContentsOfFile:(NSString *)path 
                                 byReference:(BOOL)byRef;
   - (id)initWithContentsOfURL:(NSURL *)url 
                                 byReference:(BOOL)byRef;
   - (id)initWithData:(NSData *)data;
   - (id)initWithPasteboard:(NSPasteboard *)pasteboard;
                                  // Accessor Methods
   - (void)setDelegate:(id)aDelegate;
   - (id)delegate;
   - (BOOL)setName:(NSString *)string;
   - (NSString *)name;
                                  // Class Methods
   + (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard;
                                  // Instance Methods
   - (BOOL)isPlaying;
   - (BOOL)pause;
   - (BOOL)play;
   - (BOOL)resume;
 - (BOOL) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required