/[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 3612 - (hide annotations) (download) (as text)
Mon Sep 30 18:03:43 2019 UTC (4 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2786 byte(s)
Added new LFO implementations:

* Added int math square LFO implementation.

* Added int math saw LFO implementation.

* Added numeric complex nr sine LFO implementation.

* Added public API C++ class "LFO", which is a cluster class
  encapsulating all the sampler's LFO implementations to be used by
  3rd party applications (e.g. by Gigedit).

* Marked class LFOTriangleDiHarmonic as deprecated
  (will be removed in future).

* Added LFOAll.h which includes all LFO implementation's header files.

* Fixed benchmarks/triang.cpp falsely having favoured "int math abs"
  algorithm (since result of 2nd run was not accumulated).

* Added benchmark for saw wave (benchmarks/saw.cpp).

* Added benchmark for sine wave (benchmarks/sine.cpp).

* Added benchmark for square wave (benchmarks/square.cpp).

* Increased amount of benchmarks runs by factor 6 to achieve benchmark
  times which are large enough on modern systems.

* Cleanup of LFO APIs.

* Bumped version (2.1.1.svn18).

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     }
44    
45     /**
46     * Calculates exactly one sample point of the LFO wave.
47     *
48     * @returns next LFO level
49     */
50     inline float render() {
51     this->iLevel += this->c;
52 schoenebeck 3612 if (RANGE == LFO::range_unsigned)
53 senkov 720 return this->normalizer * (float) (abs(this->iLevel));
54     else /* signed range */
55     return this->normalizer * (float) (abs(this->iLevel)) + this->offset;
56     }
57     };
58    
59     } // namespace LinuxSampler
60    
61     #endif // __LS_LFOTRIANGLEINTABSMATH_H__

  ViewVC Help
Powered by ViewVC