aboutsummaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorDavide Morelli <morellid@users.sourceforge.net>2005-12-02 12:18:12 +0000
committerDavide Morelli <morellid@users.sourceforge.net>2005-12-02 12:18:12 +0000
commitf491b6c244c1ffc5c51eaa94e9f85e35fbdea19b (patch)
tree88d1ab13a6d5bae1766a555241b5a894b92e2f3f /common.c
parentae67336fe2a0184a69662b29607ce48fd01cf52e (diff)
adding rhythms memory graph
svn path=/trunk/externals/frankenstein/; revision=4113
Diffstat (limited to 'common.c')
-rwxr-xr-xcommon.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/common.c b/common.c
index fb5d3fb..4d554ff 100755
--- a/common.c
+++ b/common.c
@@ -158,6 +158,32 @@ void freeBeats(t_rhythm_event *currentEvent)
}
+void add_t_rhythm_memory_arc(t_rhythm_memory_node *srcNode, t_rhythm_memory_node *dstNode)
+{
+ t_rhythm_memory_arc *newArc;
+ t_rhythm_memory_arc *lastArc;
+
+ // create a new arc
+ newArc = (t_rhythm_memory_arc *) malloc(sizeof(t_rhythm_memory_arc));
+ newArc->to_note = dstNode;
+ newArc->weight = 1;
+ // go to the last arc in the list
+ // and add this arc as the last
+ lastArc = srcNode->arcs;
+ if (lastArc)
+ {
+ // this is not the first arc
+ while(lastArc->next_arc)
+ lastArc = lastArc->next_arc;
+ lastArc->next_arc = newArc;
+ } else
+ {
+ // this is the first arc
+ srcNode->arcs = newArc;
+ }
+}
+
+// ------------------- themes manipulation functions
// set the first note of a sequence
void setFirstNote(t_note_event **firstEvent, unsigned short int voice, float fduration, t_note note)