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