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

« back to all changes in this revision

Viewing changes to hist.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:
8
8
typedef struct _hist
9
9
{
10
10
    t_object x_obj;
11
 
        float m_lo;
12
 
        float m_hi;
13
 
        float m_scale;
 
11
        t_float m_lo;
 
12
        t_float m_hi;
 
13
        t_float m_scale;
14
14
        int m_nbins;
15
15
        int m_n_observations;
16
 
        float *m_hist;
 
16
        t_float *m_hist;
17
17
} t_hist;
18
18
 
19
19
 
41
41
static void hist_bang(t_hist *x)
42
42
{
43
43
        int i,n;
44
 
        float *f;
 
44
        t_float *f;
45
45
        t_atom *ap,*app;
46
46
 
47
47
        n=x->m_nbins;
63
63
static void hist_relative(t_hist *x)
64
64
{
65
65
        int i,n;
66
 
        float *f;
67
 
        float invn;
 
66
        t_float *f;
 
67
        t_float invn;
68
68
        t_atom *ap,*app;
69
69
        n=x->m_nbins;
70
70
    ap = (t_atom *)getbytes(sizeof(t_atom)*n);
87
87
static void hist_clear(t_hist *x)
88
88
{
89
89
        int i;
90
 
        float *f;
 
90
        t_float *f;
91
91
        f=x->m_hist;
92
92
        for (i=0;i<x->m_nbins;i++)
93
93
                *f++=0.0f;
100
100
        if (nbins<1)
101
101
        {
102
102
                nbins=1;
103
 
                post("hist: number of bins is minimum 1...");
 
103
                logpost(x, 2, "[hist] minimum number of bins is 1");
104
104
        }
105
105
        if (hi<=lo)
106
106
        {
107
 
                post("hist: higher bound must be higher than lower bound...");  
 
107
                logpost(x, 2, "[hist] higher bound (%g) must be greater than lower bound (%g)",
 
108
                hi, lo);
108
109
                hi=lo+1.0f;
109
110
        }
110
111
 
113
114
        x->m_hi=hi;
114
115
        x->m_lo=lo;
115
116
        x->m_nbins=(int)nbins;
116
 
        x->m_scale=(float)x->m_nbins/(hi-lo);
117
 
    x->m_hist = (float*)getbytes(sizeof(float)*x->m_nbins);
 
117
        x->m_scale=(t_float)x->m_nbins/(hi-lo);
 
118
    x->m_hist = (t_float*)getbytes(sizeof(t_float)*x->m_nbins);
118
119
 
119
120
        hist_clear(x);
120
121
}