MKScorefileWriter Class Reference

A MKScorefileWriter is an MKInstrument that realizes MKNotes by writing them to a scorefile. More...

#import <MKScorefileWriter.h>

Inheritance diagram for MKScorefileWriter:

MKFileWriter MKInstrument

List of all members.

Public Member Functions

(NSString *) - fileExtension
 Returns "score", the default file extension for score files if the file was set with setFile: or setStream:.
(void) - setInfoNote:
 Sets the receiver's info MKNote, freeing a previously set info MKNote, if any.
(MKNote *) - infoNote
 Returns the receiver's info MKNote, as set through setInfo:.
(id) - setInfoNote:forNoteReceiver:
 Sets aPartInfo as the MKNote that's written as the info MKNote for the MKPart that corresponds to the MKNoteReceiver aNoteReceiver.
(MKNote *) - infoNoteForNoteReceiver:
 Returns the info MKNote that's associated with an MKNoteReceiver (as set through -setInfo:forNoteReceiver:).
(id) - initializeFile
 Initializes the scorefile.
(id) - finishFile
 You never invoke this method; it's invoked automatically at the end of a performance.
(id) - copyWithZone:
 Creates and returns a new MKScorefileWriter as a copy of the receiver.
(id) - realizeNote:fromNoteReceiver:
 Realizes aNote by writing it to the scorefile.
(id) - setFile:
 Sets file and specifies that the data be written in ascii (.score) format.
(id) - setStream:
 Sets stream and specifies that the data be written in ascii (.score) format.
(id) - setOptimizedStream:
 Same as setStream: but specifies that the data be written in optimized scorefile (.playscore) format.
(id) - setOptimizedFile:
 Same as setFile: but specifies that the data be written in optimized (.playscore) format.

Static Public Member Functions

(NSString *) + fileExtension
 Returns the default file extension for score files.

Protected Attributes

MKNoteinfo


Detailed Description

A MKScorefileWriter is an MKInstrument that realizes MKNotes by writing them to a scorefile.

The name of the scorefile to which the MKNotes are written is set through methods inherited from MKFileWriter.

Each of a MKScorefileWriter's MKNoteReceivers corresponds to a MKPart that will appear in the scorefile. Unlike most MKInstruments, the MKScorefileWriter class doesn't add any MKNoteReceivers to a newly created object, they must be added by invoking the addNoteReceiver: method.

The names of the MKParts represented in the scorefile are taken from the MKNoteRecievers for which they were created. You can name a MKNoteReceiver by calling the MKNameObject() function.

The header of the scorefile always includes a part statement that names the MKParts represented in the MKScore, and a tagRange statement that states the range of noteTag values used in the MKNote statements. A MKScorefileWriter can be given an info MKNote that's written as a MKScore info statement in the file; similarly, the MKScorefileWriter's MKNoteReceivers can each contain a MKPart info MKNote. These, too, are written to the scorefile, each in a separate MKPart info statement.

You shouldn't change the name of a data object (such as an MKEnvelope, MKWaveTable, or MKNoteReceiver) during a performance involving a MKScorefileWriter.


Member Function Documentation

+ (NSString *) fileExtension  

Returns the default file extension for score files.

The string isn't copied. Note: This method is superceded by the instance method of the same name.

Reimplemented from MKFileWriter.

- (NSString *) fileExtension  

Returns "score", the default file extension for score files if the file was set with setFile: or setStream:.

Returns "playscore", the default file extension for optimized format score files if the file was set with setOptimizedFile: or setOptimizedStream:. The string is not copied.

Returns:
Returns an NSString instance.

Reimplemented from MKFileWriter.

- (void) setInfoNote: (MKNote *)  aNote  

Sets the receiver's info MKNote, freeing a previously set info MKNote, if any.

The MKNote is written, in the scorefile, as a MKScore info statement.

Parameters:
aNote is an MKNote.

- (MKNote *) infoNote  

Returns the receiver's info MKNote, as set through setInfo:.

Returns:
Returns an MKNote instance.

- (id) setInfoNote: (MKNote *)  aPartInfo
forNoteReceiver: (MKNoteReceiver *)  aNoteReceiver 

Sets aPartInfo as the MKNote that's written as the info MKNote for the MKPart that corresponds to the MKNoteReceiver aNoteReceiver.

The MKPart's previously set info MKNote, if any, is freed. If the receiver is in performance, or if aNoteReceiver doesn't belong to the receiver, does nothing and returns nil, otherwise returns the receiver.

Parameters:
aPartInfo is an MKNote.
aNoteReceiver is an MKNoteReceiver.
Returns:
Returns an id.

- (MKNote *) infoNoteForNoteReceiver: (MKNoteReceiver *)  aNoteReceiver  

Returns the info MKNote that's associated with an MKNoteReceiver (as set through -setInfo:forNoteReceiver:).

Parameters:
aNoteReceiver is an MKNoteReceiver instance.
Returns:
Returns an MKNote instance.

- (id) initializeFile  

Initializes the scorefile.

You never invoke this method; it's invoked automatically just before the receiver writes its first MKNote to the scorefile.

Returns:
Returns an id.

Reimplemented from MKFileWriter.

- (id) finishFile  

You never invoke this method; it's invoked automatically at the end of a performance.

Returns:
Returns an id.

Reimplemented from MKFileWriter.

- (id) copyWithZone: (NSZone *)  zone  

Creates and returns a new MKScorefileWriter as a copy of the receiver.

The new object copies the receivers MKNoteReceivers and info MKNotes.

See also:
- copyWithZone: (MKInstrument) method.

Reimplemented from MKFileWriter.

- (id) realizeNote: (MKNote *)  aNote
fromNoteReceiver: (MKNoteReceiver *)  aNoteReceiver 

Realizes aNote by writing it to the scorefile.

The MKNote statement created from aNote is assigned to the MKPart that corresponds to aNoteReceiver.

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

Reimplemented from MKInstrument.

- (id) setFile: (NSString *)  aName  

Sets file and specifies that the data be written in ascii (.score) format.

See superclass documentation for details.

Parameters:
aName is an NSString instance.
Returns:
Returns an id.

Reimplemented from MKFileWriter.

- (id) setStream: (NSMutableData *)  aStream  

Sets stream and specifies that the data be written in ascii (.score) format.

See superclass documentation for details.

Parameters:
aStream is an NSMutableData instance.
Returns:
Returns an id.

Reimplemented from MKFileWriter.

- (id) setOptimizedStream: (NSMutableData *)  aStream  

Same as setStream: but specifies that the data be written in optimized scorefile (.playscore) format.

Parameters:
aStream is an NSMutableData.
Returns:
Returns an id.

- (id) setOptimizedFile: (NSString *)  aName  

Same as setFile: but specifies that the data be written in optimized (.playscore) format.

Parameters:
aName is an NSString.
Returns:
Returns an id.


Member Data Documentation

- (MKNote*) info [protected]

The info MKNote to be written to 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