aboutsummaryrefslogtreecommitdiff
path: root/control/rtout.c
blob: 95df28c63236e34ba747df52f1caeb83840d29d2 (plain)
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
/* (C) Guenter Geiger <geiger@epy.co.at> */


#include <m_pd.h>

/* -------------------------- rtout -------------------------- */

void sys_putmidimess(int portno, int a, int b, int c);

static t_class *rtout_class;



typedef struct _rtout
{
    t_object x_obj;
    t_float x_rt;
    t_float x_channel;
} t_rtout;

static void *rtout_new(t_floatarg channel)
{
    t_rtout *x = (t_rtout *)pd_new(rtout_class);
    if (channel <= 0) channel = 1;
    x->x_channel = channel;
    return (x);
}

static void rtout_float(t_rtout *x, t_float f)
{
    int binchan = (int) x->x_channel - 1;
    sys_putmidimess((binchan>>4),(int) f,0,0);
}

void rtout_setup(void)
{
    rtout_class = class_new(gensym("rtout"), (t_newmethod)rtout_new, 0,
    	sizeof(t_rtout), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
    class_addfloat(rtout_class, rtout_float);
}