/[paths]/src/graph.h
ViewVC logotype

Contents of /src/graph.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (show annotations)
Fri Aug 31 03:14:09 2012 UTC (8 years, 1 month ago) by ben
File MIME type: text/plain
File size: 1444 byte(s)
make chromatic distance model displayable
1 #ifndef GRAPH_H
2 #define GRAPH_H
3 struct event {
4 unsigned char pitch; /* midi note number */
5 int duration; /* microsecond */
6 unsigned short int bend; /* pitchbend value */
7 unsigned char velocity;
8 unsigned char volume;
9 unsigned int ref; /* crawler ref count */
10 };
11
12 struct node;
13
14 struct edge {
15 struct node *to;
16 struct node *from;
17 int distance;
18
19 void* egg; /* pointer to graphical representation */
20 };
21
22 struct node {
23 struct event event;
24 int wheight;
25 struct edge *neighbours;
26 int count;
27
28 void* egg; /* pointer to graphical representation */
29 };
30
31 struct graph {
32 struct node* nodes;
33 struct edge* edges;
34 int count; /* node count */
35 int lcount; /* link count */
36
37 void* egg; /* pointer to graphical representation */
38 };
39
40 typedef int (*distance_fun) (struct node* a, struct node* b);
41
42 int distance_randomize(struct node* a, struct node* b);
43 int distance_chromatic(struct node* a, struct node* b);
44 int distance_diatonic(struct node* a, struct node* b);
45
46 void node_destroy(struct node* n);
47
48 void node_radomize(struct node* n);
49
50 int node_is_linked(struct node* a, struct node* b);
51
52 int node_link(struct node* a, struct node* b, distance_fun fun);
53
54 int node_unlink(struct node* a, struct node* b);
55
56 /* n: node number */
57 struct graph* graph_new(int n);
58
59 /* l: edge number */
60 int graph_randomize1(struct graph*, int l);
61
62 /* l: min edges per node */
63 int graph_randomize2(struct graph*, int l);
64
65 void graph_destroy(struct graph* g);
66
67 #endif

  ViewVC Help
Powered by ViewVC 1.1.26