00001 /* 00002 $Id: ConstantUG.h 3373 2006-09-27 21:23:14Z leighsmith $ 00003 00004 Defined In: The MusicKit 00005 Description: 00006 ConstantUG - from dsp macro /usr/lib/dsp/ugsrc/constant.asm (see source for details). 00007 00008 Outputs a constant. 00009 00010 You allocate one of the subclasses ConstantUG<a>, where <a> is the output 00011 space. 00012 00013 Note that you ONLY need to use the ConstantUG if the patchpoint you're 00014 writing will be overwritten by another UnitGenerator. If you merely want 00015 to reference an unchanging constant, you do not need a ConstantUG; just 00016 allocate a SynthData and use its setToConstant: method. 00017 00018 An example where the ConstantUG IS needed is in doing a reverberator. 00019 A global input patch point is published and the reverberator first reads 00020 this patchpoint, then sets it to 0 with a ConstantUG. Then any 00021 SynthPatches that write to the patchpoint add in to whatever's there. 00022 00023 Original Author: David A. Jaffe 00024 00025 Copyright (c) 1988-1992, NeXT Computer, Inc. 00026 Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT 00027 Portions Copyright (c) 1994 Stanford University. 00028 Portions Copyright (c) 1999-2001, The MusicKit Project. 00029 */ 00030 // classgroup Patchpoint Arithmetic 00050 #ifndef __MK_ConstantUG_H___ 00051 #define __MK_ConstantUG_H___ 00052 00053 #import <MusicKit/MKUnitGenerator.h> 00054 @interface ConstantUG: MKUnitGenerator 00055 00061 + (BOOL) shouldOptimize: (unsigned) arg; 00062 00063 -idleSelf; 00064 /* Sets output patchpoint to sink. */ 00065 00071 - setConstantDSPDatum: (DSPDatum) value; 00072 00078 - setConstant: (double) value; 00079 00085 - setOutput: (id) aPatchPoint; 00086 00087 @end 00088 00089 #endif