#import <MKScorePerformer.h>
Public Member Functions | |
(id) | - init |
Initializes the receiver. | |
(id) | - releasePartPerformers |
If the receiver is in performance, does nothing and returns nil. | |
(id) | - removePartPerformers |
Removes the receiver's MKPartPerformers (but doesn't free them) and sets the receiver's MKScore to nil. | |
(id) | - setScore: |
Sets the receiver's MKScore to aScore and creates a MKPartPerformer for each of the Score's MKParts. | |
(MKScore *) | - score |
Returns the object's MKScore. | |
(id) | - activate |
Sends activateSelf to the receiver and then sends the activate message to each of the receiver's MKPartPerformers. | |
(id) | - activateSelf |
You never invoke this method directly; it's invoked as part of the activate method. | |
(void) | - deactivate |
Deactivates the receiver's MKPartPerformers. | |
(id) | - pause |
Suspends the receiver's performance by sending the pause message to each of its MKPartPerformers. | |
(id) | - resume |
Resumes a previously paused performance by sending the resume message to each of the receiver's MKPartPerformers. | |
(id) | - setFirstTimeTag: |
Sets the smallest timeTag value considered for performance by sending setFirstTimeTag:aTimeTag to each of the receiver's MKPartPerformers. | |
(id) | - setLastTimeTag: |
Sets the greatest timeTag value considered for performance by sending setLastTimeTag:aTimeTag to each of the receiver's MKPartPerformers. | |
(double) | - firstTimeTag |
Returns the smallest timeTag value considered for performance. | |
(double) | - lastTimeTag |
Returns the greatest timeTag value considered for performance. | |
(id) | - setTimeShift: |
Sets the performance time offset by sending setTimeShift:aTimeShift to each of the receiver's MKPartPerformers. | |
(id) | - setDuration: |
Sets the maximum performance duration by sending setDuration:aDuration to each of the receiver's MKPartPerformers. | |
(double) | - timeShift |
Returns the receiver's performance time offset in beats. | |
(double) | - duration |
Returns the receiver's maximum performance duration in beats. | |
(id) | - copyWithZone: |
Creates and returns a new, inactive MKScorePerformer that's a copy of the receiver. | |
(id) | - setConductor: |
Sends the message setConductor:aConductor to each of the receiver's MKPartPerformers. | |
(MKPartPerformer *) | - partPerformerForPart: |
Returns the receiver's MKPartPerformer that's associated with aPart, where aPart is a MKPart in the receiver's MKScore. | |
(NSArray *) | - partPerformers |
Creates and returns a NSArray containing the receiver's MKPartPerformers. | |
(NSArray *) | - noteSenders |
Creates and returns a NSMutableArray containing the MKNoteSender objects that belong to the receiver's MKPartPerformers (A MKPartPerformer contains at most one MKNoteSender, created when the MKPartPerformer is initialized). | |
(int) | - status |
Returns the receiver's status. | |
(id) | - setPartPerformerClass: |
Normally, MKScorePerformers create instances of the MKPartPerformer class. | |
(Class) | - partPerformerClass |
Returns the class used for MKPartPerformers, as set by setPartPerformerClass:. | |
(void) | - setDelegate: |
Sets the delegate as indicated. | |
(id) | - delegate |
Returns the receiver's delegate object, if any. | |
(void) | - encodeWithCoder: |
Archives partPerformers,firstTimeTag,lastTimeTag,timeShift, duration, and partPerformerClass. | |
(id) | - initWithCoder: |
initialises new object from the decoder. | |
Static Public Member Functions | |
(MKScorePerformer *) | + scorePerformer |
Allocates, initialises and returns an autoreleased instance. | |
Protected Attributes | |
NSMutableArray * | partPerformers |
MKScore * | score |
double | firstTimeTag |
double | lastTimeTag |
double | timeShift |
double | duration |
MKConductor * | conductor |
id | delegate |
Class | partPerformerClass |
MKScorePerformer itself isn't a MKPerformer but it does define a number of methods, such as activate, pause, and resume, that emulate MKPerformer methods. When a MKScorePerformer receives such a message, it forwards the message to each of its MKPartPerformer objects, which are true MKPerformers.
MKScorePerformer also has a MKPerformer-like status; it can be active, inactive, or paused. The status of a MKScorePerformer is, in general, the same as the status of all its MKPartPerformers. For instance, when you send the activate message to a MKScorePerformer, its status becomes MK_active as does the status of all its MKPartPerformers. However, you can access and control a MKPartPerformer independent of the MKScorePerformer that created it. Thus, an individual MKPartPerformer's status can be different from that of the MKScorePerformer.
A MKScorePerformer's MKScore is set and its MKPartPerformers are created when it receives the setScore: message. If you add MKParts to or remove MKParts from the MKScore after sending the setScore: message, the changes will not be seen by the MKScorePerformer.
+ (MKScorePerformer *) scorePerformer |
- (id) init |
Initializes the receiver.
A subclass implementation should send [super init] before performing its own initialization.
- (id) releasePartPerformers |
If the receiver is in performance, does nothing and returns nil.
Otherwise, removes and frees the receiver's MKPartPerformers, sets the receiver's MKScore to nil and returns the receiver.
- (id) removePartPerformers |
Removes the receiver's MKPartPerformers (but doesn't free them) and sets the receiver's MKScore to nil.
- (id) setScore: | (MKScore *) | aScore |
Sets the receiver's MKScore to aScore and creates a MKPartPerformer for each of the Score's MKParts.
Subsequent changes to aScore (by adding or removing MKParts) won't be seen by the receiver. The MKPartPerformers from a previously set MKScore (if any) are first removed and freed. Returns the receiver.
Note: The score can be set only when the receiver's performance status is MK_inactive. If the receiver is not inactive, the setScore: message is ignored. Returns the receiver or nil if the score could not be set.
aScore | is an id. |
- (id) activate |
Sends activateSelf to the receiver and then sends the activate message to each of the receiver's MKPartPerformers.
If activateSelf returns nil, the message isn't sent and nil is returned. Otherwise sends [delegate hasActivated:self] and returns the receiver.
- (id) activateSelf |
You never invoke this method directly; it's invoked as part of the activate method.
A subclass implementation should send [super activateSelf]. If activateSelf returns nil, the receiver isn't activated. The default implementation does nothing and returns the receiver.
- (void) deactivate |
Deactivates the receiver's MKPartPerformers.
A subclass can implement this method to perform post-performance activites. The default does nothing; the return value is ignored.
- (id) pause |
Suspends the receiver's performance by sending the pause message to each of its MKPartPerformers.
Also sends [delegate hasPaused: self];
.
- (id) resume |
Resumes a previously paused performance by sending the resume message to each of the receiver's MKPartPerformers.
Also sends [delegate hasResumed:self];
.
- (id) setFirstTimeTag: | (double) | aTimeTag |
Sets the smallest timeTag value considered for performance by sending setFirstTimeTag:aTimeTag to each of the receiver's MKPartPerformers.
If the receiver is active, this does nothing and returns nil.
aTimeTag | is a double. |
- (id) setLastTimeTag: | (double) | aTimeTag |
Sets the greatest timeTag value considered for performance by sending setLastTimeTag:aTimeTag to each of the receiver's MKPartPerformers.
If the receiver is active, this does nothing and returns nil.
aTimeTag | is a double. |
- (double) firstTimeTag |
Returns the smallest timeTag value considered for performance.
- (double) lastTimeTag |
Returns the greatest timeTag value considered for performance.
- (id) setTimeShift: | (double) | aTimeShift |
Sets the performance time offset by sending setTimeShift:aTimeShift to each of the receiver's MKPartPerformers.
The offset is measured in beats. If the receiver is active, this does nothing and returns nil.
aTimeShift | is a double. |
- (id) setDuration: | (double) | aDuration |
Sets the maximum performance duration by sending setDuration:aDuration to each of the receiver's MKPartPerformers.
The duration is measured in beats. If the receiver is active, this does nothing and returns nil.
aDuration | is a double. |
- (double) timeShift |
Returns the receiver's performance time offset in beats.
- (double) duration |
Returns the receiver's maximum performance duration in beats.
- (id) copyWithZone: | (NSZone *) | zone |
Creates and returns a new, inactive MKScorePerformer that's a copy of the receiver.
The new object is associated with the same MKScore as the receiver, and has the same MKConductor and timing window variables (timeShift, duration, fromTimeTag, and toTimeTag). New MKPartPerformers are created for the new object.
- (id) setConductor: | (MKConductor *) | aConductor |
Sends the message setConductor:aConductor to each of the receiver's MKPartPerformers.
aConductor | is an id. |
- (MKPartPerformer *) partPerformerForPart: | (MKPart *) | aPart |
Returns the receiver's MKPartPerformer that's associated with aPart, where aPart is a MKPart in the receiver's MKScore.
Keep in mind that it's possible for a MKPart to have more than one MKPartPerformer; this method returns only the MKPartPerformer that was created by the receiver.
aPart | is an MKPart instance. |
- (NSArray *) partPerformers |
Creates and returns a NSArray containing the receiver's MKPartPerformers.
- (NSArray *) noteSenders |
Creates and returns a NSMutableArray containing the MKNoteSender objects that belong to the receiver's MKPartPerformers (A MKPartPerformer contains at most one MKNoteSender, created when the MKPartPerformer is initialized).
- (int) status |
Returns the receiver's status.
- (id) setPartPerformerClass: | (Class) | aPartPerformerSubclass |
Normally, MKScorePerformers create instances of the MKPartPerformer class.
This method allows you to specify that instances of some MKPartPerformer subclass be created instead. If aPartPerformerSubclass is not a subclass of MKPartPerformer (or MKPartPerformer itself), this method has no effect and returns nil. Otherwise, it returns self.
aPartPerformerSubclass | is a Class. |
- (Class) partPerformerClass |
Returns the class used for MKPartPerformers, as set by setPartPerformerClass:.
The default is MKPartPerformer itself.
- (void) setDelegate: | (id) | object |
- (id) delegate |
Returns the receiver's delegate object, if any.
- (void) encodeWithCoder: | (NSCoder *) | aCoder |
Archives partPerformers,firstTimeTag,lastTimeTag,timeShift, duration, and partPerformerClass.
You never send this message directly. Also optionally archives score conductor and delegate.
- (id) initWithCoder: | (NSCoder *) | aDecoder |
initialises new object from the decoder.
You never send this message directly. Note that -init is not sent to newly unarchived objects.
- (NSMutableArray*) partPerformers [protected] |
The object's status.
An array of the object's MKPartPerformer instances.
- (double) firstTimeTag [protected] |
The MKScore with which this object is associated.
- (double) lastTimeTag [protected] |
The smallest timeTag value considered for performance, as last broadcast to the MKPartPerformers.
- (double) timeShift [protected] |
The greatest timeTag value considered for performance, as last broadcast to the MKPartPerformers.
- (double) duration [protected] |
The performance offset time for the object in beats, as last broadcast to the MKPartPerformers.
- (MKConductor*) conductor [protected] |
The maximum performance duration in beats, as last broadcast to the MKPartPerformers.
- (id) delegate [protected] |
The object's MKConductor (its MKPartPerformers' MKConductor) as last broadcast to MKPartPerformers.
- (Class) partPerformerClass [protected] |
The object's delegate.