#import <MKPartPerformer.h>
Public Member Functions | |
(id) | - init |
Initializes the receiver by creating and adding its single MKNoteSender. | |
(id) | - setPart: |
Associates the receiver with aPart. | |
(MKPart *) | - part |
Returns the receiver's MKPart object. | |
(id) | - activateSelf |
Activates the receiver for a performance. | |
(void) | - deactivate |
Deactivates the receiver and frees its NSMutableArray of MKNotes. | |
(id) | - perform |
Performs nextNote (by sending it to its MKNoteSender's connections) and then prepares the receiver for its next MKNote performance. | |
(id) | - setFirstTimeTag: |
Sets the value of the receiver's firstTimeTag variable to aTimeTag. | |
(id) | - setLastTimeTag: |
Sets the value of the receiver's lasTimeTag variable to aTimeTag. | |
(double) | - firstTimeTag |
Returns the value of the receiver's firstTimeTaginstance variable. | |
(double) | - lastTimeTag |
Returns the value of the receiver's lasTimeTaginstance variable. | |
(id) | - copyWithZone: |
Creates and returns a new MKPartPerformer as a copy of the receiver. | |
(void) | - encodeWithCoder: |
You never send this message directly. | |
(id) | - initWithCoder: |
You never send this message directly. | |
Static Public Member Functions | |
(id) | + setFastActivation: |
If yesOrNo is YES, MKPartPerformers do not copy the MKPart's NSMutableArray of MKNotes when they activate. | |
(BOOL) | + fastActivation |
Returns whether Fast Activation mode is enabled for the class. |
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 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.
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.
+ (id) setFastActivation: | (BOOL) | yesOrNo |
If yesOrNo is YES, MKPartPerformers do not copy the MKPart's NSMutableArray of MKNotes when they activate.
yesOrNo | is a BOOL. |
+ (BOOL) fastActivation |
Returns whether Fast Activation mode is enabled for the class.
- (id) init |
Initializes the receiver by creating and adding its single MKNoteSender.
Reimplemented from MKPerformer.
- (id) setPart: | (MKPart *) | aPart |
Associates the receiver with aPart.
aPart | is an id. |
- (MKPart *) part |
- (id) activateSelf |
Activates the receiver for a performance.
Reimplemented from MKPerformer.
- (void) deactivate |
Deactivates the receiver and frees its NSMutableArray of MKNotes.
You never invoke this method directly; it's invoked as part of the deactivate method inherited from MKPerformer. The return value is ignored.
Reimplemented from MKPerformer.
- (id) perform |
Performs nextNote (by sending it to its MKNoteSender's connections) and then prepares the receiver for its next MKNote performance.
Reimplemented from MKPerformer.
- (id) setFirstTimeTag: | (double) | aTimeTag |
Sets the value of the receiver's firstTimeTag variable to aTimeTag.
aTimeTag | is a double. |
Reimplemented from MKPerformer.
- (id) setLastTimeTag: | (double) | aTimeTag |
Sets the value of the receiver's lasTimeTag variable to aTimeTag.
aTimeTag | is a double. |
Reimplemented from MKPerformer.
- (double) firstTimeTag |
Returns the value of the receiver's firstTimeTaginstance variable.
Reimplemented from MKPerformer.
- (double) lastTimeTag |
Returns the value of the receiver's lasTimeTaginstance variable.
Reimplemented from MKPerformer.
- (id) copyWithZone: | (NSZone *) | zone |
Creates and returns a new MKPartPerformer as a copy of the receiver.
zone | is an NSZone. |
Reimplemented from MKPerformer.
- (void) encodeWithCoder: | (NSCoder *) | aCoder |
You never send this message directly.
Archives noteSender array, timeShift, and duration. Also optionally archives conductor and delegate.
Reimplemented from MKPerformer.
- (id) initWithCoder: | (NSCoder *) | aDecoder |
You never send this message directly.
Note that the status of an unarchived MKPerformer is always MK_inactive.
Reimplemented from MKPerformer.