Update of /cvsroot/pure-data/externals/frankenstein In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418
Modified Files: Makefile common.c common.h Log Message: again some more common functions
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 30 Nov 2005 17:31:33 -0000 1.2 --- Makefile 3 Dec 2005 01:49:01 -0000 1.3 *************** *** 2,7 **** #VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7" VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7" ! #PDPATH="H:\PureData\pd-0.38-3.msw\pd" ! PDPATH="C:\Documents and Settings\Davide\Documenti\personali\pd-0.38-3.msw\pd"
--- 2,7 ---- #VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7" VC="C:\Programmi\Microsoft Visual Studio .NET\Vc7" ! PDPATH="H:\PureData\pd-0.38-3.msw\pd" ! #PDPATH="C:\Documents and Settings\Davide\Documenti\personali\pd-0.38-3.msw\pd"
Index: common.h =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** common.h 2 Dec 2005 18:56:07 -0000 1.5 --- common.h 3 Dec 2005 01:49:01 -0000 1.6 *************** *** 151,154 **** --- 151,157 ---- void add_similar_rhythm(t_rhythm_memory_representation *this_rep, t_rhythm_event *new_rhythm);
+ // free the array with pointers and lists + void free_memory_representation(t_rhythm_memory_representation *this_rep); + // functions needed to fill and use the memory table
Index: common.c =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/common.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** common.c 2 Dec 2005 18:56:07 -0000 1.5 --- common.c 3 Dec 2005 01:49:01 -0000 1.6 *************** *** 215,220 **** this_rep->similar_rhythms = newElement; } ! ! }
--- 215,219 ---- this_rep->similar_rhythms = newElement; } ! // now update the transition table.. }
*************** *** 222,226 **** void swap_rhythm_to_start(t_rhythm_event *oldStyle, t_rhythm_event **newStyle) { ! t_rhythm_event *oldCurr, *newElement, *oldPrev; float diff, currMoment; t_duration dur_tmp; --- 221,225 ---- void swap_rhythm_to_start(t_rhythm_event *oldStyle, t_rhythm_event **newStyle) { ! t_rhythm_event *oldCurr, *newElement, *oldPrev, *newPrev; float diff, currMoment; t_duration dur_tmp; *************** *** 230,233 **** --- 229,233 ---- oldPrev = 0; currMoment = 0; + newPrev = 0; // look for the first beat played in old rhythm *************** *** 252,258 **** newElement->duration.numerator = dur_tmp.numerator; newElement->duration.denominator = dur_tmp.denominator; ! newElement->previous = oldPrev; ! if (oldPrev) ! oldPrev->next = newElement;
while (oldCurr) --- 252,257 ---- newElement->duration.numerator = dur_tmp.numerator; newElement->duration.denominator = dur_tmp.denominator; ! newElement->previous = newPrev; ! newPrev = newElement;
while (oldCurr) *************** *** 266,272 **** newElement->duration.numerator = dur_tmp.numerator; newElement->duration.denominator = dur_tmp.denominator; ! newElement->previous = oldPrev; ! if (oldPrev) ! oldPrev->next = newElement; } // prepare for the next event --- 265,272 ---- newElement->duration.numerator = dur_tmp.numerator; newElement->duration.denominator = dur_tmp.denominator; ! newElement->previous = newPrev; ! if (newPrev) ! newPrev->next = newElement; ! newPrev = newElement; } // prepare for the next event *************** *** 277,282 **** oldCurr = oldCurr->next; } - - }
--- 277,280 ---- *************** *** 287,290 **** --- 285,326 ---- }
+ void free_memory_representation(t_rhythm_memory_representation *this_rep) + { + int i, maxi; + t_rhythm_memory_element *currElement, *tmpElement; + t_rhythm_memory_arc *currArc, *tmpArc; + // free the main rhythm + if (this_rep->main_rhythm) + { + freeBeats(this_rep->main_rhythm->rhythm); + free(this_rep->main_rhythm); + } + + // free the table + maxi = possible_durations(); + for (i=0; i<maxi; i++) + { + currArc = this_rep->transitions[i].arcs; + while (currArc) + { + tmpArc = currArc; + currArc = currArc->next_arc; + free(tmpArc); + } + } + free(this_rep->transitions); + + // free the list of similar rhythms + currElement = this_rep->similar_rhythms; + while (currElement) + { + freeBeats(currElement->rhythm); + tmpElement = currElement; + currElement = currElement->next; + free(tmpElement); + } + + + }
// ------------------- themes manipulation functions