MusicKit  0.0.0
MKPartPerformer Class Reference

A MKPartPerformer object performs the MKNotes in a particular MKPart. More...

#include <MKPartPerformer.h>


Detailed Description

A MKPartPerformer object performs the MKNotes in a particular MKPart.

Every MKPartPerformer has exactly one MKNoteSender. A MKPartPerformer is associated with a MKPart through its setPart: method. While a single MKPartPerformer can only be associated with one MKPart, any number of MKPartPerformers can by associated with the same MKPart. If you're performing a MKScore, you can use MKScorePerformer to create MKPartPerformers for you (one for each MKPart in the MKScore).

When you activate a MKPartPerformer (through activateSelf) the object copies its MKPart's NSMutableArray of MKNotes (it doesn't copy the MKNotes themselves). When the MKPartPerformer performs, it sequences over its copy of the NSMutableArray, allowing you to edit the MKPart (by adding or removing MKNotes) without disturbing the performance - changes made to a MKPart during a performance are not seen by the MKPartPerformer. However, since only the NSMutableArray of MKNotes is copied but not the MKNotes themselves, you should neither alter nor free a MKPart's MKNotes during a performance.

As an optimization for real time, you can enable a "Fast Activation mode", on a class-wide basis. Any MKPartPerformer activated when this mode is in effect does not retain its own copy of its MKPart's NSMutableArray. In this mode, you must not edit the MKPart while the MKPartPerformer is using it.

With the timing variables firstTimeTag and lastTimeTag, you can specify the first and last timeTag values (inclusive) that are considered for performance. Keep in mind that you can offset the timing of a performance by setting the timeShift variable defined in MKPerformer, and you can limit the duration of the performance by setting the duration variable. If the newly computed performance time is greater than duration, the MKNote is suppressed and the MKPartPerformer is deactivated.

An example will clarify how firstTimeTagworks. If firstTimeTag is set to 3 and the MKPartPerformer is activated at time 0, then the first note will sound at time 3. If the MKPartPerformer is activated at time 1, the first note will sound at time 4. If timeShift is set to -1 and the MKPartPerformer is activated at time 1, the first note will sound at time 3.

See also:
MKPerformer, MKScorePerformer, MKPart.

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