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 __DIVISION_H
21 #define __DIVISION_H
22 
23 #include "asection.h"
24 #include "rankwave.h"
25 
26 //---------------------------------------------------------
27 //   Division
28 //---------------------------------------------------------
29 
30 class Division
31       {
32       Asection  *_asect;
33       Rankwave  *_ranks [NRANKS];
34       int        _nrank;
35       int        _dmask;
36       int        _trem;
37       float      _fsam;
38       float      _swel;
39       float      _gain;
40       float      _w;
41       float      _c;
42       float      _s;
43       float      _m;
44       float      _buff [NCHANN * PERIOD];
45 
46    public:
47       Division (Asection *asect, float fsam);
48       ~Division ();
49 
50       void set_rank (int ind, Rankwave *W, int pan, int del);
set_swell(float stat)51       void set_swell (float stat)   { _swel = 0.2 + 0.8 * stat * stat; }
set_tfreq(float freq)52       void set_tfreq (float freq)   { _w = 6.283184f * PERIOD * freq / _fsam; }
set_tmodd(float modd)53       void set_tmodd (float modd)   { _m = modd; }
54       void set_div_mask (int bits);
55       void clr_div_mask (int bits);
56       void set_rank_mask (int ind, int bits);
57       void clr_rank_mask (int ind, int bits);
trem_on()58       void trem_on()                { _trem = 1; }
trem_off()59       void trem_off()               { _trem = 2; }
60 
61       void process();
62       void update(int note, int mask);
63       void update(unsigned char *keys);
64       };
65 
66 #endif
67 
68