aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommon.c27
-rwxr-xr-xrhythms_memory.c1
-rwxr-xr-xrhythms_memory.vcproj4
3 files changed, 19 insertions, 13 deletions
diff --git a/common.c b/common.c
index f48a370..6656615 100755
--- a/common.c
+++ b/common.c
@@ -53,7 +53,7 @@ unsigned short int duration2int(t_duration dur)
curr++;
}
}
- return curr+1;
+ return curr;
}
int possible_durations()
@@ -148,18 +148,21 @@ void freeBeats(t_rhythm_event *currentEvent)
t_rhythm_event *prev;
t_rhythm_event *next;
+ if (currentEvent==0)
+ return;
+
// go to the first element of the list
while(currentEvent->previous)
currentEvent = currentEvent->previous;
// now free each element
next=currentEvent->next;
- do
+ while(currentEvent)
{
prev = currentEvent;
- next = currentEvent->next;
- free(currentEvent);
- } while(next);
+ currentEvent = currentEvent->next;
+ free(prev);
+ }
}
@@ -219,6 +222,8 @@ unsigned short int add_t_rhythm_memory_element(t_rhythm_memory_representation *t
t_rhythm_memory_arc *currArc, *newArc, *prevArc;
unsigned short int last, sub_id;
int i, arcFound;
+ if (new_rhythm==0)
+ return INVALID_RHYTHM;
// creates a new element of the list of similar rhythms
newElement = (t_rhythm_memory_element *) malloc(sizeof(t_rhythm_memory_element));
newElement->rhythm = new_rhythm;
@@ -341,7 +346,7 @@ void free_memory_representations(t_rhythm_memory_representation *this_rep)
void create_array_beats(unsigned short int **this_array, t_rhythm_event *currentEvent)
{
unsigned short int *new_array;
- t_rhythm_event *curr_event;
+ //t_rhythm_event *curr_event;
int i, maxi, startint;
maxi = possible_durations();
// allocate space for the nodes
@@ -352,12 +357,12 @@ void create_array_beats(unsigned short int **this_array, t_rhythm_event *current
new_array[i] = 0;
}
// set the actual data
- curr_event = currentEvent;
- while(curr_event)
+ //curr_event = currentEvent;
+ while(currentEvent)
{
- startint = duration2int(curr_event->start);
+ startint = duration2int(currentEvent->start);
new_array[startint]=1;
- curr_event = curr_event->next;
+ currentEvent = currentEvent->next;
}
*this_array = new_array;
@@ -635,6 +640,7 @@ void rhythm_memory_evaluate(t_rhythm_memory_representation *rep_list, // the mem
*sub_id = sub_id_found;
*sub_closeness = sub_closeness_found;
*new_rhythm = 2;
+ post("DEBUG: new subrhythm");
}
} else
{
@@ -662,6 +668,7 @@ void rhythm_memory_evaluate(t_rhythm_memory_representation *rep_list, // the mem
*id = new_id;
*root_closeness = 1;
*new_rhythm = 1;
+ post("DEBUG: new rhythm");
}
}
diff --git a/rhythms_memory.c b/rhythms_memory.c
index 48377ca..ff69082 100755
--- a/rhythms_memory.c
+++ b/rhythms_memory.c
@@ -119,7 +119,6 @@ void end_measure(t_rhythms_memory *x)
free(lastEvent);
}
x->events = 0;
- x->seq_initialized = 0;
// now I evaluate this rhythm with the memory
rhythm_memory_evaluate(x->rhythms_memory, x->curr_seq, &is_it_a_new_rhythm,
diff --git a/rhythms_memory.vcproj b/rhythms_memory.vcproj
index a912a72..65fbf52 100755
--- a/rhythms_memory.vcproj
+++ b/rhythms_memory.vcproj
@@ -19,7 +19,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="&quot;H:\PureData\pd-0.38-3.msw\pd\src&quot;"
+ AdditionalIncludeDirectories="../"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@@ -36,7 +36,7 @@
AdditionalDependencies="pd.lib"
OutputFile="$(OutDir)/rhythms_memory.dll"
LinkIncremental="2"
- AdditionalLibraryDirectories="&quot;H:\PureData\pd-0.38-3.msw\pd\bin&quot;"
+ AdditionalLibraryDirectories="../"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/frankenstein.pdb"
SubSystem="0"