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

Contents of /src/graph.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 63 - (show annotations)
Sun Aug 26 03:23:50 2012 UTC (6 years, 10 months ago) by ben
File MIME type: text/plain
File size: 998 byte(s)
highlight nodes while playing
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; /* collisions */
10 };
11
12 struct node;
13
14 struct edge {
15 struct node *to;
16 int distance;
17 };
18
19 struct node {
20 struct event event;
21 int wheight;
22 struct edge *neighbours;
23 int count;
24 };
25
26 struct graph {
27 struct node* nodes;
28 int count;
29 };
30
31 void node_destroy(struct node* n);
32
33 void node_radomize(struct node* n);
34
35 void edge_randomize(struct edge* e);
36
37 int node_is_linked(struct node* a, struct node* b);
38
39 /* d: distance */
40 int node_link(struct node* a, struct node* b, int d);
41
42 int node_unlink(struct node* a, struct node* b);
43
44 /* n: node number */
45 struct graph* graph_new(int n);
46
47 /* l: edge number */
48 int graph_randomize1(struct graph*, int l);
49
50 /* l: min edges per node */
51 int graph_randomize2(struct graph*, int l);
52
53 void graph_destroy(struct graph* g);
54
55 #endif

  ViewVC Help
Powered by ViewVC 1.1.26