1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* Copyright (c) 1997-2001 Miller Puckette and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* MIDI. */
#include "m_pd.h"
static t_symbol *midirealtimein_sym;
static t_class *midirealtimein_class;
typedef struct _midirealtimein
{
t_object x_obj;
t_outlet *x_outlet1;
t_outlet *x_outlet2;
} t_midirealtimein;
static void *midirealtimein_new( void)
{
t_midirealtimein *x = (t_midirealtimein *)pd_new(midirealtimein_class);
x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
pd_bind(&x->x_obj.ob_pd, midirealtimein_sym);
#ifndef MSW
pd_error(x, "midirealtimein: works under MSW only");
#endif
return (x);
}
static void midirealtimein_list(t_midirealtimein *x, t_symbol *s,
int argc, t_atom *argv)
{
t_float portno = atom_getfloatarg(0, argc, argv);
t_float byte = atom_getfloatarg(1, argc, argv);
outlet_float(x->x_outlet2, portno);
outlet_float(x->x_outlet1, byte);
}
static void midirealtimein_free(t_midirealtimein *x)
{
pd_unbind(&x->x_obj.ob_pd, midirealtimein_sym);
}
void midirealtimein_setup(void)
{
midirealtimein_class = class_new(gensym("midirealtimein"),
(t_newmethod)midirealtimein_new, (t_method)midirealtimein_free,
sizeof(t_midirealtimein), CLASS_NOINLET, A_DEFFLOAT, 0);
class_addlist(midirealtimein_class, midirealtimein_list);
class_sethelpsymbol(midirealtimein_class, gensym("midi"));
midirealtimein_sym = gensym("#midirealtimein");
}
|