annotate src/paranormal/actuators.h @ 3171:cb93b500a364

alsa-ng: Add more notes on this.
author William Pitcock <nenolod@atheme.org>
date Fri, 15 May 2009 04:20:09 -0500
parents f1b6f1b2cdb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1892
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
1 /*
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
2 * paranormal: iterated pipeline-driven visualization plugin
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
3 * Copyright (c) 2006, 2007 William Pitcock <nenolod@dereferenced.org>
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
4 * Portions copyright (c) 2001 Jamie Gennis <jgennis@mindspring.com>
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
5 *
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
6 * This program is free software; you can redistribute it and/or modify
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
7 * it under the terms of the GNU General Public License as published by
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
8 * the Free Software Foundation; under version 2 of the License.
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
9 *
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
10 * This program is distributed in the hope that it will be useful,
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
13 * GNU General Public License for more details.
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
14 *
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
15 * You should have received a copy of the GNU General Public License
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
16 * along with this program; if not, write to the Free Software
2835
f1b6f1b2cdb3 fixed FSF address
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1892
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1892
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
18 */
3b034150d31e Add GPL2 boilerplate text.
William Pitcock <nenolod@atheme.org>
parents: 155
diff changeset
19
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
20 /* FIXME: rename actuators to pn_actuators */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
21 /* FIXME: add a color type to the OPT_TYPE's */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
22
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
23 #ifndef _ACTUATORS_H
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
24 #define _ACTUATORS_H
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
25
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
26 #include <glib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
27 #include <SDL.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
28
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
29 /* Helper macros for actuator functions */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
30 #define PN_ACTUATOR_INIT_FUNC(f) ((void (*) (gpointer *data))f)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
31 #define PN_ACTUATOR_CLEANUP_FUNC(f) ((void (*) (gpointer data))f)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
32 #define PN_ACTUATOR_EXEC_FUNC(f) \
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
33 ((void (*) (const struct pn_actuator_option *opts, gpointer data))f)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
34
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
35 struct pn_color
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
36 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
37 guchar r, g, b;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
38 guchar spluzz; /* gotta look like an SDL_Color */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
39 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
40
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
41
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
42 union actuator_option_val
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
43 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
44 int ival;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
45 float fval;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
46 const char *sval;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
47 struct pn_color cval;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
48 gboolean bval;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
49 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
50
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
51 /* A actuator's option description */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
52 struct pn_actuator_option_desc
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
53 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
54 const char *name;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
55 const char *doc; /* option documentation */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
56 enum
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
57 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
58 OPT_TYPE_INT = 0,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
59 OPT_TYPE_FLOAT = 1,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
60 OPT_TYPE_STRING = 2,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
61 OPT_TYPE_COLOR = 3,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
62 OPT_TYPE_COLOR_INDEX = 4, /* uses ival */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
63 OPT_TYPE_BOOLEAN = 5
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
64 } type;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
65 union actuator_option_val default_val;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
66 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
67
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
68 /* The actual option instance */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
69 struct pn_actuator_option
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
70 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
71 const struct pn_actuator_option_desc *desc;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
72 union actuator_option_val val;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
73 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
74
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
75 /* An operation's description */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
76 struct pn_actuator_desc
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
77 {
155
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
78 const char *name; /* e.g. "container_simple" */
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
79 const char *dispname; /* e.g. "Simple Container" */
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
80 const char *doc; /* documentation txt */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
81 const enum
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
82 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
83 ACTUATOR_FLAG_CONTAINER = 1<<0
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
84 } flags;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
85
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
86 /* A null terminating (ie a actuator_option_desc == {0,...,0})
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
87 array - OPTIONAL (optional fields can be NULL) */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
88 const struct pn_actuator_option_desc *option_descs;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
89
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
90 /* Init function - data points to the actuator.data - OPTIONAL */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
91 void (*init) (gpointer *data);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
92
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
93 /* Cleanup actuatortion - OPTIONAL */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
94 void (*cleanup) (gpointer data);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
95
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
96 /* Execute actuatortion - REQUIRED (duh!) */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
97 void (*exec) (const struct pn_actuator_option *opts, gpointer data);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
98 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
99
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
100 /* An actual operation instance */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
101 struct pn_actuator
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
102 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
103 const struct pn_actuator_desc *desc;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
104 struct pn_actuator_option *options;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
105 gpointer data;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
106 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
107
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
108 /* The array containing all operations (see builtins.c) */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
109 extern struct pn_actuator_desc *builtin_table[];
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
110
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
111 /* functions for actuators */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
112 struct pn_actuator_desc *get_actuator_desc (const char *name);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
113 struct pn_actuator *copy_actuator (const struct pn_actuator *a);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
114 struct pn_actuator *create_actuator (const char *name);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
115 void destroy_actuator (struct pn_actuator *actuator);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
116 void exec_actuator (struct pn_actuator *actuator);
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
117
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
118 #endif /* _ACTUATORS_H */