MusicKit
0.0.0
|
During a Music Kit performance, a MKFilePerformer reads and performs time-ordered music data from a file on the disk. An abstract class, MKFilePerformer provides common functionality and declares subclass responsibilities for its one subclass, MKScorefilePerformer. More...
#include <MKFilePerformer.h>
During a Music Kit performance, a MKFilePerformer reads and performs time-ordered music data from a file on the disk. An abstract class, MKFilePerformer provides common functionality and declares subclass responsibilities for its one subclass, MKScorefilePerformer.
A MKFilePerformer is associated with a file either by the file's name or through an NSMutableData instance. If you associate a MKFilePerformer with a file name (through the setFile: method) the object opens and closes the file for you: The file is opened for reading when the MKFilePerformer receives the activate message and closed when it receives deactivate. The setFileStream: method associates a MKFilePerformer with an NSMutableData instance. In this case, opening and closing the file is the responsibility of the application. The MKFilePerformer's stream pointer is set to NULL after each performance so you must send another setFileStream: message in order to replay the file. Any number of MKFilePerformers can perform the same file simultaneously.
The MKFilePerformer class declares two methods as subclass responsibilities: nextNote and performNote:. A subclass implementation of nextNote should be designed to read the next line of information in the file and from it create either a MKNote object or a timeTag value (for the following MKNote). It returns the MKNote that it creates, or, in the case of a timeTag, it sets the instance variable fileTime to represent the current time in the file and returns nil. performNote: should perform any desired manipulations on the MKNote created by nextNote and then pass it as the argument to sendNote: (sent to a MKNoteSender). The value returned by performNote: is ignored.
MKFilePerformer defines two timing variables, firstTimeTag and lastTimeTag. They represent the smallest and largest timeTag values that are considered for performance: MKNotes with timeTags that are less than firstTimeTag are ignored; if nextNote creates a timeTag greater than lastTimeTag, the MKFilePerformer is deactivated.
Creation of a MKFilePerformer's MKNoteSender(s) is a subclass responsibility.