download ArielQP.h
Language: ObjectiveC
Copyright: (c) 1988-1992, NeXT Computer, Inc. (c) 1999-2001, The MusicKit Project. (c) 1994 CCRMA, Stanford University. (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT
LOC: 45
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/*
  $Id: ArielQP.h,v 1.8 2005/05/27 09:52:25 leighsmith Exp $
  Defined In: The MusicKit

  Description:
    See the discussion below. With the demise of the QuintProcessor board (and NeXT hardware),
    this class becomes an example of multiple DSP operation. In theory it still works.
    
    This class is the MKOrchestra that represents the Quint Processor "hub"
    (or "master") DSP.  Creating an instance of ArielQP also creates the
    associated "satellite" DSPs ("sat" for short).  These are also called
    "slave" DSPs.  Note, however, that sending -open (or -run, etc.) to the ArielQP
    opens (or whatever) only the hub orchestra.   To send a messge to all the 
    satellite DSPs for this QuintProcessor, invoke the method makeSatellitesPerform:.
    Example:  [anArielQP makeSatellitesPerform:@selector(open)];  To send to all
    the DSPs for the QP, invoked makeQPPerform:.

    You may control whether sound from the satellite DSPs is brought into the
    hub DSP.  To control whether such sound is included or excluded, send 
    setSatSoundIn:.  The defualt is to include it.  Excluding it
    saves processing power on the hub, but means that the satellites will be useless,
    unless they send their sound out their serial port.

    If the satellite sound is included, it can be accessed via the In1qpUG MKUnitGenerator.
    Each instance of this unit generator takes sound from a particular channel on
    a particular DSP.  Note that you may have any number of these so that you can
    have multiple effects applied to the sound coming from a single source.

    For the common case of simply mixing each satellite to the output sample stream,
    a MKSynthPatch called ArielQPMix is provided in the Music Kit MKSynthPatch Library.
    This MKSynthPatch needs only to be allocated to work.   Be sure to deallocate it 
    before closing the MKOrchestra.
    
    FIXME: DRAM allocation

  Original Author: David A. 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 CCRMA, Stanford University.
  Portions Copyright (c) 1999-2001, The MusicKit Project.
*/
/*
  $Log: ArielQP.h,v $
  Revision 1.8  2005/05/27 09:52:25  leighsmith
  Added constants and types doxygen comments from old RTF doco

  Revision 1.7  2005/05/22 07:34:06  leighsmith
  Corrected and updated headerdoc

  Revision 1.6  2005/05/09 15:52:49  leighsmith
  Converted headerdoc comments to doxygen comments

  Revision 1.5  2001/09/07 00:12:52  leighsmith
  Corrected naming of satellite class

  Revision 1.4  2001/09/06 21:27:47  leighsmith
  Merged RTF Reference documentation into headerdoc comments and prepended MK to any older class names

  Revision 1.3  2000/03/31 00:16:44  leigh
  TODOs have become more standard FIXMEs

  Revision 1.2  1999/07/29 01:25:41  leigh
  Added Win32 compatibility, CVS logs, SBs changes

*/
/*!
  @class ArielQP
  @brief

The Ariel QuintProcessor is a board that fits into the NeXT cube.  It features
four "satellite" ("slave") DSPs with 16 or 32K of static RAM (SRAM), a hub DSP
with 8K of SRAM, a bank of dynamic RAM (DRAM) a set of serial ports, two per
DSP, and a SCSI chip.  The Music Kit supports the DSPs, the DSP ports, and the
DRAM.  It does not currently support the SCSI.

<b>ArielQP</b> class serves a dual purpose.  First it is a subclass of MKOrchestra
that represnts the hub DSP.  As such, it can be sent MKOrchestra messages such as
<b>allocUnitGenerator:</b>, <b>open</b>, <b>run</b>, etc.  Second, it
represents the Quint Processor as a whole.  The satellite DSPs are represented
by instances of the class <b>ArielQPSat</b> (see below).  Creating an instance
of ArielQP automatically creates the associated <b>ArielQPSat</b> objects.  
Freeing an <b>ArielQP</b> object frees its <b>ArielQPSat</b>
objects.

The <b>ArielQP</b> (hub DSP)  may be used as just another DSP, or it may be used
as the hub of the 5-DSP configuration.  To use it alone, send it the message
<b>setSatSoundIn:NO.</b>  In this mode, it sends and optionally receives sound
from its DSP serial port.  The satellite DSPs need not be used.  If they are
used, each sends and optionally receives sound from its serial port. Note that
in this mode you <i>must</i> have an Ariel ProPort plugged into any DSP that you
intend to use.  If you leave a DSP with no ProPort, its clock will never
advance.  Thus, for example, if you plan to use only DSP 'D', you should send
'run' to it alone, not to the MKOrchestra class.

<i>Note: The Quint Processor SCI port does not function like the NeXT DSP's SCI
port.  Therefore, when using a DSPSerialPortDevice with the QuintProcessor, you
should send setSendSettings:NO to disable sending of any commands to the SCI
port.  This implies that the only serial port device you should use with the
QuintProcess is the Ariel ProPort.</i>

To use the hub as part of a 5-DSP configuration, send the message
<b>setSatSoundIn:YES</b>to the <b>ArielQP.  </b>  The model here is of four
satellites doing synthesis or sound processing of sound received by their serial
ports and the hub merging these sounds, possibly doing more processing, and
sending the result out its serial port.  Since this is the most common way of
using the QuintProcessor, the default value of <b>satSoundIn </b>and
<b>hubSoundOut</b>are <b>YES</b> .  And since the hub is usually responsible for
sending sound to its serial port, the default value of <b>serialSoundOut</b> for
an <b>ArielQP</b> object is <b>YES.</b>  Note that in this mode you
<i>must</i> have an Ariel ProPort or equivalent plugged into DSP 'E'.

Note that <b>setSatSoundIn:YES</b>only <i>enables</i>  inter-DSP communication. 
In order to actually use the sound from the satellites, you must have one or
more instances of the unit generator <b>In1qpUG</b> running on the hub.  Each
instance provides access to one channel of sound from one of the satellite DSPs.
Multiple <b>In1qpUG</b> instances may be accessing the same satellite DSP
channel.  In addition, the Music Kit provides a MKSynthPatch for the common case
of simply adding all the satellites into the output stream.  This MKSynthPatch is
called <b>ArielQPMix</b>. Simply allocating an instance of this MKSynthPatch
immediately starts summing the satellites' sound into the hub DSP's output
stream.  You do not have to send the MKSynthPatch a MKNote.   <b>ArielQPMix</b> is
part of the Music Kit MKSynthPatch Library.

The hub has another special funtion - it alone can access the bank of DRAM.  To
access the DRAM, you need a unit generator that reads and writes the DRAM to be
running on the hub.  The Music Kit provides one such unit generator,
<b>DelayqpUG</b>, which implements a digital delay line using the DRAM.  To use
it, simply allocate one from the <b>ArielQP</b> object that represents the hub. 
<b>DelayqpUG</b> is very much like the DelayUG except that it is capable of much
longer delays.  Note that currently, the <b>ArielQP</b> class does not support
automatic allocation of DRAM - the  <b>MKSynthData</b> class is not used and the
application has to keep track of what memory it is using.  By combining
instances of In1qpUG and DelayqpUG, it is easy to make a MKSynthPatch that
reverberates the sound from the other DSPs.  Note that in the current
implemenation, the satellites do not have direct access to the DRAM.  To do
reverberation, they send their sound to the hub, either via inter-process sound
or via the DSP serial ports.  (Chaining DSP serial ports is a practical and
useful technique and is another approach to combining the power of the five
DSPs. )

The Music Kit does not automatically clear DRAM, with the exception of the
"zero" location.  If you want to clear a segment of DRAM, use a
<b>DelayqpUG</b>, set the input location to [orchestra segmentZero:MK_xPatch]
(or MK_yPatch), and let the <b>DelayqpUG</b> run for a while.  DRAM requires
periodic refreshing.  You can control whether this is "implicit" (done by the
mere accessing of the memory) or "automatic" (done by the Quint Processor
refresh hardware.)  The <b>ArielQP</b> method <b>setDRAMAutoRefresh:
</b>controls the refresh mode.  

The current version of<b> mkmon_A_qp_hub_8k.dsp</b> assumes a 256K DRAM bank. 
If you upgrade to larger DRAM, you have to change the configuration code in
<b>smsrc/reset_boot.asm</b>.

For an example of how to write a DSP unit generator that uses DRAM, see
<b>ugsrc/delayqp.asm</b>.  You should bracket any reading/writing of DRAM with
the macros <b>begin_dram_access</b> and <b>end_dram_access</b>.  See the file
<b>smsrc/qp.asm</b> for other useful QuintProcessor DSP macros.
*/
#ifndef __MK_ArielQP_H___
#define __MK_ArielQP_H___

#import "MKOrchestra.h"
#import "MKSynthData.h"

/*! Special QuintProcessor DRAM location that always holds a zero. */
#define MK_DRAM_ZERO 0           /* Use first sample as a ZERO */
/*! Special QuintProcessor DRAM location that acts as a "sink" or "bit bucket." */
#define MK_DRAM_SINK 1           /* Use second sample as a SINK */

@interface ArielQP: MKOrchestra
{
    int slot;         /* One of 2, 4 or 6 */
    BOOL satSoundIn;  /* YES if we're receiving sound from the satellites */
    BOOL DRAMAutoRefresh; /* YES if we're refreshing when needed */
    MKSynthData *_satSynthData; /* Buffers for incoming sound data */
    BOOL _initialized;
    NSDate * _reservedArielQP1; //sb: was double
}

/*!
  @return Returns an id.
  @brief If an ArielQP for slot 2 already exists, returns it.

  Otherwise, if an Ariel QuintProcessor board is installed in slot 2, creates and
  returns a new instance of ArielQP and creates, if necessary, four
  instances of ArielQPSat.  Otherwise returns nil.
*/
+new;

/*!
  @param  slot is an int.
  @return Returns an id.
  @brief If an ArielQP for the specified already exists, returns it.

  Otherwise, if an Ariel QuintProcessor board is installed in the
  specified, creates and returns a new instance of ArielQP and
  creates, if necessary, four instances of ArielQPSat.  Otherwise
  returns nil.  <i>&lt;&lt;Note:  In release 4.0 of the Music Kit, the
  first Ariel QuintProcessor must be in slot 2, the second must be in
  slot 4 and the third must be in slot 6. &gt;&gt;</i>
*/
+newInSlot:(unsigned short)slot;

/*!
  @brief Returns the specified satellite, which should be one of 'A', 'B', 'C', or 'D'.
  @param  which is a char.
  @return Returns an id.
*/
-satellite:(char)which;

/*!
  @param  yesOrNo is a BOOL.
  @return Returns an id.
  @brief If <i>yesOrNo</i>, enables the hub/satellite inter-process sound
  link.

  Note that if the link is enabled, all five DSPs must be sent
  the <b>run</b> message.  Otherwise, the hub DSP will block waiting
  for sound from the satellites that are not running.   If the link is
  not enabled, then the hub does not block and the other DSPs need not
  be running.  <b>setSatSoundIn:</b> must be sent when the ArielQP and
  ArielQPSat objects are closed (i.e. before they have been sent the
  <b>-open </b>message.
*/
-setSatSoundIn:(BOOL)yesOrNo;
/* Controls whether sound is obtained from the satellites. Default is YES. */


/*!
  @param  yesOrNo is a BOOL.
  @return Returns an id.
  @brief If <i>yesOrNo</i>, enables the DRAM refresh.

  If you use the macros
  provided in the file <b>smsrc/qp.asm</b>, your unit generator will
  automatically turn off refresh before accessing memory, then turn it
  on again.  Refresh is off by default.  For very low sampling rates
  or non-sequential DRAM accesses, it may be necessary to turn it on. 
  You'll know if you need to turn it on because you'll hear clicks
  and pops.
*/
- setDRAMAutoRefresh:(BOOL)yesOrNo;
/* Controls whether DRAM auto refresh is on.  Default is off. */


/*!
  @return Returns a BOOL.
  @brief Returns whether Auto Refresh is on.
*/
-(BOOL)DRAMAutoRefresh;

/*!
  @return Returns a BOOL.
  @brief Returns whether the hub/satellite inter-process sound link is
  enabled.
*/
-(BOOL)satSoundIn;

/*!
  @brief Sends the specified selector to the four ArielQPSat objects.
  @param  selector is a SEL.
  @return Returns an id.
*/
-makeSatellitesPerform:(SEL)selector;

/*!
  @brief Sends the specified selector to the four ArielQPSat objects with the
  specified argument.
  @param  selector is a SEL.
  @param  arg is an id.
  @return Returns an id.
*/
-makeSatellitesPerform:(SEL)selector with: (id) arg;

/*!
  @param  selector is a SEL.
  @return Returns an id.
  @brief Sends the specified selector to the objects representing all five
  DSPs.
*/
-makeQPPerform:(SEL)selector;

/*!
  @param  selector is a SEL.
  @param  arg is an id.
  @return Returns an id.
  @brief Sends the specified selector to the objects representing all five
  DSPs with the specified argument.
*/
- makeQPPerform: (SEL) selector with: (id) arg;

/*!
  @param  yesOrNo is a BOOL.
  @return Returns an id.
  @brief If <i>yesOrNo</i>, enables the DRAM refresh.

  If you use the macros
  provided in the file <b>smsrc/qp.asm</b>, your unit generator will
  automatically turn off refresh before accessing memory, then turn it
  on again.  Refresh is off by default.  For very low sampling rates
  or non-sequential DRAM accesses, it may be necessary to turn it on. 
  You'll know if you need to turn it on because you'll hear clicks
  and pops.
*/
- setDRAMAutoRefresh:(BOOL)yesOrNo;

@end

#import "MusicKit.h"

/*!
  @class ArielQPSat
  @brief

The ArieQPSat objects are used to represent the
QuintProcessor's satellite DSPs, one per instance of ArielQPSat. The satellite
DSPs can either be used individually, sending their sound out their serial port
(by sending the message <b>setSerialSoundOut:YES</b>) or they can be used as a
group, sending their sound to the hub DSP (by sending the message
<b>setHubSoundOut:YES</b>.)  These two modes cannot be combined.   Sending one
message, automatically disables the other.
*/
@interface ArielQPSat:MKOrchestra
{
    BOOL hubSoundOut; /* YES if we're sending sound to the hub. */
    NSDate * _reservedArielQPSat1; //sb: changed from double
}


/*!
  @return Returns an id.
  @brief Returns the hub corresponding to this satellite.  
*/
-hub;

/*!
  @param  yesOrNo is a BOOL.
  @return Returns an id.
  @brief If <i>yesOrNo</i>, enables the hub/satellite inter-process sound
  link.

  Note that if the link is enabled, all five DSPs must be sent
  the <b>run</b> message.  Otherwise, the hub DSP will block waiting
  for sound from the satellites that are not running.   If the link is
  not enabled, then the hub does not block and the other DSPs need not
  be running.  <b>setSatSoundIn:</b> must be sent when the ArielQP and
  ArielQPSat objects are closed (i.e. before they have been sent the
  <b>-open</b> message.   Sending this message automatically sends
  <b>setSerialSoundOut:NO</b> if serialSoundOut is
  enabled.
*/
-setHubSoundOut:(BOOL)yesOrNo;
/* Default is YES. Setting hubSoundOut disables serialSoundOut.  
 * Must be invoked when the deviceStatus is closed.
 */


/*!
  @return Returns a BOOL.
  @brief Returns whether the hub/satellite inter-process sound link is
  enabled.
*/
-(BOOL)hubSoundOut;

/*!
  @return Returns an int.
  @brief If hub sound out, forwards this message to the hub.

  Otherwise invokes super's version of this method.
*/
-(int)outputChannelOffset;

/*!
  @return Returns an int.
  @brief If hub sound out, forwards this message to the hub.

  Otherwise invokes super's version of this method.
*/
-(int)outputChannelCount;

/*!
  @return Returns an int.
  @brief If hub sound out, forwards this message to the hub.

  Otherwise invokes super's version of this method.
*/
-(int)outputInitialOffset;

/*!
  @return Returns a BOOL.
  @brief If hub sound out, forwards this message to the hub.

  Otherwise invokes super's version of this method.
*/
-(BOOL)upSamplingOutput;

/*!
  @return Returns a BOOL.
  @brief If hub sound out, forwards this message to the hub.

  Otherwise invokes super's version of this method.
*/
-(BOOL)isRealTime;
/* 
 * For all of these methods:
 * if hubSoundOut, forwards message to hubOrchestra.  Otherwise,
 * invokes superclass implementation.
 */


/*!
  @param  yesOrNo is a BOOL.
  @return Returns an id.
  @brief Same as superclass method except that sending this message
  automatically sends <b>setHubSoundOut:NO</b> if hubSoundOut is
  enabled.
*/
-setSerialSoundOut:(BOOL)yesOrNo;

@end

#endif

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