MusicKit
0.0.0
|
MKInstrument is an abstract class that defines the general mechanism for receiving and realizing MKNotes during a MusicKit performance. More...
#include <MKInstrument.h>
MKInstrument is an abstract class that defines the general mechanism for receiving and realizing MKNotes during a MusicKit performance.
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:
An MKInstrument's firstNote: and afterPerformance methods are invoked as the MKInstrument begins and finishes its performance, respectively. These methods can be implemented in a subclass to provide specialized initialization and post-performance cleanup.
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.