#import <MKInstrument.h>
Public Member Functions | |
(id) | - realizeNote:fromNoteReceiver: |
You implement this method in a subclass to define the manner in which the subclass realizes MKNotes. | |
(id) | - firstNote: |
You never invoke this method; it's invoked just before the MKInstrument realizes its first MKNote. | |
(NSArray *) | - noteReceivers |
Creates and returns an NSArray that contains the MKInstrument's MKNoteReceivers. | |
(int) | - indexOfNoteReceiver: |
Returns the ordinal index of aNoteReceiver in the MKInstrument's MKNoteReceiver NSArray. | |
(BOOL) | - isNoteReceiverPresent: |
Returns YES if aNoteReceiver is in the MKInstrument's MKNoteReceiver NSArray. | |
(id) | - addNoteReceiver: |
Adds aNoteReceiver to the MKInstrument, first removing it from its current MKInstrument, if any. | |
(id) | - removeNoteReceiver: |
Removes aNoteReceiver from the MKInstrument's MKNoteReceiver NSArray, but neither disconnects the MKNoteReceiver from its connected MKNoteSenders, nor does it free the MKNoteReceiver. | |
(void) | - dealloc |
Disconnects, removes, and releases ivars. | |
(id) | - disconnectNoteReceivers |
Disconnects the object's MKNoteReceivers. | |
(id) | - removeFromPerformance |
Removes the object from the performance by disconnecting its MKNoteReceivers and invokes the -afterPerformance method. | |
(id) | - removeNoteReceivers |
Removes all the MKInstrument's MKNoteReceivers but neither disconnects nor frees them. | |
(BOOL) | - inPerformance |
Returns YES if the MKInstrument is in performance. | |
(id) | - afterPerformance |
You never invoke this method; it's automatically invoked when the performance is finished. | |
(id) | - copyWithZone: |
Creates and returns a new MKInstrument as a copy of the receiving MKInstrument allocated from zone. | |
(MKNoteReceiver *) | - noteReceiver |
Returns the first MKNoteReceiver in the MKInstrument's MKNoteReceiver NSArray. | |
(id) | - allNotesOff |
Immediately stops playing any sounding notes. |
An MKInstrument receives MKNotes through its MKNoteReceivers, auxilliary objects that are typically connected to a MKPerformer's MKNoteSenders. The manner in which an MKInstrument realizes MKNotes is defined in its implementation of realizeNote:fromNoteReceiver:. This method is automatically invoked by an MKInstrument's MKNoteReceivers, when such objects receive receiveNote: messages.
An MKInstrument is considered to be in performance from the time that one of its MKNoteReceivers invokes the realizeNote:fromNoteReceiver: method until the MKConductor class receives the finishPerformance message. There are two implications regarding an MKInstrument's involvement in a performance:
Creating and adding MKNoteReceivers to an MKInstrument object is generally the obligation of the MKInstrument subclass; most subclasses dispose of this duty in their init methods. However, instances of some subclasses are born with no MKNoteReceivers - they expect these objects to be added by your application. You should visit the class description of the MKInstrument subclass that you're using to determine just what sort of varmint you're dealing with.
The MusicKit defines a number of MKInstrument subclasses. Notable among these are: MKSynthInstrument, which synthesizes MKNotes on the DSP; MKPartRecorder adds MKNotes to a designated MKPart; MKScorefileWriter writes them to a scorefile; and MKNoteFilter, an abstract class that acts as a MKNote conduit, altering the MKNotes that it receives before passing them on to other MKInstruments. In addition, the MKMidi class can be used as an MKInstrument to realize MKNotes on an external MIDI synthesizer.
- (id) realizeNote: | (MKNote *) | aNote | ||
fromNoteReceiver: | (MKNoteReceiver *) | aNoteReceiver | ||
You implement this method in a subclass to define the manner in which the subclass realizes MKNotes.
aNote | is an id. | |
aNoteReceiver | is an id. |
Reimplemented in MKMixerInstrument, MKPartRecorder, MKScorefileWriter, and MKSynthInstrument.
- (id) firstNote: | (MKNote *) | aNote |
You never invoke this method; it's invoked just before the MKInstrument realizes its first MKNote.
aNote | is an id. |
Reimplemented in MKFileWriter, and MKMixerInstrument.
- (NSArray *) noteReceivers |
Creates and returns an NSArray that contains the MKInstrument's MKNoteReceivers.
- (int) indexOfNoteReceiver: | (MKNoteReceiver *) | aNoteReceiver |
Returns the ordinal index of aNoteReceiver in the MKInstrument's MKNoteReceiver NSArray.
aNoteReceiver | is an id. |
- (BOOL) isNoteReceiverPresent: | (MKNoteReceiver *) | aNoteReceiver |
Returns YES if aNoteReceiver is in the MKInstrument's MKNoteReceiver NSArray.
aNoteReceiver | is an MKNoteReceiver. |
- (id) addNoteReceiver: | (MKNoteReceiver *) | aNoteReceiver |
Adds aNoteReceiver to the MKInstrument, first removing it from its current MKInstrument, if any.
aNoteReceiver | is an id. |
- (id) removeNoteReceiver: | (MKNoteReceiver *) | aNoteReceiver |
Removes aNoteReceiver from the MKInstrument's MKNoteReceiver NSArray, but neither disconnects the MKNoteReceiver from its connected MKNoteSenders, nor does it free the MKNoteReceiver.
aNoteReceiver | is an id. |
- (void) dealloc |
Disconnects, removes, and releases ivars.
If the receiver is in performance, does not release the MKInstrument's MKNoteReceivers.
Reimplemented in MKMixerInstrument, and MKNoteFilter.
- (id) disconnectNoteReceivers |
Disconnects the object's MKNoteReceivers.
- (id) removeFromPerformance |
Removes the object from the performance by disconnecting its MKNoteReceivers and invokes the -afterPerformance method.
- (id) removeNoteReceivers |
Removes all the MKInstrument's MKNoteReceivers but neither disconnects nor frees them.
- (BOOL) inPerformance |
Returns YES if the MKInstrument is in performance.
- (id) afterPerformance |
You never invoke this method; it's automatically invoked when the performance is finished.
Reimplemented in MKFileWriter, and MKMixerInstrument.
- (id) copyWithZone: | (NSZone *) | zone |
Creates and returns a new MKInstrument as a copy of the receiving MKInstrument allocated from zone.
zone | is a NSZone. |
Reimplemented in MKFileWriter, MKNoteFilter, MKPartRecorder, MKScorefileWriter, and MKSynthInstrument.
- (MKNoteReceiver *) noteReceiver |
Returns the first MKNoteReceiver in the MKInstrument's MKNoteReceiver NSArray.
[[anInstrument noteReceiver] receiveNote: aNote]
If there are currently no MKNoteReceivers, this method creates and adds a MKNoteReceiver.
- (id) allNotesOff |
Immediately stops playing any sounding notes.
The default behaviour is to do nothing. Subclasses may implement specific behaviour appropriate to the synthesis method.
Reimplemented in MKSynthInstrument.