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