[PD-cvs] externals/frankenstein common.c,1.8,1.9 common.h,1.8,1.9
dmorelli
morellid at users.sourceforge.net
Mon Dec 5 19:08:55 CET 2005
Update of /cvsroot/pure-data/externals/frankenstein
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5705
Modified Files:
common.c common.h
Log Message:
workig on rhythm finding
Index: common.h
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** common.h 5 Dec 2005 12:57:39 -0000 1.8
--- common.h 5 Dec 2005 18:08:53 -0000 1.9
***************
*** 162,166 ****
// I return values using pointers
// the unsigned short and the 2 floats should be already allocated
! void find_similar_rhythm_in_memory(t_rhythm_memory_representation *this_rep,
t_rhythm_event *src_rhythm, // the src rhythm
unsigned short int *sub_id, // the sub-id of the closest sub-rhythm
--- 162,166 ----
// I return values using pointers
// the unsigned short and the 2 floats should be already allocated
! void compare_rhythm_vs_representation(t_rhythm_memory_representation *this_rep,
t_rhythm_event *src_rhythm, // the src rhythm
unsigned short int *sub_id, // the sub-id of the closest sub-rhythm
Index: common.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** common.c 5 Dec 2005 12:57:38 -0000 1.8
--- common.c 5 Dec 2005 18:08:53 -0000 1.9
***************
*** 338,342 ****
// compares this rhythm to this representation
// and tells you how close it is to it
! void find_similar_rhythm_in_memory(t_rhythm_memory_representation *this_rep,
t_rhythm_event *src_rhythm, // the src rhythm
unsigned short int *sub_id, // the sub-id of the closest sub-rhythm
--- 338,342 ----
// compares this rhythm to this representation
// and tells you how close it is to it
! void compare_rhythm_vs_representation(t_rhythm_memory_representation *this_rep,
t_rhythm_event *src_rhythm, // the src rhythm
unsigned short int *sub_id, // the sub-id of the closest sub-rhythm
***************
*** 345,348 ****
--- 345,353 ----
)
{
+ t_duration tmp_dur, this_dur;
+ t_rhythm_event *curr_event;
+ float this_weight_float;
+ int i, max_i, int_from_dur, this_weight_int;
+
// check that the return values have been allocated
if ((sub_id==0)||(root_closeness==0)||(sub_closeness==0))
***************
*** 353,358 ****
// look the main table for closeness to the main rhythm
! // TODO
// for each rhythm in the list
--- 358,373 ----
// look the main table for closeness to the main rhythm
+ curr_event = src_rhythm;
+ while(curr_event)
+ {
+ int_from_dur = duration2int(curr_event->start);
+ // get the weight of this beat
+ this_weight_int = this_rep->transitions[int_from_dur].weight;
+ this_weight_float = (float) (((float) this_weight_int)/((float) this_rep->max_weight);
+ // TODO
! curr_event = curr_event->next;
! }
!
// for each rhythm in the list
More information about the Pd-cvs
mailing list