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_dpd_base.h"
26
typedef struct pdp_dpd_test_struct
28
t_pdp_dpd_base x_base;
35
static void pdp_dpd_test_1(t_pdp_dpd_test *x){post("%x: one", x);}
36
static void pdp_dpd_test_2(t_pdp_dpd_test *x){post("%x: two", x);}
37
static void pdp_dpd_test_3(t_pdp_dpd_test *x){post("%x: three", x);}
38
static void pdp_dpd_test_cleanup(t_pdp_dpd_test *x){post("%x: cleanup", x);}
39
static void pdp_dpd_test_inspect(t_pdp_dpd_test *x){post("%x: inspect", x);}
43
static void pdp_dpd_test_bang(t_pdp_dpd_test *x)
45
/* store a dummy packet */
46
pdp_dpd_base_set_context_packet(x, pdp_packet_new(PDP_IMAGE, 4096));
53
static void pdp_dpd_test_free(t_pdp_dpd_test *x)
59
t_class *pdp_dpd_test_class;
62
void *pdp_dpd_test_new(void)
65
t_pdp_dpd_test *x = (t_pdp_dpd_test *)pd_new(pdp_dpd_test_class);
67
/* init super: this is mandatory */
70
/* set the dpd processing methods & outlets */
71
pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_1);
72
pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_2);
73
pdp_dpd_base_add_outlet(x, (t_pdp_method)pdp_dpd_test_3);
75
pdp_dpd_base_add_cleanup(x, (t_pdp_method)pdp_dpd_test_cleanup);
76
pdp_dpd_base_add_inspector(x, (t_pdp_method)pdp_dpd_test_inspect);
89
void pdp_dpd_test_setup(void)
91
/* create a standard pd class */
92
pdp_dpd_test_class = class_new(gensym("pdp_dpd_test"), (t_newmethod)pdp_dpd_test_new,
93
(t_method)pdp_dpd_test_free, sizeof(t_pdp_dpd_test), 0, A_NULL);
95
/* inherit pdp base class methods */
96
pdp_dpd_base_setup(pdp_dpd_test_class);
99
class_addbang(pdp_dpd_test_class, pdp_dpd_test_bang);