1 |
iliev |
2205 |
/*************************************************************************** |
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 |
iliev |
2218 |
const int MaxUnitCount = 5; |
32 |
iliev |
2205 |
|
33 |
|
|
class Voice; |
34 |
iliev |
2217 |
class SF2SignalUnitRack; |
35 |
iliev |
2205 |
|
36 |
iliev |
2217 |
class SFSignalUnit: public SignalUnit { |
37 |
iliev |
2205 |
public: |
38 |
iliev |
2217 |
Voice* pVoice; |
39 |
|
|
|
40 |
|
|
SFSignalUnit(SF2SignalUnitRack* rack); |
41 |
|
|
}; |
42 |
|
|
|
43 |
|
|
class EGUnit : public SFSignalUnit, public ::LinuxSampler::sfz::EGADSR { |
44 |
|
|
public: |
45 |
|
|
EGUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack) { } |
46 |
|
|
|
47 |
iliev |
2205 |
virtual bool Active() { return active(); } |
48 |
|
|
virtual float GetLevel() { return getLevel(); } |
49 |
|
|
virtual void EnterReleaseStage(); |
50 |
|
|
virtual void CancelRelease(); |
51 |
|
|
}; |
52 |
|
|
|
53 |
|
|
class VolEGUnit : public EGUnit { |
54 |
|
|
public: |
55 |
iliev |
2217 |
VolEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { } |
56 |
|
|
|
57 |
iliev |
2205 |
virtual void Trigger(); |
58 |
|
|
virtual void Increment(); |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
class ModEGUnit : public EGUnit { |
62 |
|
|
public: |
63 |
iliev |
2217 |
ModEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { } |
64 |
|
|
|
65 |
iliev |
2205 |
virtual void Trigger(); |
66 |
|
|
virtual void Increment(); |
67 |
|
|
}; |
68 |
|
|
|
69 |
iliev |
2217 |
class ModLfoUnit : public SFSignalUnit, public LFOSigned { |
70 |
iliev |
2207 |
public: |
71 |
iliev |
2217 |
ModLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOSigned(1200.0f) { } |
72 |
iliev |
2207 |
virtual bool Active() { return true; } |
73 |
|
|
virtual void Trigger(); |
74 |
|
|
virtual void Increment(); |
75 |
|
|
virtual float GetLevel() { return Level; } |
76 |
|
|
}; |
77 |
|
|
|
78 |
iliev |
2217 |
class VibLfoUnit : public SFSignalUnit, public LFOSigned { |
79 |
iliev |
2205 |
public: |
80 |
iliev |
2217 |
VibLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOSigned(1200.0f) { } |
81 |
iliev |
2205 |
virtual bool Active() { return true; } |
82 |
|
|
virtual void Trigger(); |
83 |
|
|
virtual void Increment(); |
84 |
|
|
virtual float GetLevel() { return Level; } |
85 |
|
|
}; |
86 |
|
|
|
87 |
iliev |
2217 |
class EndpointUnit : public EndpointSignalUnit { |
88 |
iliev |
2205 |
public: |
89 |
iliev |
2217 |
Voice* pVoice; |
90 |
|
|
|
91 |
iliev |
2207 |
Parameter *prmVolEg, *prmModEgPitch, *prmModEgCutoff, *prmModLfoVol, |
92 |
|
|
*prmModLfoPitch, *prmModLfoCutoff, *prmVibLfo; |
93 |
iliev |
2205 |
|
94 |
iliev |
2217 |
EndpointUnit(SF2SignalUnitRack* rack); |
95 |
iliev |
2207 |
|
96 |
iliev |
2205 |
virtual void Trigger(); |
97 |
|
|
|
98 |
|
|
/** The endpoint should be active until the volume EG is active. */ |
99 |
|
|
virtual bool Active(); |
100 |
|
|
|
101 |
|
|
virtual float GetVolume(); |
102 |
|
|
virtual float GetFilterCutoff(); |
103 |
|
|
virtual float GetPitch(); |
104 |
|
|
virtual float GetResonance(); |
105 |
iliev |
2219 |
virtual float GetPan() { return 0; } |
106 |
|
|
virtual uint8_t CaluclatePan(uint8_t pan) { return pan; } |
107 |
iliev |
2205 |
}; |
108 |
|
|
|
109 |
iliev |
2217 |
class SF2SignalUnitRack : public SignalUnitRack { |
110 |
iliev |
2205 |
private: |
111 |
|
|
VolEGUnit suVolEG; |
112 |
|
|
ModEGUnit suModEG; |
113 |
iliev |
2207 |
ModLfoUnit suModLfo; |
114 |
iliev |
2205 |
VibLfoUnit suVibLfo; |
115 |
|
|
EndpointUnit suEndpoint; |
116 |
|
|
|
117 |
|
|
|
118 |
|
|
public: |
119 |
iliev |
2217 |
Voice* const pVoice; |
120 |
iliev |
2205 |
|
121 |
|
|
/** |
122 |
|
|
* @param Voice The voice to which this rack belongs. |
123 |
|
|
*/ |
124 |
|
|
SF2SignalUnitRack(Voice* Voice); |
125 |
|
|
|
126 |
iliev |
2218 |
virtual EndpointSignalUnit* GetEndpointUnit(); |
127 |
|
|
virtual void EnterFadeOutStage(); |
128 |
iliev |
2205 |
}; |
129 |
|
|
|
130 |
|
|
}} // namespace LinuxSampler::sf2 |
131 |
|
|
|
132 |
|
|
#endif /* __LS_SF2SIGNALUNITRACK_H__ */ |