Commit 31d93ce8 authored by Jonathan Wilkes's avatar Jonathan Wilkes

Merge branch 'remove-midiclkin'

parents 7a5b5ed3 70e06efd
#N struct ;
#N canvas 355 65 579 812 12;
#N canvas 394 53 579 639 12;
#X declare;
#X obj 24 150 bang;
#X text 124 150 - output a bang message;
......@@ -398,7 +398,6 @@ its "help window".;
#X text 118 3676 - make copies of a subpatch;
#X obj 26 3676 clone;
#X obj 157 1167 midirealtimein;
#X obj 301 1169 midiclkin;
#X text 124 3530 - read with a time-varying delay time;
#X obj 97 3532 vd~;
#X obj 26 2081 rsqrt~;
......
......@@ -74,7 +74,6 @@ struct _pdinstance
t_symbol *pd_bendin_sym;
t_symbol *pd_touchin_sym;
t_symbol *pd_polytouchin_sym;
t_symbol *pd_midiclkin_sym;
t_symbol *pd_midirealtimein_sym;
};
......
......@@ -478,7 +478,6 @@ static t_pdinstance *pdinstance_donew(int useprefix)
x->pd_bendin_sym = midi_gensym(midiprefix, "#bendin");
x->pd_touchin_sym = midi_gensym(midiprefix, "#touchin");
x->pd_polytouchin_sym = midi_gensym(midiprefix, "#polytouchin");
x->pd_midiclkin_sym = midi_gensym(midiprefix, "#midiclkin");
x->pd_midirealtimein_sym = midi_gensym(midiprefix, "#midirealtimein");
return (x);
}
......
......@@ -239,11 +239,6 @@ void outmidi_polyaftertouch(int portno, int channel, int pitch, int value)
pitch, value);
}
void outmidi_mclk(int portno)
{
sys_queuemidimess(portno, 1, 0xf8, 0,0);
}
void outmidi_byte(int portno, int value)
{
#ifdef USEAPI_ALSA
......@@ -291,7 +286,6 @@ typedef struct midiparser
/* functions in x_midi.c */
void inmidi_realtimein(int portno, int cmd);
void inmidi_clk(double timing);
void inmidi_byte(int portno, int byte);
void inmidi_sysex(int portno, int byte);
void inmidi_noteon(int portno, int channel, int pitch, int velo);
......@@ -316,14 +310,6 @@ static void sys_dispatchnextmidiin( void)
if (byte >= 0xf8)
{
inmidi_realtimein(portno, byte);
if (byte == 0xf8) {
// AG: Not sure what the timebase for the right outlet is supposed
// to be. I'm using msecs right now, which is in line with the other
// tempo-related objects such as metro. Multiply with .001 to
// get seconds instead.
double timing = clock_gettimesince(sys_midiinittime);
inmidi_clk(timing);
}
}
else
{
......
......@@ -12,7 +12,6 @@ void outmidi_programchange(int portno, int channel, int value);
void outmidi_pitchbend(int portno, int channel, int value);
void outmidi_aftertouch(int portno, int channel, int value);
void outmidi_polyaftertouch(int portno, int channel, int pitch, int value);
void outmidi_mclk(int portno);
void outmidi_byte(int portno, int value);
......@@ -499,74 +498,6 @@ void inmidi_polyaftertouch(int portno, int channel, int pitch, int value)
}
}
/*----------------------- midiclkin--(midi F8 message )---------------------*/
static t_class *midiclkin_class;
typedef struct _midiclkin
{
t_object x_obj;
t_outlet *x_outlet1;
t_outlet *x_outlet2;
} t_midiclkin;
static void *midiclkin_new(t_floatarg f)
{
t_midiclkin *x = (t_midiclkin *)pd_new(midiclkin_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, pd_this->pd_midiclkin_sym);
return (x);
}
static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv)
{
t_float value = atom_getfloatarg(0, argc, argv);
t_float count = atom_getfloatarg(1, argc, argv);
outlet_float(x->x_outlet2, count);
outlet_float(x->x_outlet1, value);
}
static void midiclkin_free(t_midiclkin *x)
{
pd_unbind(&x->x_obj.ob_pd, pd_this->pd_midiclkin_sym);
}
static void midiclkin_setup(void)
{
midiclkin_class = class_new(gensym("midiclkin"),
(t_newmethod)midiclkin_new, (t_method)midiclkin_free,
sizeof(t_midiclkin), CLASS_NOINLET, A_DEFFLOAT, 0);
class_addlist(midiclkin_class, midiclkin_list);
class_sethelpsymbol(midiclkin_class, gensym("midi"));
}
void inmidi_clk(double timing)
{
static t_float prev = 0;
static t_float count = 0;
t_float cur,diff;
if (pd_this->pd_midiclkin_sym->s_thing)
{
t_atom at[2];
diff =timing - prev;
count++;
if (count == 3)
{ /* 24 count per quoter note */
SETFLOAT(at, 1 );
count = 0;
}
else SETFLOAT(at, 0);
SETFLOAT(at+1, diff);
pd_list(pd_this->pd_midiclkin_sym->s_thing, &s_list, 2, at);
prev = timing;
}
}
/*----------midirealtimein (midi FA,FB,FC,FF message )-----------------*/
static t_class *midirealtimein_class;
......@@ -1269,7 +1200,6 @@ void x_midi_setup(void)
bendin_setup();
touchin_setup();
polytouchin_setup();
midiclkin_setup();
midiout_setup();
noteout_setup();
ctlout_setup();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment