getdetune() coding style cleanup
[zyn.git] / envelope.h
blob229630b0da9deb4ad19be8c0ee97f0f3561a64db
1 /*
2 ZynAddSubFX - a software synthesizer
4 Envelope.h - Envelope implementation
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of version 2 of the GNU General Public License
10 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License (version 2) for more details.
17 You should have received a copy of the GNU General Public License (version 2)
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef ENVELOPE_H
24 #define ENVELOPE_H
26 class Envelope
28 public:
29 Envelope();
30 ~Envelope();
32 void
33 init(
34 float sample_rate,
35 EnvelopeParams * envpars,
36 float basefreq);
38 void relasekey();
40 float envout();
41 float envout_dB();
43 bool finished(); // returns whether envelope has finished or not
45 private:
46 int envpoints;
47 int envsustain; // "-1" means disabled
48 float envdt[MAX_ENVELOPE_POINTS]; // millisecons
49 float envval[MAX_ENVELOPE_POINTS]; // [0.0 .. 1.0]
50 float m_stretch;
51 bool m_linear;
53 int currentpoint; // current envelope point (starts from 1)
54 bool m_forced_release;
55 bool m_key_released; // whether the key was released or not
56 bool m_finished; // whether envelope has finished or not
57 float t; // the time from the last point
58 float inct; // the time increment
59 float envoutval; // used to do the forced release
62 #endif