Minot coding style fix
[zyn.git] / envelope_parameters.h
blob1b2c6cddecf3667f8b7970af320c969eeda6990b
1 /*
2 ZynAddSubFX - a software synthesizer
4 EnvelopeParams.h - Parameters for Envelope
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_PARAMS_H
24 #define ENVELOPE_PARAMS_H
26 #define MAX_ENVELOPE_POINTS 40
27 #define MIN_ENVELOPE_DB -40
29 #define ZYN_ENVELOPE_MODE_ADSR 1 // ADSR parameters (linear amplitude)
30 #define ZYN_ENVELOPE_MODE_ADSR_DB 2 // ADSR_dB parameters (dB amplitude)
31 #define ZYN_ENVELOPE_MODE_ASR 3 // ASR parameters (frequency LFO)
32 #define ZYN_ENVELOPE_MODE_ADSR_FILTER 4 // ADSR_filter parameters (filter parameters)
33 #define ZYN_ENVELOPE_MODE_ASR_BW 5 // ASR_bw parameters (bandwidth parameters)
35 class EnvelopeParams
37 public:
38 EnvelopeParams();
39 ~EnvelopeParams();
41 void
42 init_adsr(
43 unsigned char stretch,
44 bool forced_release,
45 char attack_duration,
46 char decay_duration,
47 char sustain_value,
48 char release_duration,
49 bool linear);
51 void
52 init_asr(
53 unsigned char stretch,
54 bool forced_release,
55 char attack_value,
56 char attack_duration,
57 char release_value,
58 char release_duration);
60 void
61 init_adsr_filter(
62 unsigned char stretch,
63 bool forced_release,
64 char attack_value,
65 char attack_duration,
66 char decay_value,
67 char decay_duration,
68 char release_duration,
69 char release_value);
71 void
72 init_asr_bw(
73 unsigned char stretch,
74 bool forced_release,
75 char attack_value,
76 char attack_duration,
77 char release_value,
78 char release_duration);
80 unsigned char
81 get_value(
82 int index);
84 void
85 set_value(
86 int index,
87 unsigned char value);
89 unsigned char
90 get_duration(
91 int index);
93 void
94 set_duration(
95 int index,
96 unsigned char duration);
98 REALTYPE getdt(unsigned char i);
99 void set_point_value(int i, unsigned char value);
101 unsigned char Penvpoints;
102 unsigned char Penvsustain; // 127 pentru dezactivat
103 unsigned char Penvdt[MAX_ENVELOPE_POINTS];
104 float m_values[MAX_ENVELOPE_POINTS];
105 unsigned char m_values_params[MAX_ENVELOPE_POINTS];
107 // 0 = no stretch
108 // 64 = normal stretch (piano-like)
109 // 127 = 200% = envelope is stretched about 4 times/octave
110 unsigned char m_stretch;
112 bool m_forced_release;
114 bool m_linear; // if the amplitude envelope is linear
116 unsigned int m_mode; // one of ZYN_ENVELOPE_MODE_XXX
118 int m_attack_duration_index;
119 int m_decay_duration_index;
120 int m_release_duration_index;
122 int m_attack_value_index;
123 int m_decay_value_index;
124 int m_sustain_value_index;
125 int m_release_value_index;
128 #endif