[PD-cvs] externals/frankenstein common.c,1.3,1.4 common.h,1.3,1.4
dmorelli
morellid at users.sourceforge.net
Fri Dec 2 13:18:14 CET 2005
Update of /cvsroot/pure-data/externals/frankenstein
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1176
Modified Files:
common.c common.h
Log Message:
adding rhythms memory graph
Index: common.h
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** common.h 1 Dec 2005 12:09:05 -0000 1.3
--- common.h 2 Dec 2005 12:18:12 -0000 1.4
***************
*** 44,66 ****
// rhythms memory graph
! /*
// list implementation
// this implements a graph that stores the memory of the current rhythm sub-elements
// list of links
! typedef struct _rhythm_memory_arc
! {
! float weight;
! struct t_rhythm_memory_node *to_node; // the target of this link (arc)
! struct t_rhythm_memory_arc *next_arc; // next link in the list
! } t_rhythm_memory_arc;
// graph node
! typedef struct _rhythm_memory_node
{
t_duration duration;
! struct t_rhythm_memory_arc *arcs; // the list of arcs to other nodes
! } t_rhythm_memory_node;
! */
! // with a table
! // simpler and most of all non recursive when searching nodes!
#define num_possible_denominators 11
static unsigned short int possible_denominators[] = {1,2,3,4,6,8,12,16,18,24,32};
--- 44,72 ----
// rhythms memory graph
!
// list implementation
// this implements a graph that stores the memory of the current rhythm sub-elements
// list of links
! // the actual implementation will be an array of nodes, each node
! typedef struct t_rhythm_memory_arc t_rhythm_memory_arc;
! typedef struct t_rhythm_memory_node t_rhythm_memory_node;
// graph node
! typedef struct t_rhythm_memory_node
{
t_duration duration;
! t_rhythm_memory_arc *arcs; // the list of arcs to other nodes
! } ;
! // graph arc
! struct t_rhythm_memory_arc
! {
! unsigned short int weight;
! t_rhythm_memory_node *to_node; // the target of this link (arc)
! t_rhythm_memory_arc *next_arc; // next link in the list
! } ;
! // it will be arranged in a heap list?
!
! // add an arc to this node
! void add_t_rhythm_memory_arc(t_rhythm_memory_node *srcNode, t_rhythm_memory_node *dstNode);
!
#define num_possible_denominators 11
static unsigned short int possible_denominators[] = {1,2,3,4,6,8,12,16,18,24,32};
Index: common.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** common.c 1 Dec 2005 12:09:05 -0000 1.3
--- common.c 2 Dec 2005 12:18:12 -0000 1.4
***************
*** 159,162 ****
--- 159,188 ----
}
+ 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
More information about the Pd-cvs
mailing list