~kamalmostafa/ubuntu/lucid/pdp/fix-504941-ftbfs

« back to all changes in this revision

Viewing changes to modules/image_basic/pdp_gain.c

  • Committer: Bazaar Package Importer
  • Author(s): Guenter Geiger (Debian/GNU)
  • Date: 2005-03-15 22:21:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050315222105-1q287rsihmd9j1tb
Tags: 1:0.12.4-2
* fixed the hardcoded depends
* added 3dp library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   Pure Data Packet module.
3
 
 *   Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org>
4
 
 *
5
 
 *   This program is free software; you can redistribute it and/or modify
6
 
 *   it under the terms of the GNU General Public License as published by
7
 
 *   the Free Software Foundation; either version 2 of the License, or
8
 
 *   (at your option) any later version.
9
 
 *
10
 
 *   This program is distributed in the hope that it will be useful,
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *   GNU General Public License for more details.
14
 
 *
15
 
 *   You should have received a copy of the GNU General Public License
16
 
 *   along with this program; if not, write to the Free Software
17
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
 *
19
 
 */
20
 
 
21
 
 
22
 
 
23
 
#include "pdp.h"
24
 
#include "pdp_imagebase.h"
25
 
 
26
 
 
27
 
typedef struct pdp_gain_struct
28
 
{
29
 
    t_pdp_imagebase x_base;
30
 
    void *x_gain;
31
 
 
32
 
} t_pdp_gain;
33
 
 
34
 
 
35
 
 
36
 
 
37
 
static void pdp_gain_process(t_pdp_gain *x)
38
 
{
39
 
    int p = pdp_base_get_packet(x, 0);
40
 
    u32 mask = pdp_imagebase_get_chanmask(x);
41
 
 
42
 
    pdp_packet_image_set_chanmask(p, mask);
43
 
    pdp_imageproc_dispatch_1buf(&pdp_imageproc_gain_process, x->x_gain, 0, p);
44
 
    
45
 
}
46
 
 
47
 
 
48
 
static void pdp_gain_gain(t_pdp_gain *x, t_floatarg f)
49
 
{
50
 
    pdp_imageproc_gain_setgain(x->x_gain, f);
51
 
}
52
 
 
53
 
 
54
 
 
55
 
t_class *pdp_gain_class;
56
 
 
57
 
 
58
 
 
59
 
void pdp_gain_free(t_pdp_gain *x)
60
 
{
61
 
    pdp_imagebase_free(x);
62
 
    pdp_imageproc_gain_delete(x->x_gain);
63
 
}
64
 
 
65
 
void *pdp_gain_new(t_floatarg f)
66
 
{
67
 
    t_pdp_gain *x = (t_pdp_gain *)pd_new(pdp_gain_class);
68
 
 
69
 
    /* super init */
70
 
    pdp_imagebase_init(x);
71
 
 
72
 
    /* no arg, or zero -> gain = 1 */
73
 
    if (f==0.0f) f = 1.0f;
74
 
 
75
 
 
76
 
    /* io */
77
 
    pdp_base_add_gen_inlet(x, gensym("float"), gensym("gain"));
78
 
    pdp_base_add_pdp_outlet(x);
79
 
 
80
 
    /* callbacks */
81
 
    pdp_base_set_process_method(x, (t_pdp_method)pdp_gain_process);
82
 
 
83
 
    x->x_gain = pdp_imageproc_gain_new();
84
 
    pdp_gain_gain(x, f);
85
 
 
86
 
    return (void *)x;
87
 
}
88
 
 
89
 
 
90
 
#ifdef __cplusplus
91
 
extern "C"
92
 
{
93
 
#endif
94
 
 
95
 
 
96
 
void pdp_gain_setup(void)
97
 
{
98
 
 
99
 
 
100
 
    pdp_gain_class = class_new(gensym("pdp_gain"), (t_newmethod)pdp_gain_new,
101
 
        (t_method)pdp_gain_free, sizeof(t_pdp_gain), 0, A_DEFFLOAT, A_NULL);
102
 
 
103
 
    pdp_imagebase_setup(pdp_gain_class);
104
 
 
105
 
    class_addmethod(pdp_gain_class, (t_method)pdp_gain_gain, gensym("gain"),  A_DEFFLOAT, A_NULL);   
106
 
 
107
 
}
108
 
 
109
 
#ifdef __cplusplus
110
 
}
111
 
#endif