aboutsummaryrefslogtreecommitdiff
path: root/rhythms_memory.c
diff options
context:
space:
mode:
authorDavide Morelli <morellid@users.sourceforge.net>2005-12-22 00:58:39 +0000
committerDavide Morelli <morellid@users.sourceforge.net>2005-12-22 00:58:39 +0000
commit6b999630484e02b53c0bc71d0bcc5da1919728c8 (patch)
tree963d61baff9baa8a56d59b578f85b67f8aec16d3 /rhythms_memory.c
parent975f9ac06a04a0b1528f1fbf9ac7482febc957c2 (diff)
dummy rhythms_memory working, still buggy
svn path=/trunk/externals/frankenstein/; revision=4279
Diffstat (limited to 'rhythms_memory.c')
-rwxr-xr-xrhythms_memory.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/rhythms_memory.c b/rhythms_memory.c
index 12d9c5c..b885a05 100755
--- a/rhythms_memory.c
+++ b/rhythms_memory.c
@@ -120,26 +120,28 @@ void end_measure(t_rhythms_memory *x)
}
x->events = 0;
- // now I evaluate this rhythm with the memory
- rhythm_memory_evaluate(x->rhythms_memory, x->curr_seq, &is_it_a_new_rhythm,
- &id, &subid, &root_closeness, &sub_closeness);
- // tell out the answer
- // allocate space for the list
- lista = (t_atom *) malloc(sizeof(t_atom) * 5);
- SETFLOAT(lista, (float) is_it_a_new_rhythm);
- SETFLOAT(lista+1, (float) id);
- SETFLOAT(lista+2, (float) subid);
- SETFLOAT(lista+3, (float) root_closeness);
- SETFLOAT(lista+4, (float) sub_closeness);
- outlet_anything(x->l_out,
- gensym("list") ,
- 5,
- lista);
- free(lista);
- freeBeats(x->curr_seq);
- x->seq_initialized = 0;
- x->curr_seq = 0;
-
+ if (x->curr_seq)
+ {
+ // now I evaluate this rhythm with the memory
+ rhythm_memory_evaluate(x->rhythms_memory, x->curr_seq, &is_it_a_new_rhythm,
+ &id, &subid, &root_closeness, &sub_closeness);
+ // tell out the answer
+ // allocate space for the list
+ lista = (t_atom *) malloc(sizeof(t_atom) * 5);
+ SETFLOAT(lista, (float) is_it_a_new_rhythm);
+ SETFLOAT(lista+1, (float) id);
+ SETFLOAT(lista+2, (float) subid);
+ SETFLOAT(lista+3, (float) root_closeness);
+ SETFLOAT(lista+4, (float) sub_closeness);
+ outlet_anything(x->l_out,
+ gensym("list") ,
+ 5,
+ lista);
+ free(lista);
+ // rhythm_memory_evaluate freed the memory for the rhythm if needed
+ x->seq_initialized = 0;
+ x->curr_seq = 0;
+ }
// also start the new measure!
start_measure(x);
@@ -182,7 +184,8 @@ void *rhythms_memory_new(t_symbol *s, int argc, t_atom *argv)
int i;
time_t a;
t_rhythms_memory *x = (t_rhythms_memory *)pd_new(rhythms_memory_class);
- x->l_out = outlet_new(&x->x_obj, &s_list);
+ //x->l_out = outlet_new(&x->x_obj, &s_list);
+ x->l_out = outlet_new(&x->x_obj, "symbol");
x->seq_initialized = 0;