diff options
author | Davide Morelli <morellid@users.sourceforge.net> | 2005-12-05 18:08:53 +0000 |
---|---|---|
committer | Davide Morelli <morellid@users.sourceforge.net> | 2005-12-05 18:08:53 +0000 |
commit | fc71d5f8d34c6d0ea68c4787d17f033899ddc45e (patch) | |
tree | e25fb096468fce29a6faef8bb742cf26f13bc34e | |
parent | 56d3627d3879bc5898ed307237a32c8400095805 (diff) |
workig on rhythm finding
svn path=/trunk/externals/frankenstein/; revision=4143
-rwxr-xr-x | common.c | 19 | ||||
-rwxr-xr-x | common.h | 2 |
2 files changed, 18 insertions, 3 deletions
@@ -337,13 +337,18 @@ void free_memory_representations(t_rhythm_memory_representation *this_rep) // 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,
+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
float *root_closeness, // how much this rhythm is close to the root (1=identical, 0=nothing common)
float *sub_closeness // how much this rhythm is close to the closest sub-rhythm (1=identical, 0=nothing common)
)
{
+ 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))
{
@@ -352,8 +357,18 @@ void find_similar_rhythm_in_memory(t_rhythm_memory_representation *this_rep, }
// 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
- // TODO
+ curr_event = curr_event->next;
+ }
+
// for each rhythm in the list
// count the number of identical nodes
@@ -161,7 +161,7 @@ void free_memory_representations(t_rhythm_memory_representation *this_rep); // and tells you how close it is to it
// 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,
+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
float *root_closeness, // how much this rhythm is close to the root (1=identical, 0=nothing common)
|