1 |
/*************************************************************************** |
2 |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
5 |
* Copyright (C) 2011 Grigor Iliev * |
6 |
* * |
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_SF2SIGNALUNITRACK_H__ |
24 |
#define __LS_SF2SIGNALUNITRACK_H__ |
25 |
|
26 |
#include "../common/SignalUnitRack.h" |
27 |
#include "../sfz/EGADSR.h" |
28 |
#include "../common/AbstractVoice.h" |
29 |
|
30 |
namespace LinuxSampler { namespace sf2 { |
31 |
|
32 |
class Voice; |
33 |
|
34 |
class EGUnit : public SignalUnitBase<Voice>, public ::LinuxSampler::sfz::EGADSR { |
35 |
public: |
36 |
virtual bool Active() { return active(); } |
37 |
virtual float GetLevel() { return getLevel(); } |
38 |
virtual void EnterReleaseStage(); |
39 |
virtual void CancelRelease(); |
40 |
}; |
41 |
|
42 |
class VolEGUnit : public EGUnit { |
43 |
public: |
44 |
virtual void Trigger(); |
45 |
virtual void Increment(); |
46 |
}; |
47 |
|
48 |
class ModEGUnit : public EGUnit { |
49 |
public: |
50 |
virtual void Trigger(); |
51 |
virtual void Increment(); |
52 |
}; |
53 |
|
54 |
class VibLfoUnit : public SignalUnitBase<Voice>, public LFOSigned { |
55 |
public: |
56 |
VibLfoUnit(): LFOSigned(1200.0f) { } |
57 |
virtual bool Active() { return true; } |
58 |
virtual void Trigger(); |
59 |
virtual void Increment(); |
60 |
virtual float GetLevel() { return Level; } |
61 |
}; |
62 |
|
63 |
class EndpointUnit : public EndpointSignalUnitBase<Voice> { |
64 |
public: |
65 |
EndpointUnit() { } |
66 |
|
67 |
virtual void Trigger(); |
68 |
|
69 |
/** The endpoint should be active until the volume EG is active. */ |
70 |
virtual bool Active(); |
71 |
|
72 |
virtual float GetVolume(); |
73 |
virtual float GetFilterCutoff(); |
74 |
virtual float GetPitch(); |
75 |
virtual float GetResonance(); |
76 |
}; |
77 |
|
78 |
class SF2SignalUnitRack : public SignalUnitRackBase<Voice> { |
79 |
private: |
80 |
VolEGUnit suVolEG; |
81 |
ModEGUnit suModEG; |
82 |
VibLfoUnit suVibLfo; |
83 |
EndpointUnit suEndpoint; |
84 |
|
85 |
|
86 |
public: |
87 |
|
88 |
/** |
89 |
* @param Voice The voice to which this rack belongs. |
90 |
*/ |
91 |
SF2SignalUnitRack(Voice* Voice); |
92 |
|
93 |
virtual void Trigger(); |
94 |
virtual EndpointSignalUnit* GetEndpointUnit(); |
95 |
}; |
96 |
|
97 |
}} // namespace LinuxSampler::sf2 |
98 |
|
99 |
#endif /* __LS_SF2SIGNALUNITRACK_H__ */ |
100 |
|