00001 /* 00002 ugrw2.h: 00003 00004 Copyright (C) 1995 Robin Whittle 00005 00006 This file is part of Csound. 00007 00008 The Csound Library is free software; you can redistribute it 00009 and/or modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 Csound is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with Csound; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00021 02111-1307 USA 00022 */ 00023 00024 /* UGRW2.H */ 00025 /* These files are based on Robin Whittle's 00026 * ugrw2.c and ugrw2.h of 9 September 1995 00027 * 00028 * In February 1997, John Fitch reformatted the comments. 00029 * 00030 * 00031 * Copyright notice - Robin Whittle 25 February 1997 00032 * 00033 * Documentation files, and the original .c and .h files, with more 00034 * spaced out comments, are available from http://www.firstpr.com.au 00035 * 00036 * The code in both ugrw1 and ugrw2 is copyright Robin Whittle. 00037 * Permission is granted to use this in whole or in part for any 00038 * purpose, provided this copyright notice remains intact and 00039 * any alterations to the source code, including comments, are 00040 * clearly indicated as such. 00041 */ 00042 00043 /* 00044 * Unit generators by Robin Whittle 9 September 1995 00045 * 00046 * Header file containing data structures for UGRW2.C. 00047 */ 00048 00049 #include "csoundCore.h" 00050 00051 /* KPORT data structure. 00052 * 00053 * Output and input pointers. 00054 * 00055 * kr To k rate result. 00056 * 00057 * ksig k rate input. 00058 * 00059 * khtim k rate half time 00060 * 00061 * isig Initial value for 00062 * internal state. 00063 */ 00064 typedef struct { 00065 OPDS h; 00066 MYFLT *kr, *ksig, *khtim, *isig; 00067 MYFLT c1; /* Value to multiply with input value. */ 00068 MYFLT c2; /* Value to multiply with previous state. */ 00069 MYFLT yt1; /* Previous state. */ 00070 MYFLT prvhtim; /* Previous khtim. */ 00071 } KPORT; 00072 00073 /*************************************/ 00074 00075 /* KTONE data structure. 00076 * 00077 * For ktone and katone. 00078 * 00079 * Output and input pointers. 00080 * 00081 * kr To k rate result. 00082 * 00083 * ksig k rate input. 00084 * 00085 * khp k rate half power frequency input. 00086 * 00087 * isig Set to 0 to clear internal state. 00088 */ 00089 00090 typedef struct { 00091 OPDS h; 00092 MYFLT *kr, *ksig, *khp, *istor; 00093 MYFLT c1; /* Value to multiply with input value */ 00094 MYFLT c2; /* Value to multiply with previous state */ 00095 MYFLT yt1; /* Previous state */ 00096 MYFLT prvhp; /* Previous half power frequency */ 00097 } KTONE; 00098 00099 /*************************************/ 00100 00101 /* KRESON data structure. 00102 * 00103 * For kreson and kareson. 00104 * 00105 * Output and input pointers. 00106 * 00107 * kr To k rate result. 00108 * 00109 * ksig k rate input. 00110 * 00111 * kcf k rate centre freq. 00112 * 00113 * kbw k rate bandwidth 00114 * 00115 * iscl i rate scaling factor * 0, 1 or 2. 00116 * 00117 * istor Set to 0 to clear internal state. */ 00118 typedef struct { 00119 OPDS h; 00120 MYFLT *kr, *ksig, *kcf, *kbw, *iscl, *istor; 00121 int scale; 00122 MYFLT c1, c2, c3; /* Filter factors */ 00123 MYFLT yt1; /* Delay 1 k sample */ 00124 MYFLT yt2; /* Delay 2 k samples */ 00125 MYFLT cosf; /* Intermediate variable to help calculations */ 00126 MYFLT prvcf, prvbw; /* Previous centre freq and bandwidth */ 00127 } KRESON; 00128 00129 /*************************************/ 00130 00131 /* LIMIT data structure. 00132 * 00133 * For ilimit(), klimit() and limit(). 00134 */ 00135 typedef struct { 00136 OPDS h; 00137 MYFLT *xdest, *xsig, *xlow, *xhigh; 00138 } LIMIT; 00139 00140 int kporset(CSOUND*,KPORT *p); 00141 int kport(CSOUND*,KPORT *p); 00142 int ktonset(CSOUND*,KTONE *p); 00143 int ktone(CSOUND*,KTONE *p); 00144 int katone(CSOUND*,KTONE *p); 00145 int krsnset(CSOUND*,KRESON *p); 00146 int kreson(CSOUND*,KRESON *p); 00147 int kareson(CSOUND*,KRESON *p); 00148 int limitset(CSOUND*,LIMIT *p); 00149 int klimit(CSOUND*,LIMIT *p); 00150 int limit(CSOUND*,LIMIT *p); 00151