Skip to content

Instantly share code, notes, and snippets.

@bitpit

bitpit/cmidi.c Secret

Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitpit/847f691f79ad17851b41 to your computer and use it in GitHub Desktop.
Save bitpit/847f691f79ad17851b41 to your computer and use it in GitHub Desktop.
#include "m_pd.h"
static t_class *cmidi_class;
typedef struct _cmidi {//Class variables
t_object x_obj;
t_float f;
} t_cmidi;
void *cmidi_new(t_floatarg f){//Instantiator
t_cmidi *x = (t_cmidi *)pd_new(cmidi_class);
x->f = f;
return (void *)x;
}
void out_bang(t_cmidi *x, t_floatarg f){
x->f = f;
post("cmidi bang!");
}
void cmidi_setup(void){
cmidi_class = class_new(gensym("cmidi"),
(t_newmethod)cmidi_new,
0, sizeof(t_cmidi),
CLASS_DEFAULT,
A_DEFFLOAT,0);
class_addfloat(cmidi_class, out_bang);
}
#include "m_pd.h"
static t_class *elswating_class;
typedef struct _elswating {//Class variables
t_object x_obj;
t_float floaty;
} t_elswating;
void *elswating_new(void){//Instantiator
t_elswating *x = (t_elswating *)pd_new(elswating_class);
x->floaty = 2;
return (void *)x;
}
void out_bang(t_elswating *x, t_floatarg f){
x->floaty = f;
post("elswating bang!");
}
void elswating_setup(void){
elswating_class = class_new(gensym("elswating"),
(t_newmethod)elswating_new,
0, sizeof(t_elswating),
CLASS_DEFAULT,0);
class_addfloat(elswating_class, out_bang);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment