/[svn]/linuxsampler/trunk/src/engines/common/LFOTriangleIntAbsMath.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/engines/common/LFOTriangleIntAbsMath.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3625 - (hide annotations) (download) (as text)
Thu Oct 3 13:37:25 2019 UTC (4 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2900 byte(s)
* gig format extension: Added support for different LFO wave forms
  (currently either sine [default], triangle, saw or square).

* gig format extension: Added support for LFO phase displacement
  (0°..360°).

* gig format extension: Added support for flipping LFO polarity on LFO 3
  (in the original gig format this was only available for LFO 1 and LFO 2).

* Bumped version (2.1.1.svn22).

1 senkov 720 /***************************************************************************
2     * *
3     * Copyright (C) 2005 Christian Schoenebeck *
4     * *
5     * This library is free software; you can redistribute it and/or modify *
6     * it under the terms of the GNU General Public License as published by *
7     * the Free Software Foundation; either version 2 of the License, or *
8     * (at your option) any later version. *
9     * *
10     * This library is distributed in the hope that it will be useful, *
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13     * GNU General Public License for more details. *
14     * *
15     * You should have received a copy of the GNU General Public License *
16     * along with this library; if not, write to the Free Software *
17     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
18     * MA 02111-1307 USA *
19     ***************************************************************************/
20    
21     #ifndef __LS_LFOTRIANGLEINTABSMATH_H__
22     #define __LS_LFOTRIANGLEINTABSMATH_H__
23    
24     #include <stdlib.h>
25     #include "LFOTriangleIntMath.h"
26    
27     namespace LinuxSampler {
28    
29     /** @brief Triangle LFO (int math implementation)
30     *
31     * This is a triangle Low Frequency Oscillator which uses pure integer
32     * math (without branches) to synthesize the triangular wave.
33     */
34 schoenebeck 3612 template<LFO::range_type_t RANGE>
35 senkov 720 class LFOTriangleIntAbsMath : public LFOTriangleIntMath<RANGE> {
36     public:
37     /**
38     * Constructor
39     *
40     * @param Max - maximum value of the output levels
41     */
42     LFOTriangleIntAbsMath(float Max) : LFOTriangleIntMath<RANGE>::LFOTriangleIntMath(Max) {
43 schoenebeck 3625 //NOTE: DO NOT add any custom initialization here, since it would break LFOCluster construction !
44 senkov 720 }
45    
46     /**
47     * Calculates exactly one sample point of the LFO wave.
48     *
49     * @returns next LFO level
50     */
51     inline float render() {
52     this->iLevel += this->c;
53 schoenebeck 3612 if (RANGE == LFO::range_unsigned)
54 senkov 720 return this->normalizer * (float) (abs(this->iLevel));
55     else /* signed range */
56     return this->normalizer * (float) (abs(this->iLevel)) + this->offset;
57     }
58     };
59    
60     } // namespace LinuxSampler
61    
62     #endif // __LS_LFOTRIANGLEINTABSMATH_H__

  ViewVC Help
Powered by ViewVC