/[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 2219 - (show annotations) (download) (as text)
Thu Jul 28 12:35:49 2011 UTC (8 years, 11 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 5004 byte(s)
* sfz engine: implemented opcodes lfoN_delay,
  lfoN_freq, lfoN_pan, lfoN_cutoff, lfoN_resonance

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 virtual float GetPan() { return 0; }
106 virtual uint8_t CaluclatePan(uint8_t pan) { return pan; }
107 };
108
109 class SF2SignalUnitRack : public SignalUnitRack {
110 private:
111 VolEGUnit suVolEG;
112 ModEGUnit suModEG;
113 ModLfoUnit suModLfo;
114 VibLfoUnit suVibLfo;
115 EndpointUnit suEndpoint;
116
117
118 public:
119 Voice* const pVoice;
120
121 /**
122 * @param Voice The voice to which this rack belongs.
123 */
124 SF2SignalUnitRack(Voice* Voice);
125
126 virtual EndpointSignalUnit* GetEndpointUnit();
127 virtual void EnterFadeOutStage();
128 };
129
130 }} // namespace LinuxSampler::sf2
131
132 #endif /* __LS_SF2SIGNALUNITRACK_H__ */

  ViewVC Help
Powered by ViewVC