annotate src/rovascope/actuatorbin.c @ 1048:a42f95563c98 trunk

[svn] Added cdaudio-ng
author zither
date Mon, 21 May 2007 15:28:07 -0700
parents 37a183b4ce60
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
1 #include "paranormal.h"
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
2 #include "actuators.h"
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
3
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
4 struct pn_actuator *
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
5 rovascope_get_random_colourmap(void)
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
6 {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
7 struct pn_actuator *out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
8
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
9 srand(time(NULL));
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
10
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
11 out = create_actuator("cmap_bwgradient");
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
12 out->options[2].val.cval.r = 255 - rand() % 255;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
13 out->options[2].val.cval.g = 255 - rand() % 255;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
14 out->options[2].val.cval.b = 255 - rand() % 255;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
15
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
16 return out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
17 }
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
18
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
19 struct pn_actuator *
419
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
20 rovascope_get_random_transform(void)
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
21 {
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
22 struct pn_actuator *out;
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
23 gchar *candidates[] = {
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
24 "d = cos(d) ^ 2;",
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
25 "r = sin(r);",
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
26 "r = sin(r); d = cos(d) ^ 2;",
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
27 };
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
28
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
29 srand(time(NULL));
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
30
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
31 out = create_actuator("xform_movement");
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
32 out->options[0].val.sval =
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
33 g_strdup(candidates[rand() % G_N_ELEMENTS(candidates)]);
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
34
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
35 return out;
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
36 }
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
37
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
38 struct pn_actuator *
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
39 rovascope_get_random_general(void)
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
40 {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
41 struct pn_actuator *out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
42
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
43 gchar *candidates[] = {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
44 "general_fade", "general_blur", "general_mosaic",
419
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
45 "general_flip", "general_fade", "general_fade",
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
46 };
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
47
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
48 out = create_actuator(candidates[rand() % G_N_ELEMENTS(candidates)]);
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
49
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
50 return out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
51 }
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
52
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
53 struct pn_actuator *
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
54 rovascope_get_random_normal_scope(void)
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
55 {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
56 struct pn_actuator *out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
57
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
58 gchar *candidates[] = {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
59 "wave_horizontal", "wave_vertical", "wave_radial",
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
60 };
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
61
410
4333f0bbcc55 [svn] - select waves randomly
nenolod
parents: 409
diff changeset
62 out = create_actuator(candidates[rand() % G_N_ELEMENTS(candidates)]);
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
63
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
64 return out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
65 }
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
66
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
67 struct pn_actuator *
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
68 rovascope_get_random_actuator(void)
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
69 {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
70 struct pn_actuator *out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
71 struct pn_actuator *(*func)();
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
72
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
73 void *candidates[] = {
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
74 rovascope_get_random_colourmap,
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
75 rovascope_get_random_general,
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
76 rovascope_get_random_normal_scope,
419
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
77 rovascope_get_random_transform,
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
78 };
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
79
419
37a183b4ce60 [svn] - rovascope: more randomization
nenolod
parents: 410
diff changeset
80 func = candidates[rand() % G_N_ELEMENTS(candidates)];
409
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
81 out = func();
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
82
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
83 return out;
2bf7e2965eec [svn] - actuatorbin.c was missing.
nenolod
parents:
diff changeset
84 }