~ubuntu-branches/ubuntu/raring/pd-smlib/raring-proposed

« back to all changes in this revision

Viewing changes to lstd.c

  • Committer: Package Import Robot
  • Author(s): Hans-Christoph Steiner
  • Date: 2012-09-25 12:20:08 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120925122008-jhr5hyl3juh91eyv
Tags: 0.12.2-1
* updated to upstream version v0.12.2
* removed patches since they are in new upstream release
* bumped standards version to 3.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
typedef struct _lstd
8
8
{
9
9
    t_object x_obj;
10
 
        float m_avg;
11
 
        float m_sum_squares;
12
 
        float m_std;
13
 
        float m_c_leak;
14
 
        float m_leak;
 
10
        t_float m_avg;
 
11
        t_float m_sum_squares;
 
12
        t_float m_std;
 
13
        t_float m_c_leak;
 
14
        t_float m_leak;
15
15
} t_lstd;
16
16
 
17
17
 
18
18
static void lstd_perform(t_lstd *x, t_float in)
19
19
{
20
 
        float tmp=x->m_avg-in;
 
20
        t_float tmp=x->m_avg-in;
21
21
        x->m_avg= x->m_avg * x->m_c_leak + in * x->m_leak;
22
22
        x->m_sum_squares=x->m_sum_squares * x->m_c_leak + x->m_leak*tmp*tmp;
23
 
        x->m_std=(float)sqrtf(x->m_sum_squares);
 
23
        x->m_std=(t_float)sqrtf(x->m_sum_squares);
24
24
    outlet_float(x->x_obj.ob_outlet, x->m_std);
25
25
}
26
26
 
27
27
static void lstd_setHalfDecay(t_lstd *x, t_float halfDecayTime)
28
28
{
29
 
        x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime));
 
29
        x->m_c_leak=(t_float)powf(.5,(1.0f/halfDecayTime));
30
30
        x->m_leak=1.0f-x->m_c_leak;
31
31
}
32
32