aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jack_transport/jack_transport.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/jack_transport/jack_transport.c b/jack_transport/jack_transport.c
index e9efd11..f781346 100644
--- a/jack_transport/jack_transport.c
+++ b/jack_transport/jack_transport.c
@@ -25,20 +25,11 @@
static t_class *jack_transport_class;
-float time_beats_per_bar = 4.0;
-float time_beat_type = 1.0 / 4.0;
-double time_ticks_per_beat = 1920.0;
-double time_beats_per_minute = 120.0;
-
typedef struct _jack_transport
{
t_object x_obj;
t_outlet * x_outlet;
- t_outlet * x_outlet_bar;
- t_outlet * x_outlet_beat;
- t_outlet * x_outlet_beat_type;
- t_outlet * x_outlet_beats_per_bar;
- t_outlet * x_outlet_beats_per_minute;
+ t_outlet * x_outlet_info;
jack_client_t* x_jack_client;
jack_position_t* x_pos;
} jack_transport_t;
@@ -78,11 +69,7 @@ static jack_transport_t * jack_transport_new(void)
x->x_outlet = outlet_new(&x->x_obj, NULL);
- x->x_outlet_bar = outlet_new(&x->x_obj, NULL);
- x->x_outlet_beat = outlet_new(&x->x_obj, NULL);
- x->x_outlet_beat_type = outlet_new(&x->x_obj, NULL);
- x->x_outlet_beats_per_bar = outlet_new(&x->x_obj, NULL);
- x->x_outlet_beats_per_minute = outlet_new(&x->x_obj, NULL);
+ x->x_outlet_info = outlet_new(&x->x_obj, NULL);
x->x_pos = (jack_position_t*) getbytes(sizeof(jack_position_t));
status = jack_transport_connect(x);
@@ -105,12 +92,22 @@ static void jack_transport_stoper(jack_transport_t * x)
static void jack_transport_timebase(jack_transport_t * x)
{
jack_position_t pos;
+ t_atom ap[8];
const int rolling = (jack_transport_query(x->x_jack_client, &pos) == JackTransportRolling);
- outlet_float(x->x_outlet_bar, pos.bar);
- outlet_float(x->x_outlet_beat, pos.beat);
- outlet_float(x->x_outlet_beat_type, pos.beat_type);
- outlet_float(x->x_outlet_beats_per_bar, pos.beats_per_bar);
- outlet_float(x->x_outlet_beats_per_minute, pos.beats_per_minute);
+ SETFLOAT(ap+0, pos.bar);
+ SETFLOAT(ap+1, pos.beat);
+ SETSYMBOL(ap+2, gensym("type"));
+ SETFLOAT(ap+3, pos.beat_type);
+ SETSYMBOL(ap+4, gensym("beats/bar"));
+ SETFLOAT(ap+5, pos.beats_per_bar);
+ SETSYMBOL(ap+6, gensym("bpm"));
+ SETFLOAT(ap+7, pos.beats_per_minute);
+
+ outlet_anything(x->x_outlet_info, gensym("beat"), 2, ap+2);
+ outlet_anything(x->x_outlet_info, gensym("beat"), 2, ap+4);
+ outlet_anything(x->x_outlet_info, gensym("beat"), 2, ap+6);
+ outlet_anything(x->x_outlet_info, gensym("beat"), 1, ap+1);
+ outlet_anything(x->x_outlet_info, gensym("bar"), 1, ap+0);
}
static void jack_transport_bang(jack_transport_t * x)
@@ -139,7 +136,7 @@ void jack_transport_setup(void)
(t_newmethod)jack_transport_new,
NULL, sizeof(jack_transport_t),
CLASS_DEFAULT, 0);
- class_addmethod(jack_transport_class, (t_method)jack_transport_starter,
+ class_addmethod(jack_transport_class, (t_method)jack_transport_starter,
gensym("start"),0,0);
class_addmethod(jack_transport_class, (t_method)jack_transport_stoper,
gensym("stop"),0,0);