2
* Pure Data Packet module.
3
* Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org>
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.
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.
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.
24
#include "pdp_imagebase.h"
27
typedef struct pdp_gain_struct
29
t_pdp_imagebase x_base;
37
static void pdp_gain_process(t_pdp_gain *x)
39
int p = pdp_base_get_packet(x, 0);
40
u32 mask = pdp_imagebase_get_chanmask(x);
42
pdp_packet_image_set_chanmask(p, mask);
43
pdp_imageproc_dispatch_1buf(&pdp_imageproc_gain_process, x->x_gain, 0, p);
48
static void pdp_gain_gain(t_pdp_gain *x, t_floatarg f)
50
pdp_imageproc_gain_setgain(x->x_gain, f);
55
t_class *pdp_gain_class;
59
void pdp_gain_free(t_pdp_gain *x)
61
pdp_imagebase_free(x);
62
pdp_imageproc_gain_delete(x->x_gain);
65
void *pdp_gain_new(t_floatarg f)
67
t_pdp_gain *x = (t_pdp_gain *)pd_new(pdp_gain_class);
70
pdp_imagebase_init(x);
72
/* no arg, or zero -> gain = 1 */
73
if (f==0.0f) f = 1.0f;
77
pdp_base_add_gen_inlet(x, gensym("float"), gensym("gain"));
78
pdp_base_add_pdp_outlet(x);
81
pdp_base_set_process_method(x, (t_pdp_method)pdp_gain_process);
83
x->x_gain = pdp_imageproc_gain_new();
96
void pdp_gain_setup(void)
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);
103
pdp_imagebase_setup(pdp_gain_class);
105
class_addmethod(pdp_gain_class, (t_method)pdp_gain_gain, gensym("gain"), A_DEFFLOAT, A_NULL);