MKScorePerformer Class Reference

A MKScorePerformer performs a MKScore object by creating a group of MKPartPerformers, one for each MKPart in the MKScore, and controlling the group's performance. More...

#import <MKScorePerformer.h>

List of all members.

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
MKScorescore
double firstTimeTag
double lastTimeTag
double timeShift
double duration
MKConductorconductor
id delegate
Class partPerformerClass


Detailed Description

A MKScorePerformer performs a MKScore object by creating a group of MKPartPerformers, one for each MKPart in the MKScore, and controlling the group's performance.

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.


Member Function Documentation

+ (MKScorePerformer *) scorePerformer  

Allocates, initialises and returns an autoreleased instance.

Returns:
Returns an MKScorePerformer.

- (id) init  

Initializes the receiver.

A subclass implementation should send [super init] before performing its own initialization.

Returns:
Returns an id.

- (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.

Returns:
Returns an id.

- (id) removePartPerformers  

Removes the receiver's MKPartPerformers (but doesn't free them) and sets the receiver's MKScore to nil.

Returns:
Returns the receiver.

- (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.

Parameters:
aScore is an id.
Returns:
Returns an id.

- (MKScore *) score  

Returns the object's MKScore.

Returns:
Returns an MKScore.

- (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.

Returns:
Returns an id.

- (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.

Returns:
Returns an id.

- (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];.

Returns:
Returns the receiver.

- (id) resume  

Resumes a previously paused performance by sending the resume message to each of the receiver's MKPartPerformers.

Also sends [delegate hasResumed:self];.

Returns:
Returns the receiver.

- (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.

Parameters:
aTimeTag is a double.
Returns:
Returns the receiver.

- (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.

Parameters:
aTimeTag is a double.
Returns:
Returns the receiver.

- (double) firstTimeTag  

Returns the smallest timeTag value considered for performance.

Returns:
Returns a double.

- (double) lastTimeTag  

Returns the greatest timeTag value considered for performance.

Returns:
Returns a double.

- (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.

Parameters:
aTimeShift is a double.
Returns:
Returns the receiver.

- (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.

Parameters:
aDuration is a double.
Returns:
Returns the receiver.

- (double) timeShift  

Returns the receiver's performance time offset in beats.

Returns:
Returns a double.

- (double) duration  

Returns the receiver's maximum performance duration in beats.

Returns:
Returns a double.

- (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.

Returns:
Returns an id.

- (id) setConductor: (MKConductor *)  aConductor  

Sends the message setConductor:aConductor to each of the receiver's MKPartPerformers.

Parameters:
aConductor is an id.
Returns:
Returns 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.

Parameters:
aPart is an MKPart instance.
Returns:
Returns an MKPartPerformer instance.

- (NSArray *) partPerformers  

Creates and returns a NSArray containing the receiver's MKPartPerformers.

Returns:
Returns an NSArray instance.

- (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).

Returns:
Returns an NSArray. The array is autoreleased.

- (int) status  

Returns the receiver's status.

Returns:
Returns an int.

- (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.

Parameters:
aPartPerformerSubclass is a Class.
Returns:
Returns an id.

- (Class) partPerformerClass  

Returns the class used for MKPartPerformers, as set by setPartPerformerClass:.

The default is MKPartPerformer itself.

- (void) setDelegate: (id)  object  

Sets the delegate as indicated.

Parameters:
object is an id.
See also:
MKPerformerDelegate.h

- (id) delegate  

Returns the receiver's delegate object, if any.

Returns:
Returns an id.
See also:
MKPerformerDelegate.h

- (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.


Member Data Documentation

- (NSMutableArray*) partPerformers [protected]

The object's status.

- (MKScore*) score [protected]

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.


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