comparison src/paranormal/containers.c @ 171:9e51ffaca177 trunk

[svn] - add OnBeat container. children are only iterated on a detected beat.
author nenolod
date Tue, 31 Oct 2006 23:18:46 -0800
parents 13955c70fbec
children 5ed59f83526f
comparison
equal deleted inserted replaced
170:13955c70fbec 171:9e51ffaca177
209 "A container that alternates which of its children is executed; it " 209 "A container that alternates which of its children is executed; it "
210 "can either change on an interval, or only on a beat.", 210 "can either change on an interval, or only on a beat.",
211 ACTUATOR_FLAG_CONTAINER, container_cycle_opts, 211 ACTUATOR_FLAG_CONTAINER, container_cycle_opts,
212 container_cycle_init, container_cycle_cleanup, container_cycle_exec 212 container_cycle_init, container_cycle_cleanup, container_cycle_exec
213 }; 213 };
214
215 /* **************** container_onbeat **************** */
216 static void
217 container_onbeat_init (GSList ***data)
218 {
219 *data = g_new0 (GSList *, 1);
220 }
221
222 static void
223 container_onbeat_cleanup (GSList **data)
224 {
225 container_cleanup (data);
226 g_free (data);
227 }
228
229 static void
230 container_onbeat_exec (const struct pn_actuator_option *opts,
231 GSList **data)
232 {
233 GSList *child;
234
235 if (pn_is_new_beat() == TRUE)
236 {
237 for (child = *data; child; child = child->next)
238 exec_actuator ((struct pn_actuator *) child->data);
239 }
240 }
241
242 struct pn_actuator_desc builtin_container_onbeat =
243 {
244 "container_onbeat",
245 "OnBeat Container",
246 "A simple container which only triggers on a beat."
247 ACTUATOR_FLAG_CONTAINER, NULL,
248 PN_ACTUATOR_INIT_FUNC (container_onbeat_init),
249 PN_ACTUATOR_CLEANUP_FUNC (container_onbeat_cleanup),
250 PN_ACTUATOR_EXEC_FUNC (container_onbeat_exec)
251 };