MusicKit  0.0.0
DelayUG.h
00001 /*
00002   $Id$
00003   
00004   Defined In: The MusicKit
00005   Description:
00006     DelayUG  - from dsp macro /usr/lib/dsp/ugsrc/delay.asm (see source for details).
00007 
00008         You instantiate a subclass of the form 
00009         DelayUG<a><b><c>, where 
00010         <a> = space of output
00011         <b> = space of input
00012         <c> = space of delay line
00013 
00014         DelayUG is useful for flanging, reverberation, plucked string 
00015         synthesis, etc.
00016  
00017 
00018   Original Author: David A. Jaffe
00019 
00020   Copyright (c) 1988-1992, NeXT Computer, Inc.
00021   Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT
00022   Portions Copyright (c) 1994 Stanford University.
00023   Portions Copyright (c) 1999-2001, The MusicKit Project.
00024 */
00025 // classgroup Delays and Time-Modification Units
00058 #ifndef __MK_DelayUG_H___
00059 #define __MK_DelayUG_H___
00060 
00061 #import <MusicKit/MKUnitGenerator.h>
00062 
00063 @interface DelayUG : MKUnitGenerator
00064 {
00065     id memObj;      /* Delay memory */
00066     int len;        /* Currently used length (must be <= length of memObj) */
00067 }
00068 
00077 +(BOOL)shouldOptimize:(unsigned) arg;
00078 /* Specifies that all arguments are to be optimized if possible except the
00079    delay pointer. */
00080 
00081 
00091 -setInput: (id) aPatchPoint;
00092 /* Sets input patchpoint as specified. */
00093 
00103 -setOutput: (id) aPatchPoint;
00104 /* Sets output patchpoint as specified. */
00105 
00118 - setDelayMemory: (id) aSynthData;
00119 /* Sets the delay memory to aSynthData.
00120    If you pass nil, uses sink as the delay memory. It is up to the caller
00121    to insure the memory is cleared. */
00122 
00123 
00133 - adjustLength: (int) newDelayLength;
00134 
00135 /* If no setDelayMemory: message has been received, returns nil.
00136    Otherwise, adjusts the delay length as indicated. newLength
00137    must be <= the length of the block of memory specified
00138    in setDelayMemory:. Otherwise, nil is returned. Note
00139    that the unused memory in the memory specified in 
00140    setDelayMemory: is not freed. Resetting the
00141    length of a running Delay may cause the pointer to go out-of-bounds.
00142    Therefore, it is prudent to send setPointer: or resetPointer after
00143    adjustLength:. Also note that when lengthening the delay, you 
00144    will be bringing in old delayed samples. Therefore, you may
00145    want to clear the new portion by sending the memory object the
00146    message -setToConstant:length:offset:. */
00147 
00148 
00157 - setPointer: (int) offset;
00158 /* If no setDelayMemory: message has been received, returns nil.
00159    Else sets pointer to specified offset. E.g. if offset == 0,
00160    this is the same as resetPointer. If offset is GEQ the length
00161    of the memory block, returns nil. */
00162 
00163 
00172 -resetPointer;
00173 /* If no setDelayMemory: message has been received, returns nil.
00174    Else sets pointer to start of memory. This is done automatically
00175    when setDelayMemory: is sent. */
00176 
00177 
00187 -(int)length;
00188 /* Returns the length of the delay currently in use. This is always <= than the
00189    length of the memory object. */
00190 
00191 -runSelf;
00192 /* Does nothing. */
00193 
00202 -idleSelf;
00203 /* Patches output and delay memory to sink. */
00204 
00205 
00206 @end
00207 
00208 #endif