1 |
schoenebeck |
53 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* LinuxSampler - modular, streaming capable sampler * |
4 |
|
|
* * |
5 |
schoenebeck |
56 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
schoenebeck |
53 |
* * |
7 |
|
|
* This program is free software; you can redistribute it and/or modify * |
8 |
|
|
* it under the terms of the GNU General Public License as published by * |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
10 |
|
|
* (at your option) any later version. * |
11 |
|
|
* * |
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 for more details. * |
16 |
|
|
* * |
17 |
|
|
* You should have received a copy of the GNU General Public License * |
18 |
|
|
* along with this program; if not, write to the Free Software * |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
20 |
|
|
* MA 02111-1307 USA * |
21 |
|
|
***************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef __LS_GIG_EGDECAY_H__ |
24 |
|
|
#define __LS_GIG_EGDECAY_H__ |
25 |
|
|
|
26 |
|
|
#include "../../common/global.h" |
27 |
|
|
|
28 |
|
|
#if DEBUG_HEADERS |
29 |
|
|
# warning EGDecay.h included |
30 |
|
|
#endif // DEBUG_HEADERS |
31 |
|
|
|
32 |
|
|
#include "../../common/RTMath.h" |
33 |
|
|
#include "../common/Event.h" |
34 |
|
|
#include "Engine.h" |
35 |
|
|
|
36 |
|
|
namespace LinuxSampler { namespace gig { |
37 |
|
|
|
38 |
|
|
/** |
39 |
|
|
* Decay Envelope Generator |
40 |
|
|
* |
41 |
|
|
* Simple Envelope Generator with only one stage: 'Decay'. We currently use |
42 |
|
|
* this specific EG only for pitch and thus it's not generalized yet, means |
43 |
|
|
* the initial envelope level (given by 'Depth') will raise / drop in |
44 |
|
|
* 'DecayTime' seconds to a level of exactly 1.0. If the initial level |
45 |
|
|
* ('Depth') is already 1.0, nothing happens. Beside that, the EG just |
46 |
|
|
* multiplies it's levels to the synthesis parameter sequence. |
47 |
|
|
*/ |
48 |
|
|
class EGDecay { |
49 |
|
|
public: |
50 |
|
|
EGDecay(gig::Engine* pEngine, Event::destination_t ModulationDestination); |
51 |
|
|
void Process(uint Samples); |
52 |
|
|
void Trigger(float Depth, double DecayTime, uint Delay); |
53 |
|
|
protected: |
54 |
|
|
gig::Engine* pEngine; |
55 |
|
|
Event::destination_t ModulationDestination; |
56 |
|
|
uint TriggerDelay; ///< number of sample points triggering should be delayed |
57 |
|
|
float Level; |
58 |
|
|
float DecayCoeff; |
59 |
|
|
long DecayStepsLeft; |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
}} // namespace LinuxSampler::gig |
63 |
|
|
|
64 |
|
|
#endif // __LS_GIG_EGDECAY_H__ |