#import <MKNoteSender.h>
Public Member Functions | |
(id) | - owner |
Returns the MKPerformer (or MKNoteFilter or MKMidi object) that owns the MKNoteSender. | |
(id) | - disconnect: |
Severs the connection between the MKNoteSender and aNoteReceiver; if the MKNoteReceiver isn't connected, this does nothing. | |
(BOOL) | - isConnected: |
Returns YES if aNoteReceiver is connected to the MKNoteSender, otherwise returns NO. | |
(id) | - connect: |
Connects aNoteReceiver to the MKNoteSender; if the argument isn't a MKNoteReceiver, the connection isn't made. | |
(id) | - squelch |
Disables the MKNoteSender's ability to send receiveNote: to its MKNoteReceivers. | |
(id) | - unsquelch |
Enables the MKNoteSender ability to send MKNotes, undoing the effect of a previous squelch message. | |
(BOOL) | - isSquelched |
Returns YES if the MKNoteSender is squelched (its MKNote-sending ability is disabled), otherwise returns NO. | |
(unsigned) | - connectionCount |
Returns the number of MKNoteReceivers that are connected to the MKNoteSender. | |
(NSArray *) | - connections |
Creates and returns a NSArray of the MKNoteReceivers that are connected to the MKNoteSender. | |
(void) | - dealloc |
Disconnects and frees the receiver. | |
(id) | - init |
Initializes a MKNoteSender that was created through allocFromZone:. | |
(void) | - disconnectAllReceivers |
Severs the connections between the MKNoteSender and all the MKNoteReceivers it's connected to. | |
(id) | - sendAndFreeNote:atTime: |
Enqueues, with the appropriate MKConductor, a request for sendAndFreeNote:aNote to be sent to self at time beatsSinceStart, measured in beats from the beginning of the MKConductor's performance. | |
(id) | - sendAndFreeNote:withDelay: |
Enqueues, with the appropriate Conductor, a request for sendAndFreeNote:aNote to be sent to self after delayTimeInBeats. | |
(id) | - sendAndFreeNote: |
Sends the message sendNote:aNote to self and then frees aNote. | |
(void) | - sendNote:atTime: |
Enqueues, with the MKConductor object described below, a request for sendNote:aNote to be sent to self at time beatsSinceStart, measured in beats from the beginning of the MKConductor's performance. | |
(void) | - sendNote:withDelay: |
Enqueues with aNote's MKConductor, a request for sendNote:aNote to be sent to self after delayTimeInBeats. | |
(id) | - sendNote: |
Sends the message receiveNote:aNote to the MKNoteReceivers that are connected to the MKNoteSender. | |
(id) | - copyWithZone: |
This is the same as copy, but the new object is allocated from zone. | |
Protected Attributes | |
NSMutableArray * | noteReceivers |
BOOL | isSquelched |
id | owner |
Instances are created and owned by MKPerformer objects, normally when the MKPerformer itself is created or initialized. A MKNoteSender object performs two functions:
There's a fundamental difference between these two tasks in that while you connect MKNoteSenders to MKNoteReceivers from your application, sending MKNotes is a MKPerformer's responsibility: Subclasses of MKPerformer should invoke sendNote: as part of their implementations of the perform method.
Keep in mind that while you can create MKNoteSenders and add them to MKPerformers through messages sent by your application (a MKNoteSender is added to a MKPerformer through the latter's addNoteSender: method), they're designed to be created and added by the MKPerformers themselves. Before adding your own MKNoteSenders to a MKPerformer, you should check the description of the MKPerformer subclass that you're using to ensure that your MKNoteSenders will be recognized.
A MKNoteSender can be owned by only one MKPerformer at a time; however, it can be connected to any number of MKNoteReceivers. In addition, two different MKNoteSenders can be connected to the same MKNoteReceiver. Thus the connections between MKPerformers and MKInstruments can describe an arbitrarily complicated network. To retrieve the MKNoteSenders that are owned by a particular MKPerformer - to connect them to MKNoteReceivers, or to squelch and unsquelch them - you invoke the MKPerformer's noteSender or noteSenders method.
MKNoteSenders are also created, owned, and used by instances of MKNoteFilter and MKMidi - neither of which are actual MKPerformers - as part of their assumptions of the role of MKPerformer. A MKNoteFilter subclass should send sendNote: to its MKNoteSenders as part of its implementation of realizeNote:fromNoteSender:. It isn't anticipated that MKMidi will be subclassed (at least not to override its sendNote: invocation).
- (id) owner |
Returns the MKPerformer (or MKNoteFilter or MKMidi object) that owns the MKNoteSender.
- (id) disconnect: | (MKNoteReceiver *) | aNoteReceiver |
Severs the connection between the MKNoteSender and aNoteReceiver; if the MKNoteReceiver isn't connected, this does nothing.
aNoteReceiver | is an MKNoteReceiver instance. |
- (BOOL) isConnected: | (MKNoteReceiver *) | aNoteReceiver |
Returns YES if aNoteReceiver is connected to the MKNoteSender, otherwise returns NO.
aNoteReceiver | is an MKNoteReceiver instance. |
- (id) connect: | (MKNoteReceiver *) | aNoteReceiver |
Connects aNoteReceiver to the MKNoteSender; if the argument isn't a MKNoteReceiver, the connection isn't made.
aNoteReceiver | is an MKNoteReceiver instance. |
- (id) squelch |
Disables the MKNoteSender's ability to send receiveNote: to its MKNoteReceivers.
While a receiver is squelched it can't send MKNotes.
- (id) unsquelch |
Enables the MKNoteSender ability to send MKNotes, undoing the effect of a previous squelch message.
- (BOOL) isSquelched |
Returns YES if the MKNoteSender is squelched (its MKNote-sending ability is disabled), otherwise returns NO.
- (unsigned) connectionCount |
Returns the number of MKNoteReceivers that are connected to the MKNoteSender.
- (NSArray *) connections |
Creates and returns a NSArray of the MKNoteReceivers that are connected to the MKNoteSender.
- (void) dealloc |
Disconnects and frees the receiver.
You can't free a MKNoteSender that's in the process of sending a MKNote.
- (id) init |
Initializes a MKNoteSender that was created through allocFromZone:.
Subclasses should send [super init]
when overriding this method. The new MKNoteSender is unsquelched and unowned.
- (void) disconnectAllReceivers |
Severs the connections between the MKNoteSender and all the MKNoteReceivers it's connected to.
- (id) sendAndFreeNote: | (MKNote *) | aNote | ||
atTime: | (double) | beatsSinceStart | ||
Enqueues, with the appropriate MKConductor, a request for sendAndFreeNote:aNote to be sent to self at time beatsSinceStart, measured in beats from the beginning of the MKConductor's performance.
See sendNote:atTime: for a description of the MKConductor that's used.
aNote | is an MKNote instance. | |
beatsSinceStart | is a double. |
- (id) sendAndFreeNote: | (MKNote *) | aNote | ||
withDelay: | (double) | delayTimeInBeats | ||
Enqueues, with the appropriate Conductor, a request for sendAndFreeNote:aNote to be sent to self after delayTimeInBeats.
See sendNote:atTime: for a description of the MKConductor that's used.
aNote | is an MKNote instance. | |
delayTimeInBeats | is a double. |
- (id) sendAndFreeNote: | (MKNote *) | aNote |
Sends the message sendNote:aNote to self and then frees aNote.
If the receiver is squelched, aNote isn't sent but it is freed.
aNote | is an MKNote instance. |
- (void) sendNote: | (MKNote *) | aNote | ||
atTime: | (double) | beatsSinceStart | ||
Enqueues, with the MKConductor object described below, a request for sendNote:aNote to be sent to self at time beatsSinceStart, measured in beats from the beginning of the MKConductor's performance.
If beatsSinceStart has already passed, the enqueued message is sent immediately.
The request is enqueued with the object that's returned by [aNote conductor]. Normally - if the owner is a MKPerformer
aNote | is an MKNote instance. | |
beatsSinceStart | is a double. |
- (void) sendNote: | (MKNote *) | aNote | ||
withDelay: | (double) | delayTimeInBeats | ||
Enqueues with aNote's MKConductor, a request for sendNote:aNote to be sent to self after delayTimeInBeats.
See sendNote:atTime: for a description of the MKConductor that's used.
aNote | is an MKNote instance. | |
delayTimeInBeats | is a double, measuring beats from the time this message is received. |
- (id) sendNote: | (MKNote *) | aNote |
Sends the message receiveNote:aNote to the MKNoteReceivers that are connected to the MKNoteSender.
If the MKNoteSender is squelched, the messages aren't sent. Normally, this method is only invoked by the MKNoteSender's owner.
aNote | is an MKNote instance. |
- (id) copyWithZone: | (NSZone *) | zone |
This is the same as copy, but the new object is allocated from zone.
zone | is a NSZone. |
- (NSMutableArray*) noteReceivers [protected] |
Array of connected MKNoteReceivers.
- (BOOL) isSquelched [protected] |
YES if the object is squelched.
- (id) owner [protected] |
MKPerformer (or MKNoteFilter) that owns this object.