| 1 | /* Copyright (c) 2002 Yves Degoyon. */ |
| 2 | /* For information on usage and redistribution, and for a DISCLAIMER OF ALL */ |
| 3 | /* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ |
| 4 | /* */ |
| 5 | /* a header for filterbank~ which outputs frequency response */ |
| 6 | /* for a range of filters */ |
| 7 | /* */ |
| 8 | /* The filter code is taken from Speech Filing System */ |
| 9 | /* from Mark Huckvale, University College London */ |
| 10 | /* */ |
| 11 | /* This program is free software; you can redistribute it and/or */ |
| 12 | /* modify it under the terms of the GNU General Public License */ |
| 13 | /* as published by the Free Software Foundation; either version 2 */ |
| 14 | /* of the License, or (at your option) any later version. */ |
| 15 | /* */ |
| 16 | /* See file LICENSE for further informations on licensing terms. */ |
| 17 | /* */ |
| 18 | /* This program is distributed in the hope that it will be useful, */ |
| 19 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 20 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 21 | /* GNU General Public License for more details. */ |
| 22 | /* */ |
| 23 | /* You should have received a copy of the GNU General Public License */ |
| 24 | /* along with this program; if not, write to the Free Software */ |
| 25 | /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 26 | /* */ |
| 27 | /* Based on PureData by Miller Puckette and others. */ |
| 28 | /* */ |
| 29 | /* Made while listening to : */ |
| 30 | /* */ |
| 31 | /* Twine -- Instrumentals */ |
| 32 | /* Andy T -- Poetry */ |
| 33 | /* ---------------------------------------------------------------------------- */ |
| 34 | |
| 35 | #ifndef __FILTERBANK_H |
| 36 | #define __FILTERBANK_H |
| 37 | |
| 38 | #include <stdlib.h> |
| 39 | #include <string.h> |
| 40 | #include <stdio.h> |
| 41 | #include <math.h> |
| 42 | #include <ctype.h> |
| 43 | #include "m_pd.h" |
| 44 | #include "m_imp.h" |
| 45 | #include "g_canvas.h" |
| 46 | |
| 47 | |
| 48 | /* this code is borrowed from pd's object : bp~ */ |
| 49 | |
| 50 | typedef struct bpctl |
| 51 | { |
| 52 | float c_x1; |
| 53 | float c_x2; |
| 54 | float c_coef1; |
| 55 | float c_coef2; |
| 56 | float c_gain; |
| 57 | } t_bpctl; |
| 58 | |
| 59 | typedef struct _filterbank_tilde |
| 60 | { |
| 61 | t_object x_obj; |
| 62 | t_glist *x_glist; |
| 63 | t_int x_samplerate; /* system sample rate */ |
| 64 | t_int x_lowfreq; /* lower frequency of all filters */ |
| 65 | t_int x_highfreq; /* higher frequency of all filters */ |
| 66 | t_int x_nbfilters; /* number of filters */ |
| 67 | t_outlet **x_outputs; /* outputs for frequency responses */ |
| 68 | t_int x_nselected; /* index of item selected */ |
| 69 | t_int x_width; /* graphical x size ( not setable ) */ |
| 70 | t_int x_height; /* graphical y size ( not setable ) */ |
| 71 | t_int x_selected; /* selection flag */ |
| 72 | t_int x_allocate; /* allocation flag */ |
| 73 | t_int *x_outmapping; /* output mapping array */ |
| 74 | |
| 75 | // bp~ section : borrowed from pd's d_filter.c |
| 76 | float x_sr; |
| 77 | float *x_freq; |
| 78 | float *x_q; |
| 79 | t_bpctl *x_cspace; |
| 80 | t_bpctl **x_ctl; |
| 81 | |
| 82 | t_float x_f; /* classical float for signal input */ |
| 83 | } t_filterbank_tilde; |
| 84 | |
| 85 | #endif |