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

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/caps/Pan.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
        Pan.h
 
3
        
 
4
        Copyright 2004-5 Tim Goetze <tim@quitte.de>
 
5
        
 
6
        http://quitte.de/dsp/
 
7
 
 
8
        panorama with width control
 
9
 
 
10
*/
 
11
/*
 
12
        This program is free software; you can redistribute it and/or
 
13
        modify it under the terms of the GNU General Public License
 
14
        as published by the Free Software Foundation; either version 2
 
15
        of the License, or (at your option) any later version.
 
16
 
 
17
        This program is distributed in the hope that it will be useful,
 
18
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
        GNU General Public License for more details.
 
21
 
 
22
        You should have received a copy of the GNU General Public License
 
23
        along with this program; if not, write to the Free Software
 
24
        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
25
        02111-1307, USA or point your web browser to http://www.gnu.org.
 
26
*/
 
27
 
 
28
#ifndef _PAN_H_
 
29
#define _PAN_H_
 
30
 
 
31
#include "dsp/Delay.h"
 
32
#include "dsp/OnePole.h"
 
33
 
 
34
class PanTap
 
35
{
 
36
        public:
 
37
                int t;
 
38
                DSP::OnePoleLP damper;
 
39
 
 
40
                d_sample get (DSP::Delay & delay)
 
41
                        {
 
42
                                return damper.process (delay[t]);
 
43
                        }
 
44
 
 
45
                void reset (double c)
 
46
                        {
 
47
                                damper.set_f (c);
 
48
                                damper.reset();
 
49
                        }
 
50
};
 
51
 
 
52
class Pan
 
53
{
 
54
        public:
 
55
                double fs;
 
56
                d_sample pan;
 
57
 
 
58
                d_sample gain_l, gain_r;
 
59
                d_sample normal;
 
60
 
 
61
                DSP::Delay delay;
 
62
                PanTap tap;
 
63
 
 
64
                template <sample_func_t F>
 
65
                void one_cycle (int frames);
 
66
 
 
67
                inline void set_pan (d_sample);
 
68
 
 
69
        public:
 
70
                static PortInfo port_info [];
 
71
                d_sample * ports [7];
 
72
 
 
73
                d_sample adding_gain;
 
74
 
 
75
                void init (double _fs);
 
76
 
 
77
                void activate();
 
78
 
 
79
                void run (int n)
 
80
                        {
 
81
                                one_cycle<store_func> (n);
 
82
                        }
 
83
                
 
84
                void run_adding (int n)
 
85
                        {
 
86
                                one_cycle<adding_func> (n);
 
87
                        }
 
88
};
 
89
 
 
90
#endif /* _PAN_H_ */