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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3614 - (hide annotations) (download) (as text)
Tue Oct 1 09:11:27 2019 UTC (4 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5509 byte(s)
Refactored LFO class names and their header file names:

* Renamed PulseLFO -> LFOPulse, LFOSawIntMath -> LFOSawIntMathNew,
  SawLFO -> LFOSawIntMathOld, SineLFO -> LFOSineBuiltinFn,
  LFOSine -> LFOSineNumericComplexNr, SquareLFO -> LFOSquarePulse.

* Separated LFOSquarePulse (previously "SquareLFO") to its own
  header file.

* Renamed type LFOSigned -> LFOTriangleSigned.

* Renamed type LFOUnsigned -> LFOTriangleUnsigned.

* Bumped version (2.1.1.svn19).

1 iliev 2205 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5 persson 2327 * Copyright (C) 2011 - 2012 Grigor Iliev *
6 iliev 2205 * *
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 schoenebeck 3102 virtual bool Active() OVERRIDE { return active(); }
48     virtual float GetLevel() OVERRIDE { return getLevel(); }
49     virtual void EnterReleaseStage() OVERRIDE;
50     virtual void CancelRelease() OVERRIDE;
51 iliev 2205 };
52    
53     class VolEGUnit : public EGUnit {
54     public:
55 iliev 2217 VolEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { }
56    
57 schoenebeck 3102 virtual void Trigger() OVERRIDE;
58     virtual void Increment() OVERRIDE;
59 iliev 2205 };
60    
61     class ModEGUnit : public EGUnit {
62     public:
63 iliev 2217 ModEGUnit(SF2SignalUnitRack* rack): EGUnit(rack) { }
64    
65 schoenebeck 3102 virtual void Trigger() OVERRIDE;
66     virtual void Increment() OVERRIDE;
67 iliev 2205 };
68    
69 schoenebeck 3614 class ModLfoUnit : public SFSignalUnit, public LFOTriangleSigned {
70 iliev 2207 public:
71 schoenebeck 3614 ModLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOTriangleSigned(1200.0f) { }
72 schoenebeck 3102 virtual bool Active() OVERRIDE { return true; }
73     virtual void Trigger() OVERRIDE;
74     virtual void Increment() OVERRIDE;
75     virtual float GetLevel() OVERRIDE { return Level; }
76 iliev 2207 };
77    
78 schoenebeck 3614 class VibLfoUnit : public SFSignalUnit, public LFOTriangleSigned {
79 iliev 2205 public:
80 schoenebeck 3614 VibLfoUnit(SF2SignalUnitRack* rack): SFSignalUnit(rack), LFOTriangleSigned(1200.0f) { }
81 schoenebeck 3102 virtual bool Active() OVERRIDE { return true; }
82     virtual void Trigger() OVERRIDE;
83     virtual void Increment() OVERRIDE;
84     virtual float GetLevel() OVERRIDE { return Level; }
85 iliev 2205 };
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 schoenebeck 3101 virtual void Trigger() OVERRIDE;
97 iliev 2205
98     /** The endpoint should be active until the volume EG is active. */
99 schoenebeck 3101 virtual bool Active() OVERRIDE;
100 iliev 2205
101 schoenebeck 3101 virtual float GetVolume() OVERRIDE;
102     virtual float GetFilterCutoff() OVERRIDE;
103     virtual float GetPitch() OVERRIDE;
104     virtual float GetResonance() OVERRIDE;
105     virtual float GetPan() OVERRIDE { return 0; }
106     virtual uint8_t CalculatePan(int pan) OVERRIDE { 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 schoenebeck 3102 virtual EndpointSignalUnit* GetEndpointUnit() OVERRIDE;
127     virtual void EnterFadeOutStage() OVERRIDE;
128     virtual void EnterFadeOutStage(int maxFadeOutSteps) OVERRIDE;
129 persson 2327
130     void CalculateFadeOutCoeff(float FadeOutTime, float SampleRate);
131 iliev 2296
132 schoenebeck 3102 virtual void UpdateEqSettings(EqSupport* pEqSupport) OVERRIDE { }
133 iliev 2205 };
134    
135     }} // namespace LinuxSampler::sf2
136    
137     #endif /* __LS_SF2SIGNALUNITRACK_H__ */

  ViewVC Help
Powered by ViewVC