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

« back to all changes in this revision

Viewing changes to lhist.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 _lhist
8
8
{
9
9
    t_object x_obj;
10
 
        float m_lo;
11
 
        float m_hi;
12
 
        float m_scale;
13
 
        float m_c_leak;
14
 
        float m_leak;
 
10
        t_float m_lo;
 
11
        t_float m_hi;
 
12
        t_float m_scale;
 
13
        t_float m_c_leak;
 
14
        t_float m_leak;
15
15
        int m_nbins;
16
16
//      int m_n_observations;
17
 
        float *m_lhist;
 
17
        t_float *m_lhist;
18
18
} t_lhist;
19
19
 
20
20
static void lhist_setHalfDecay(t_lhist *x, t_float halfDecayTime)
21
21
{
22
 
        x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime));
 
22
        x->m_c_leak=(t_float)powf(.5,(1.0f/halfDecayTime));
23
23
        x->m_leak=1.0f-x->m_c_leak;
24
24
}
25
25
 
47
47
static void lhist_leak(t_lhist *x)
48
48
{
49
49
        int i;
50
 
        float *f;
51
 
        float sc;
 
50
        t_float *f;
 
51
        t_float sc;
52
52
        f=x->m_lhist;
53
53
    sc=x->m_c_leak;
54
54
        i=x->m_nbins;
59
59
static void lhist_bang(t_lhist *x)
60
60
{
61
61
        int i,n;
62
 
        float *f;
 
62
        t_float *f;
63
63
        t_atom *ap,*app;
64
64
        n=x->m_nbins;
65
65
    ap = (t_atom *)getbytes(sizeof(t_atom)*n);
79
79
static void lhist_relative(t_lhist *x)
80
80
{
81
81
        int i,n;
82
 
        float *f;
83
 
        float invn,sum;
 
82
        t_float *f;
 
83
        t_float invn,sum;
84
84
        t_atom *ap,*app;
85
85
 
86
86
        n=x->m_nbins;
107
107
static void lhist_clear(t_lhist *x)
108
108
{
109
109
        int i;
110
 
        float *f;
 
110
        t_float *f;
111
111
        f=x->m_lhist;
112
112
        for (i=0;i<x->m_nbins;i++)
113
113
                *f++=0.0f;
119
119
        if (nbins<1)
120
120
        {
121
121
                nbins=1;
122
 
                post("lhist: number of bins is minimum 1...");
 
122
                logpost(x, 2, "[lhist] minimum number of bins is 1");
123
123
        }
124
124
        if (hi<=lo)
125
125
        {
126
 
                post("lhist: higher bound must be higher than lower bound..."); 
 
126
                logpost(x, 2, "[lhist] higher bound (%g) must be greater than lower bound (%g)",
 
127
                hi, lo);        
127
128
                hi=lo+1.0f;
128
129
        }
129
130
        freebytes(x->m_lhist, x->m_nbins);
130
131
        x->m_hi=hi;
131
132
        x->m_lo=lo;
132
133
        x->m_nbins=(int)nbins;
133
 
        x->m_scale=(float)x->m_nbins/(hi-lo);
134
 
    x->m_lhist = (float*)getbytes(sizeof(float)*x->m_nbins);
 
134
        x->m_scale=(t_float)x->m_nbins/(hi-lo);
 
135
    x->m_lhist = (t_float*)getbytes(sizeof(t_float)*x->m_nbins);
135
136
 
136
137
        lhist_clear(x);
137
138
}