A
download MKInstrument.h
Language: ObjectiveC
Copyright: (c) 1988-1992, NeXT Computer, Inc. (c) 1999-2004, The MusicKit Project. (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT (c) 1994 Stanford University
LOC: 33
Project Info
The MusicKit(musickit)
Server: SourceForge
Type: cvs
...sicKit\Frameworks\MusicKit\
   _ArielQP.h
   _DSPMK.h
   _error.h
   _midi.h
   _MKAppProxy.h
   _MKAppProxy.m
   _MKNameTable.h
   _MKNameTable.m
   _MKParameter.h
   _MTCHelper.h
   _MTCHelper.m
   _musickit.h
   _noteRecorder.h
   _OrchloopbeginUG.h
   _OrchloopbeginUG.m
   _ParName.h
   _ParName.m
   _scorefile.h
   _ScorefileVar.h
   _ScorefileVar.m
   _SharedSynthInfo.h
   _SharedSynthInfo.m
   _synthElementMethods.m
   _time.h
   ArielQP.h
   ArielQP.m
   classFuncs.h
   ConductorPrivate.h
   dsp_types.h
   DSPSerialPortDevice.h
   dspwrap.h
   EnvelopePrivate.h
   equalTempered.m
   errors.h
   fastFFT.c
   fastFFT.h
   GNUmakefile.postamble
   GNUmakefile.preamble.in
   InstrumentPrivate.h
   keynums.h
   libMusicKit.def
   Localized.strings
   make.sh
   Makefile.postamble
   Makefile.preamble
   midi_spec.h
   midifile.h
   midifile.m
   MidiPrivate.h
   midiTranslation.h
   MKConductor.h
   MKConductor.m
   MKConductorDelegate.h
   MKDeviceStatus.h
   MKEnvelope.h
   MKEnvelope.m
   MKFilePerformer.h
   MKFilePerformer.m
   MKFileWriter.h
   MKFileWriter.m
   MKInstrument.h
   MKInstrument.m
   MKMidi.h
   MKMidi.m
   MKMixerInstrument.h
   MKMixerInstrument.m
   MKMTCPerformer.h
   MKMTCPerformer.m
   MKNote.h
   MKNoteFilter.h
   MKNoteFilter.m
   MKNoteReceiver.h
   MKNoteReceiver.m
   MKNoteSender.h
   MKNoteSender.m
   MKOrchestra.h
   MKPart.m
   MKPartials.h
   MKPartials.m
   ...tialsWaveshapingTable.m
   MKPartPerformer.h
   MKPartPerformer.m
   MKPartRecorder.h
   MKPartRecorder.m
   MKPatch.h
   MKPatch.m
   MKPatchConnection.h
   MKPatchConnection.m
   MKPatchEntry.h
   MKPatchEntry.m
   MKPatchTemplate.h
   MKPatchTemplate.m
   MKPerformer.h
   MKPerformer.m
   MKPerformerDelegate.h
   MKPlugin.h
   MKSamplerInstrument.h
   MKSamplerInstrument.m
   MKSamples.h
   MKScore.h
   MKScore.m
   MKScorefileObject.h
   MKScorefilePerformer.h
   MKScorefilePerformer.m
   MKScorefileWriter.m
   MKScorePerformer.h
   MKScorePerformer.m
   MKScoreRecorder.h
   MKScoreRecorder.m
   MKSynthData.h
   MKSynthData.m
   MKSynthInstrument.h
   MKSynthPatch.h
   MKTimbre.h
   MKTimbre.m
   MKTuningSystem.h
   MKTuningSystem.m
   MKUnitGenerator.h
   MKUnitGenerator.m
   MKWaveTable.h
   MKWaveTable.m
   mtcMidi.m
   mtcMidiPrivate.m
   MusicKit-Info.plist
   MusicKit.h
   MusicKitConfig.h.in
   names.h
   noDVal.h
   noteDispatcherMethods.m
   NotePrivate.h
   noteRecorderCFuncs.m
   noteRecorderMethods.m
   orch.h
   OrchestraPrivate.h
   OrchloopbeginUG.h
   OrchloopbeginUG.m
   orchloopbeginUGInclude.m
   params.h
   parNames.m
   partialsDBInclude.m
   PartialsPrivate.h
   PartPerformerPrivate.h
   PartPrivate.h
   PartRecorderPrivate.h
   PatchTemplatePrivate.h
   PB.project
   PerformerPrivate.h
   pitches.h
   platform.make
   ...efilePerformerPrivate.h
   ScorePerformerPrivate.h
   ScorePrivate.h
   ScoreRecorderPrivate.h
   SynthDataPrivate.h
   synthElementCFuncs.m
   synthElementMethods.m
   SynthInstrumentPrivate.h
   SynthPatchList.h
   SynthPatchList.m
   SynthPatchPrivate.h
   timetagInclude.m
   timeunits.h
   tokenNames.m
   tokens.h
   trigonometry.c
   trigonometry.h
   TuningSystemPrivate.h
   UnitGeneratorPrivate.h
   win32-def.top
   writeBinary.m
   writeMidi.m
   writeScore.m

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/*
  $Id: MKInstrument.h,v 1.14 2005/05/11 02:16:27 leighsmith Exp $
  Defined In: The MusicKit

 Description: 
   MKInstrument is an abstract class that defines the general mechanism for
   obtaining and realizing MKNotes during a MusicKit performance.  Each
   subclass of MKInstrument defines its particular manner of realization by
   implementing realizeNote:fromNoteReceiver:.
  
   Every MKInstrument contains a NSMutableArray of MKNoteReceivers, objects
   that receive MKNotes during a performance.  Each subclass of MKInstrument
   should implement its init method to automatically create and add
   some number of MKNoteReceivers to a newly created instance.  When a
   MKNoteReceiver receives a MKNote (through the receiveNote: method), it
   causes realizeNote:fromNoteReceiver: to be sent to its MKInstrument with
   the MKNote as the first argument and the MKNoteReceiver's id as the second
   argument.
  
   An MKInstrument is considered to be in performance from the time it
   realizes its first MKNote until the peformance is over.
  
   The MKInstrument subclasses provided by the MusicKit are:
  
   Subclass             Realization
   --------             -----------
   MKNoteFilter         Processes the MKNote and sends it on.
   MKNoteRecorder       Adds the MKNote to a MKPart or writes it to a file.
   MKSynthInstrument    Synthesizes a musical sound on the DSP.
  
   CF: MKNoteReceiver

  Original Author: David Jaffe

  Copyright (c) 1988-1992, NeXT Computer, Inc.
  Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT
  Portions Copyright (c) 1994 Stanford University
  Portions Copyright (c) 1999-2004, The MusicKit Project.
*/
/*!
  @class MKInstrument
  @brief 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
<b>realizeNote:fromNoteReceiver:</b>.  This method is automatically invoked by
an MKInstrument's MKNoteReceivers, when such objects receive 
<b>receiveNote:</b> messages.  

An MKInstrument is considered to be in performance from the time that one of its
MKNoteReceivers invokes the <b>realizeNote:fromNoteReceiver:</b> method until
the MKConductor class receives the <b>finishPerformance</b> message.  There are
two implications regarding an MKInstrument's involvement in a
performance:

<ul>
<li>An MKInstrument's <b>firstNote:</b> and <b>afterPerformance</b> 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.</li>

<li>Some MKInstrument methods can't be invoked during a performance.  For
example, you can't add or remove MKNoteReceivers while the MKInstrument is
performing.</li>
</ul>

Creating and adding MKNoteReceivers to an MKInstrument object is generally the
obligation of the MKInstrument subclass; most subclasses dispose of this duty in
their <b>init</b> 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.
*/
#ifndef __MK_Instrument_H___
#define __MK_Instrument_H___

#import <Foundation/Foundation.h>
//#import <Foundation/NSObject.h>
//#import <Foundation/NSArray.h>
#import "MKNote.h"
#import "MKNoteReceiver.h"

@interface MKInstrument: NSObject <NSCoding>
{
    /*! @var noteReceivers The object's array of MKNoteReceivers. */
    NSMutableArray *noteReceivers;

@protected
    BOOL noteSeen;
    void *_afterPerfMsgPtr;
}


/*!
  @return Returns <b>self</b>.
  @brief Initializes an MKInstrument that was created through
  <b>allocFromZone:</b>.

  You never invoke this method directly.  A
  subclass implementation should send [super init] before
  performing its own initialization.  The return value is ignored.
*/
- init; 

/*!
  @param  aNote is an id.
  @param  aNoteReceiver is an id.
  @return Returns an id.
  @brief You implement this method in a subclass to define the manner in
  which the subclass realizes MKNotes.

  <i>aNote</i> is the MKNote
  that's to be realized; <i>aNoteReceiver</i> is the MKNoteReceiver
  that received it.  The default implementation does nothing; the
  return value is ignored. Keep in mind that notes must be copied on write or store.
  
  You never invoke this method from your application; it should only
  be invoked by the MKInstrument's MKNoteReceivers as they are sent
  <b>receiveNote:</b> messages.  Keep in mind that you can send
  <b>receiveNote:</b> directly to a MKNoteReceiver for diagnostic
  or other untimed reception purposes. 
*/
- realizeNote: (MKNote *) aNote fromNoteReceiver: (MKNoteReceiver *) aNoteReceiver;

/*!
  @param  aNote is an id.
  @return Returns an id.
  @brief You never invoke this method; it's invoked just before the
  MKInstrument realizes its first MKNote.

  A subclass can implement
  this method to perform pre-realization initialization.  The argument
  is the MKNote that the MKInstrument is about to realize; it's
  provided as a convenience and can be ignored in a subclass
  implementation.  The MKInstrument is considered to be in performance
  after this method returns.  The return value is ignored.
  
  @see - <b>afterPerformance</b>, - <b>inPerformance</b>
*/
- firstNote: (MKNote *) aNote;

/*!
  @return Returns an NSArray.
  @brief Creates and returns an NSArray that contains the MKInstrument's
  MKNoteReceivers.

  The MKNoteReceivers themselves aren't copied.
  
  @see - <b>addNoteReceiver</b>, -
  <b>noteReceiver</b>,<b></b> - <b>isNoteReceiverPresent</b>
*/
- (NSArray *) noteReceivers;

/*!
  @param  aNoteReceiver is an id.
  @return Returns an int.
  @brief Returns the ordinal index of <i>aNoteReceiver</i> in the
  MKInstrument's MKNoteReceiver NSArray.

  Returns -1 if
  <i>aNoteReceiver</i>is not in the NSArray.
*/
- (int) indexOfNoteReceiver: (MKNoteReceiver *) aNoteReceiver;

/*!
  @param  aNoteReceiver is an MKNoteReceiver.
  @return Returns a BOOL.
  @brief Returns YES if <i>aNoteReceiver</i> is in the MKInstrument's
  MKNoteReceiver NSArray.

  Otherwise returns NO.
  
  @see - <b>noteReceiver</b>, - <b>noteReceivers</b>
*/
- (BOOL) isNoteReceiverPresent: (MKNoteReceiver *) aNoteReceiver; 

/*!
  @param  aNoteReceiver is an id.
  @return Returns an id.
  @brief Adds <i>aNoteReceiver</i> to the MKInstrument, first removing it
  from its current MKInstrument, if any.

  If the receiving
  MKInstrument is in performance, this does nothing and returns
  <b>nil</b>, otherwise returns <i>aNoteReceiver</i>.
  
  @see - <b>removeNoteReceiver:</b>, - <b>noteReceivers</b>, - <b>isNoteReceiverPresent:</b>
*/
- addNoteReceiver: (MKNoteReceiver *) aNoteReceiver;

/*!
  @param  aNoteReceiver is an id.
  @return Returns an id.
  @brief Removes <i>aNoteReceiver</i> from the MKInstrument's MKNoteReceiver
  NSArray, but neither disconnects the MKNoteReceiver from its
  connected MKNoteSenders, nor does it free the MKNoteReceiver.

  If
  the MKInstrument is in performance, this does nothing and returns
  <b>nil</b>, otherwise returns <i>aNoteReceiver</i>.
  
  @see - <b>removeNoteReceivers</b>, - <b>addNoteReceiver</b>, - <b>noteReceivers</b>, - <b>isNoteReceiverPresent</b>
*/
- removeNoteReceiver: (MKNoteReceiver *) aNoteReceiver; 

/*!
  @brief Disconnects, removes, and releases ivars.

  If the receiver is in performance, does not release the MKInstrument's MKNoteReceivers. 
 
  @see - <b>removeNoteReceivers:</b>
 */
- (void) dealloc; 

/*!
  @return Returns an id.
  @brief Disconnects the object's MKNoteReceivers.

  
*/
- disconnectNoteReceivers;

/*!
  @return Returns an id.
  @brief Removes the object from the performance by disconnecting its
  MKNoteReceivers and invokes the <b>-afterPerformance</b> method.

  
  This method is needed in order to be able to free a MKNoteFilter or
  MKInstrument during a performance. If the receiver is not in performance,
  does nothing and returns <b>nil</b>.
*/
- removeFromPerformance;

/*!
  @return Returns <b>self</b>.
  @brief Removes all the MKInstrument's MKNoteReceivers but neither
  disconnects nor frees them.

  
  
  @see - <b>removeNoteReceiver</b>, - <b>addNoteReceiver</b>, - <b>noteReceivers</b>, - <b>isNoteReceiverPresent</b>
*/
- removeNoteReceivers; 

/*!
  @return Returns a BOOL.
  @brief Returns YES if the MKInstrument is in performance.

  Otherwise
  returns NO.  An MKInstrument is considered to be in performance from
  the time that one of its MKNoteReceivers invokes
  <b>realizNote:fromNoteReceiver:</b>, until the time that the
  MKConductor class receives <b>finishPerformance.</b>
  
  @see - <b>firstNote:</b>, - <b>afterPerformance</b>
*/
- (BOOL) inPerformance;

/*!
  @return Returns an id.
  @brief You never invoke this method; it's automatically invoked when the
  performance is finished.

  A subclass can implement this method to do
  post-performance cleanup.  The default implementation does nothing;
  the return value is ignored.
  
  @see - <b>firstNote:</b>, - <b>inPerformance</b>
*/
- afterPerformance; 

/*!
  @param  zone is a NSZone.
  @return Returns an id.
  @brief Creates and returns a new MKInstrument as a copy of the receiving
  MKInstrument allocated from <i>zone</i>.

  The new object has its own
  MKNoteReceiver collection that contains copies of the MKInstrument's
  MKNoteReceivers. The new MKNoteReceivers' connections (see the 
	  MKNoteReceiver class) are copied from the MKNoteReceivers in the receiving
  MKInstrument.
*/
- copyWithZone: (NSZone *) zone; 

/*!
  @return Returns an MKNoteReceiver.
  @brief Returns the first MKNoteReceiver in the MKInstrument's
  MKNoteReceiver NSArray.

  This is useful if you want to send a MKNote
  directly to an MKInstrument, but you don't care which MKNoteReceiver
  does the receiving:
  	
  <tt>[[anInstrument noteReceiver] receiveNote: aNote]</tt>
  
  If there are currently no MKNoteReceivers, this method
  creates and adds a MKNoteReceiver.
  
  @see - <b>addNoteReceiver</b>, - <b>noteReceivers</b>, - <b>isNoteReceiverPresent</b>
*/
- (MKNoteReceiver *) noteReceiver; 

 /* 
  * You never send this message directly.  Archives noteReceiver Array.
  */
- (void) encodeWithCoder: (NSCoder *) aCoder;

 /* 
  * You never send this message directly.  
  * Note that -init is not sent to newly unarchived objects.
  * See write:. 
  */
- (id) initWithCoder: (NSCoder *) aDecoder;

/*!
  @brief Immediately stops playing any sounding notes.

  The default
  behaviour is to do nothing.
  Subclasses may implement specific behaviour appropriate to the synthesis method.
*/
- allNotesOff;

@end

#endif

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us