~ubuntu-branches/ubuntu/hardy/lmms/hardy

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/caps/SweepVF.h

  • Committer: Bazaar Package Importer
  • Author(s): Tobias Doerffel
  • Date: 2007-09-17 15:00:24 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070917150024-mo0zk4ks81jawqii
Tags: 0.3.0-1ubuntu1
* Resynchronized with Debian (LP: #139759, LP: #90806, LP: #102639,
  LP: #113447, LP: #121172, LP: #124890)
* reverted changes from 0.2.1-1.1ubuntu1 as upstream merged/included them

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        SweepVF.h
 
3
        
 
4
        Copyright 2004-5 Tim Goetze <tim@quitte.de>
 
5
        
 
6
        http://quitte.de/dsp/
 
7
 
 
8
        SweepVFI, a lorenz fractal modulating the cutoff frequency of a 
 
9
        state-variable (ladder) filter.
 
10
 
 
11
        SweepVFII, the same with Q being modulated by a second fractal.
 
12
 
 
13
*/
 
14
/*
 
15
        This program is free software; you can redistribute it and/or
 
16
        modify it under the terms of the GNU General Public License
 
17
        as published by the Free Software Foundation; either version 2
 
18
        of the License, or (at your option) any later version.
 
19
 
 
20
        This program is distributed in the hope that it will be useful,
 
21
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
23
        GNU General Public License for more details.
 
24
 
 
25
        You should have received a copy of the GNU General Public License
 
26
        along with this program; if not, write to the Free Software
 
27
        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
28
        02111-1307, USA or point your web browser to http://www.gnu.org.
 
29
*/
 
30
 
 
31
#ifndef _SWEEP_VF_H_
 
32
#define _SWEEP_VF_H_
 
33
 
 
34
#include "dsp/SVF.h"
 
35
#include "dsp/Lorenz.h"
 
36
#include "dsp/Roessler.h"
 
37
 
 
38
class SweepVFI
 
39
{
 
40
        public:
 
41
                double fs;
 
42
 
 
43
                /* svf parameters */
 
44
                d_sample f, Q;
 
45
 
 
46
                /* needs to be a power of two */
 
47
                enum {
 
48
                        BLOCK_SIZE = 32
 
49
                };
 
50
 
 
51
                DSP::StackedSVF<1,2> svf;
 
52
                DSP::Lorenz lorenz;
 
53
 
 
54
                d_sample normal;
 
55
 
 
56
                template <sample_func_t F>
 
57
                void one_cycle (int frames);
 
58
 
 
59
        public:
 
60
                static PortInfo port_info [];
 
61
                d_sample * ports [9];
 
62
 
 
63
                d_sample adding_gain;
 
64
 
 
65
                void init (double _fs);
 
66
 
 
67
                void activate();
 
68
 
 
69
                void run (int n)
 
70
                        {
 
71
                                one_cycle<store_func> (n);
 
72
                        }
 
73
                
 
74
                void run_adding (int n)
 
75
                        {
 
76
                                one_cycle<adding_func> (n);
 
77
                        }
 
78
};
 
79
 
 
80
class SweepVFII
 
81
{
 
82
        public:
 
83
                double fs;
 
84
 
 
85
                /* svf parameters */
 
86
                d_sample f, Q;
 
87
 
 
88
                /* needs to be a power of two */
 
89
                enum {
 
90
                        BLOCK_SIZE = 32
 
91
                };
 
92
 
 
93
                DSP::StackedSVF<1,2> svf;
 
94
                DSP::Lorenz lorenz1;
 
95
                DSP::Lorenz lorenz2;
 
96
 
 
97
                d_sample normal;
 
98
 
 
99
                template <sample_func_t F>
 
100
                void one_cycle (int frames);
 
101
 
 
102
        public:
 
103
                static PortInfo port_info [];
 
104
                d_sample * ports [13];
 
105
 
 
106
                d_sample adding_gain;
 
107
 
 
108
                void init (double _fs);
 
109
 
 
110
                void activate();
 
111
 
 
112
                void run (int n)
 
113
                        {
 
114
                                one_cycle<store_func> (n);
 
115
                        }
 
116
                
 
117
                void run_adding (int n)
 
118
                        {
 
119
                                one_cycle<adding_func> (n);
 
120
                        }
 
121
};
 
122
 
 
123
#endif /* _SWEEP_VF_H_ */