~ubuntu-branches/ubuntu/wily/fil-plugins/wily

« back to all changes in this revision

Viewing changes to filters.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-01-09 01:53:21 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100109015321-7fwmuut8vq1e7r33
Tags: 0.3.0-1
* New upstream release.
* Switch to debhelper 7.
* Switch to quilt patch system.
* Refresh and convert all patches to quilt format.
* debian/control:
  - Bump Standards.
  - Set Debian Multimedia Maintainers as Maintainer.
  - Add myself as uploader.
  - Allow uploads by DM.
  - Add Vcs-* tags.
  - Add Homepage field.
  - Build-depend on ladspa-sdk.
* Bump debian/watch version to 3.
* Update debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
    Copyright (C) 2004 Fons Adriaensen
 
2
    Copyright (C) 2004-2009 Fons Adriaensen <fons@kokkinizita.net>
3
3
    
4
4
    This program is free software; you can redistribute it and/or modify
5
5
    it under the terms of the GNU General Public License as published by
32
32
 
33
33
    void init (void)
34
34
    {
35
 
        _f = 0.25;
36
 
        _b = _g = 1.0;
37
 
        _a = _s1 = _s2 = _z1 = _z2 = 0.0;
 
35
        _f = 0.25f;
 
36
        _b = _g = 1.0f;
 
37
        _a = _s1 = _s2 = _z1 = _z2 = 0.0f;
38
38
    }
39
39
    
40
40
    void proc (int k, float *sig, float f, float b, float g)
51
51
 
52
52
        if (f != _f)
53
53
        {
54
 
            if      (f < 0.5 * _f) f = 0.5 * _f;
55
 
            else if (f > 2.0 * _f) f = 2.0 * _f;
 
54
            if      (f < 0.5f * _f) f = 0.5f * _f;
 
55
            else if (f > 2.0f * _f) f = 2.0f * _f;
56
56
            _f = f;
57
 
            _s1 = -cos (2 * M_PI * f);
 
57
            _s1 = -cosf (6.283185f * f);
58
58
            d1 = (_s1 - s1) / k;           
59
59
            u2 = true;
60
60
        }             
61
61
       
62
62
        if (g != _g)
63
63
        {
64
 
            if      (g < 0.5 * _g) g = 0.5 * _g;
65
 
            else if (g > 2.0 * _g) g = 2.0 * _g;
 
64
            if      (g < 0.5f * _g) g = 0.5f * _g;
 
65
            else if (g > 2.0f * _g) g = 2.0f * _g;
66
66
            _g = g;
67
 
            _a = 0.5 * (g - 1.0);
 
67
            _a = 0.5f * (g - 1.0f);
68
68
            da = (_a - a) / k;
69
69
            u2 = true;
70
70
        }
71
71
 
72
72
        if (b != _b)
73
73
        {
74
 
            if      (b < 0.5 * _b) b = 0.5 * _b;
75
 
            else if (b > 2.0 * _b) b = 2.0 * _b;
 
74
            if      (b < 0.5f * _b) b = 0.5f * _b;
 
75
            else if (b > 2.0f * _b) b = 2.0f * _b;
76
76
            _b = b; 
77
77
            u2 = true;
78
78
        }
79
79
 
80
80
        if (u2)
81
81
        {
82
 
            b *= 4 * f;         
83
 
            _s2 = (1 + _a - b) / (1 + _a + b);
 
82
            b *= 7 * f / sqrtf (g);         
 
83
            _s2 = (1 - b) / (1 + b);
84
84
            d2 = (_s2 - s2) / k;        
85
85
        }
86
86
 
94
94
            *sig++ -= a * (_z2 + s2 * y - x);                           
95
95
            y -= s1 * _z1;
96
96
            _z2 = _z1 + s1 * y;
97
 
            _z1 = y + 1e-10;
 
97
            _z1 = y + 1e-10f;
98
98
        }
99
99
    }
100
100