Update of /cvsroot/pure-data/externals/frankenstein In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2921
Modified Files: common.c common.h rhythms_memory.c Log Message: dummy rhythms_memory working, still buggy
Index: rhythms_memory.c =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/rhythms_memory.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rhythms_memory.c 8 Dec 2005 16:31:10 -0000 1.4 --- rhythms_memory.c 22 Dec 2005 00:58:39 -0000 1.5 *************** *** 121,144 **** 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; ! // also start the new measure! start_measure(x); --- 121,146 ---- x->events = 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); *************** *** 183,187 **** 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->seq_initialized = 0; --- 185,190 ---- 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, "symbol"); x->seq_initialized = 0;
Index: common.h =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** common.h 6 Dec 2005 18:09:59 -0000 1.12 --- common.h 22 Dec 2005 00:58:39 -0000 1.13 *************** *** 20,25 **** typedef struct t_duration { ! int numerator; // like in music notation: in a 1/4 note the numerator is 1 ! int denominator; // like in music notation: in a 1/4 note the denominator is 4 }; struct t_note_event --- 20,25 ---- typedef struct t_duration { ! unsigned short int numerator; // like in music notation: in a 1/4 note the numerator is 1 ! unsigned short int denominator; // like in music notation: in a 1/4 note the denominator is 4 }; struct t_note_event
Index: common.c =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/common.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** common.c 8 Dec 2005 01:29:55 -0000 1.14 --- common.c 22 Dec 2005 00:58:38 -0000 1.15 *************** *** 119,123 **** newElement->start.denominator = res.denominator; *firstEvent = newElement; ! post("DEBUG setFirstBeat: %i %i", res.numerator, res.denominator); }
--- 119,123 ---- newElement->start.denominator = res.denominator; *firstEvent = newElement; ! //post("DEBUG setFirstBeat: %i %i", res.numerator, res.denominator); }
*************** *** 143,147 **** newElement->start.numerator = res.numerator; newElement->start.denominator = res.denominator; ! post("DEBUG concatenateBeat: %i %i", res.numerator, res.denominator); }
--- 143,147 ---- newElement->start.numerator = res.numerator; newElement->start.denominator = res.denominator; ! //post("DEBUG concatenateBeat: %i %i", res.numerator, res.denominator); }
*************** *** 166,169 **** --- 166,170 ---- free(prev); } + currentEvent = 0;
} *************** *** 298,302 **** // a new champion! this_rep->max_weight = this_rep->transitions[i].weight; ! post("DEBUG: max_weight=%i", this_rep->max_weight); } last = i; --- 299,303 ---- // a new champion! this_rep->max_weight = this_rep->transitions[i].weight; ! //post("DEBUG: max_weight=%i", this_rep->max_weight); } last = i; *************** *** 427,431 **** this_weight_int = this_rep->transitions[i].weight; this_weight_float = (float) (((float) this_weight_int) / ((float) this_rep->max_weight)); ! post("DEBUG: transition %i this_weight_int=%i max_weight=%i this_weight_float=%f", i, this_weight_int, this_rep->max_weight, this_weight_float); if (this_weight_float > min_to_be_main_rhythm_beat) { --- 428,432 ---- this_weight_int = this_rep->transitions[i].weight; this_weight_float = (float) (((float) this_weight_int) / ((float) this_rep->max_weight)); ! //post("DEBUG: transition %i this_weight_int=%i max_weight=%i this_weight_float=%f", i, this_weight_int, this_rep->max_weight, this_weight_float); if (this_weight_float > min_to_be_main_rhythm_beat) { *************** *** 435,444 **** // both playing strong_ok++; ! post("DEBUG: beat %i, both playing", i); } else { // strong beat miss strong_no++; ! post("DEBUG: beat %i, src not playing", i); } count_strong++; --- 436,445 ---- // both playing strong_ok++; ! //post("DEBUG: beat %i, both playing", i); } else { // strong beat miss strong_no++; ! //post("DEBUG: beat %i, src not playing", i); } count_strong++; *************** *** 464,468 **** strong_ratio = (float) ( ( ((float) strong_ok) / ((float)count_strong) ) - ( ((float) strong_no) / ((float)count_strong) )) ; ! post("DEBUG: strong_ratio=%f", strong_ratio); } // for each rhythm in the list --- 465,469 ---- strong_ratio = (float) ( ( ((float) strong_ok) / ((float)count_strong) ) - ( ((float) strong_no) / ((float)count_strong) )) ; ! //post("DEBUG: strong_ratio=%f", strong_ratio); } // for each rhythm in the list *************** *** 625,628 **** --- 626,631 ---- *sub_id = sub_id_found; *sub_closeness = sub_closeness_found; + //only in this case free the memory allocated for the rhythm + freeBeats(src_rhythm); } else { *************** *** 647,651 **** *sub_closeness = sub_closeness_found; *new_rhythm = 2; ! post("DEBUG: new subrhythm"); } } else --- 650,654 ---- *sub_closeness = sub_closeness_found; *new_rhythm = 2; ! //post("DEBUG: new subrhythm"); } } else *************** *** 675,679 **** *root_closeness = 1; *new_rhythm = 1; ! post("DEBUG: new rhythm"); }
--- 678,682 ---- *root_closeness = 1; *new_rhythm = 1; ! //post("DEBUG: new rhythm"); }