2
Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net>
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.
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.
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.
36
_p0 (0), _p1 (0), _p2 (0), _l1 (0), _k_s (0), _k_r (0), _m_r (0),
37
_link (0), _sbit (0), _sdel (0),
38
_p_p (0), _y_p (0), _z_p (0), _p_r (0), _y_r (0), _g_r (0), _i_r (0)
41
~Pipewave (void) { delete[] _p0; }
43
friend class Rankwave;
45
void genwave (Addsynth *D, int n, float fsamp, float fpipe);
50
static void looplen (float f, float fsamp, int lmax, int *aa, int *bb);
51
static void attgain (int n, float p);
53
float *_p0; // attack start
54
float *_p1; // loop start
55
float *_p2; // loop end
56
int32_t _l0; // attack length
57
int32_t _l1; // loop length
58
int16_t _k_s; // sample step
59
int16_t _k_r; // release lenght
60
float _m_r; // release multiplier
61
float _d_r; // release detune
62
float _d_p; // instability
64
Pipewave *_link; // link to next in active chain
65
uint32_t _sbit; // on state bit
66
uint32_t _sdel; // delayed state
67
float *_out; // audio output buffer
68
float *_p_p; // play pointer
69
float _y_p; // play interpolation
70
float _z_p; // play interpolation speed
71
float *_p_r; // release pointer
72
float _y_r; // release interpolation
73
float _g_r; // release gain
74
int16_t _i_r; // release count
77
static void initstatic (float fsamp);
89
Rankwave (int n0, int n1);
94
if ((n < _n0) || (n > _n1)) return;
95
Pipewave *P = _pipes + (n - _n0);
97
if (! (P->_sdel || P->_p_p || P->_p_r))
105
void note_off (int n)
107
if ((n < _n0) || (n > _n1)) return;
108
Pipewave *P = _pipes + (n - _n0);
116
for (P = _list; P; P = P->_link) P->_sbit = 0;
119
int n0 (void) const { return _n0; }
120
int n1 (void) const { return _n1; }
121
void play (int shift);
122
void set_param (float *out, int del, int pan);
123
void gen_waves (Addsynth *D, float fsamp, float fbase, float *scale);
124
int save (const char *path, Addsynth *D, float fsamp, float fbase, float *scale);
125
int load (const char *path, Addsynth *D, float fsamp, float fbase, float *scale);
126
bool modif (void) const { return _modif; }
128
int _cmask; // used by division logic
129
int _nmask; // used by division logic
133
Rankwave (const Rankwave&);
134
Rankwave& operator=(const Rankwave&);