1 /* 2 Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net> 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 */ 18 19 20 #ifndef __ASECTION_H 21 #define __ASECTION_H 22 23 #include "global.h" 24 25 using namespace Ms; 26 27 #define PERIOD 64 28 #define MIXLEN 64 29 #define NCHANN 4 30 #define NRANKS 32 31 32 //--------------------------------------------------------- 33 // Diffuser 34 //--------------------------------------------------------- 35 36 class Diffuser { 37 float *_data; 38 int _size; 39 int _i; 40 float _c; 41 42 public: 43 void init(int size, float c); 44 void fini(); size()45 int size() { return _size; } process(float x)46 float process(float x) { 47 float w = x - _c * _data [_i]; 48 x = _data [_i] + _c * w; 49 _data [_i] = w; 50 if (++_i == _size) 51 _i = 0; 52 return x; 53 } 54 }; 55 56 //--------------------------------------------------------- 57 // Asection 58 //--------------------------------------------------------- 59 60 class Asection { 61 enum { AZIMUTH, STWIDTH, DIRECT, REFLECT, REVERB }; 62 63 int _offs0; 64 int _offs [16]; 65 float _fsam; 66 float *_base; 67 float _sw; 68 float _sx; 69 float _sy; 70 Diffuser _dif0; 71 Diffuser _dif1; 72 Diffuser _dif2; 73 Diffuser _dif3; 74 SyntiParameter _apar [5]; 75 76 public: 77 Asection (float fsam); 78 ~Asection (); 79 get_wptr()80 float *get_wptr () { return _base + _offs0; } get_apar()81 SyntiParameter *get_apar () { return _apar; } 82 void set_size (float size); 83 void process (float vol, float *W, float *X, float *Y, float *R); 84 85 static float _refl [16]; 86 }; 87 88 #endif 89 90