/[svn]/linuxsampler/trunk/src/engines/sf2/SF2SignalUnitRack.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/engines/sf2/SF2SignalUnitRack.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2218 - (show annotations) (download) (as text)
Thu Jul 28 08:05:57 2011 UTC (12 years, 8 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 4885 byte(s)
* sfz engine: use the newly introduced signal units model

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 const int MaxUnitCount = 5;
32
33 class Voice;
34 class SF2SignalUnitRack;
35
36 class SFSignalUnit: public SignalUnit {
37 public:
38 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 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 VolEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { }
56
57 virtual void Trigger();
58 virtual void Increment();
59 };
60
61 class ModEGUnit : public EGUnit {
62 public:
63 ModEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { }
64
65 virtual void Trigger();
66 virtual void Increment();
67 };
68
69 class ModLfoUnit : public SFSignalUnit, public LFOSigned {
70 public:
71 ModLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOSigned(1200.0f) { }
72 virtual bool Active() { return true; }
73 virtual void Trigger();
74 virtual void Increment();
75 virtual float GetLevel() { return Level; }
76 };
77
78 class VibLfoUnit : public SFSignalUnit, public LFOSigned {
79 public:
80 VibLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOSigned(1200.0f) { }
81 virtual bool Active() { return true; }
82 virtual void Trigger();
83 virtual void Increment();
84 virtual float GetLevel() { return Level; }
85 };
86
87 class EndpointUnit : public EndpointSignalUnit {
88 public:
89 Voice* pVoice;
90
91 Parameter *prmVolEg, *prmModEgPitch, *prmModEgCutoff, *prmModLfoVol,
92 *prmModLfoPitch, *prmModLfoCutoff, *prmVibLfo;
93
94 EndpointUnit(SF2SignalUnitRack* rack);
95
96 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 };
106
107 class SF2SignalUnitRack : public SignalUnitRack {
108 private:
109 VolEGUnit suVolEG;
110 ModEGUnit suModEG;
111 ModLfoUnit suModLfo;
112 VibLfoUnit suVibLfo;
113 EndpointUnit suEndpoint;
114
115
116 public:
117 Voice* const pVoice;
118
119 /**
120 * @param Voice The voice to which this rack belongs.
121 */
122 SF2SignalUnitRack(Voice* Voice);
123
124 virtual EndpointSignalUnit* GetEndpointUnit();
125 virtual void EnterFadeOutStage();
126 };
127
128 }} // namespace LinuxSampler::sf2
129
130 #endif /* __LS_SF2SIGNALUNITRACK_H__ */

  ViewVC Help
Powered by ViewVC