MKScorefilePerformer Class Reference

MKScorefilePerformers are used to perform scorefiles. More...

#import <MKScorefilePerformer.h>

Inheritance diagram for MKScorefilePerformer:

MKFilePerformer MKPerformer

List of all members.

Public Member Functions

(id) - init
 Initializes the receiver.
(MKNote *) - infoNote
 Returns the receiver's info MKNote, fashioned from an info statement in the header of the scorefile.
(id) - initializeFile
 You never invoke this method; it's invoked automatically by selfActivate (just before the file is performed).
(id) - finishFile
 You never invoke this method; it's invoked automatically by deactivate.
(NSMutableData *) - scorefilePrintStream
 Returns the receiver's scorefile print statement stream.
(MKNote *) - nextNote
 Reads the next MKNote or time statement from the body of the scorefile.
(MKNote *) - infoNoteForNoteSender:
 Returns the info MKNote of the MKPart associated with the MKNoteSender aNoteSender.
(id) - performNote:
 Sends aNote to the appropriate MKNoteSender You never send performNote: directly to a MKScorefilePerformer; it's invoked by the perform method.
(MKNoteSender *) - midiNoteSender:
 Returns the first MKNoteSender whose corresponding MKPart has a MK_midiChan info parameter equal to aChan, if any.
(id) - copyWithZone:
 Creates and returns an initialised, inactive MKPerformer as a copy of the receiver.
(void) - encodeWithCoder:
 You never invoke this method directly; to archive a MKFilePerformer, call the NSArchiver archiveRoot method.
(id) - initWithCoder:
 You never invoke this method directly; to read an archived MKFilePerformer, call the NSUnarchiver methods.

Static Public Member Functions

(NSString *) + fileExtension
 Returns the file name extension that's recognized by the class.
(NSArray *) + fileExtensions
 Returns a NSArray of the default file extensions recognized by MKScorefilePerformer instances.

Protected Attributes

NSMutableData * scorefilePrintStream
MKNoteinfo


Detailed Description

MKScorefilePerformers are used to perform scorefiles.

Instances of this class are used directly in an application; you don't have to design your own subclass. When the object is activated, it reads the file's header and creates a MKNoteSender for each (unique) member of the part statement. A MKNoteSender is given the same name as the MKPart for which it was created. Thus, you can find out the names of the MKParts in the file by getting an NSArray of the noteSenders (using -noteSenders) and using the function MKGetObjectName(noteSender).

During a performance, a MKScorefilePerformer reads successive MKNote and time statements from the file from which it creates MKNote objects that it sends through its MKNoteSenders. When it reaches the end of the file, the MKScorefilePerformer is deactivated.

A MKScorefilePerformer has its own info MKNote that it fashions from the info statement in the file, and defines an NSMutableData instance on which scorefile print statements are printed.

Much of MKScorefilePeformer's functionality is documented under MKFilePerformer, and MKPerformer.

See also:
MKFilePerformer, MKPerformer.

Member Function Documentation

- (id) init  

Initializes the receiver.

You invoke this method when creating a new intance. A subclass implementation should send [super init] before performing its own initialization.

Returns:
Returns an id.

Reimplemented from MKFilePerformer.

+ (NSString *) fileExtension  

Returns the file name extension that's recognized by the class.

The default implementation returns nil. A subclass may override this method to specify its own file extension.

Returns:
Returns an NSString.

Reimplemented from MKFilePerformer.

+ (NSArray *) fileExtensions  

Returns a NSArray of the default file extensions recognized by MKScorefilePerformer instances.

Returns:
Returns an NSArray. This array typically consists of "score" and "playscore". This method is used by the MKFilePerformer class. The string is not copied.

Reimplemented from MKFilePerformer.

- (MKNote *) infoNote  

Returns the receiver's info MKNote, fashioned from an info statement in the header of the scorefile.

Returns:
Returns an MKNote.

- (id) initializeFile  

You never invoke this method; it's invoked automatically by selfActivate (just before the file is performed).

Returns:
Returns an id. It reads the scorefile header and creates NoteSender objects for each member of the file's part statements. It also creates info MKNotes from the file's MKScore and MKPart info statements and adds them to itself and its MKParts. If the file can't be read, or the scorefile parser encounters too many errors, the receiver is deactivated.

Reimplemented from MKFilePerformer.

- (id) finishFile  

You never invoke this method; it's invoked automatically by deactivate.

Returns:
Returns an id. Performs post-performance cleanup of the scorefile parser.

Reimplemented from MKFilePerformer.

- (NSMutableData *) scorefilePrintStream  

Returns the receiver's scorefile print statement stream.

Returns:
Returns an NSMutableData instance.

- (MKNote *) nextNote  

Reads the next MKNote or time statement from the body of the scorefile.

Returns:
Returns an id. MKNote statements are turned into MKNote objects and returned. If its a time statement that's read, fileTime is set to the statement's value and nil is returned.
You never invoke this method; it's invoked automatically by the perform method. If you override this method, you must send [super nextNote].

Reimplemented from MKFilePerformer.

- (MKNote *) infoNoteForNoteSender: (MKNoteSender *)  aNoteSender  

Returns the info MKNote of the MKPart associated with the MKNoteSender aNoteSender.

If aNoteSender isn't a contained in the receiver, returns nil.

Parameters:
aNoteSender is an MKNoteSender instance.
Returns:
Returns an MKNote instance.

- (id) performNote: (MKNote *)  aNote  

Sends aNote to the appropriate MKNoteSender You never send performNote: directly to a MKScorefilePerformer; it's invoked by the perform method.

Parameters:
aNote is an MKNote instance.
Returns:
Returns an id.

Reimplemented from MKFilePerformer.

- (MKNoteSender *) midiNoteSender: (int)  aChan  

Returns the first MKNoteSender whose corresponding MKPart has a MK_midiChan info parameter equal to aChan, if any.

aChan equal to 0 corresponds to the MKPart representing MIDI system and channel mode messages.

Parameters:
aChan is an int.
Returns:
Returns an MKNoteSender instance.

- (id) copyWithZone: (NSZone *)  zone  

Creates and returns an initialised, inactive MKPerformer as a copy of the receiver.

Returns:
Returns an MKPerformer instance. The new object has the same time shift and duration as the reciever. Its time and nextPerform variables are set to 0.0. The new object's MKNoteSenders are copied from the receiver.

Reimplemented from MKFilePerformer.

- (void) encodeWithCoder: (NSCoder *)  aCoder  

You never invoke this method directly; to archive a MKFilePerformer, call the NSArchiver archiveRoot method.

An archived MKFilePerformer maintains its filename, firstTimeTag, and lastTimeTag instance variables (as well as the instance variables defined in MKPerformer).

Parameters:
aCoder is an NSCoder instance.

Reimplemented from MKFilePerformer.

- (id) initWithCoder: (NSCoder *)  aDecoder  

You never invoke this method directly; to read an archived MKFilePerformer, call the NSUnarchiver methods.

Parameters:
aDecoder is an NSCoder instance.
Returns:
Returns an id.

Reimplemented from MKFilePerformer.


Member Data Documentation

- (NSMutableData*) scorefilePrintStream [protected]

The stream used for the scorefile's print statements.

- (MKNote*) info [protected]

MKScore info MKNote for the file.


The documentation for this class was generated from the following file:

Generated on Sat Dec 5 17:01:15 2009 for MusicKit by  doxygen 1.5.6