Mercurial > audlegacy-plugins
comparison src/Visualization/paranormal/pn/pnactuatorlist.c @ 0:13389e613d67 trunk
[svn] - initial import of audacious-plugins tree (lots to do)
author | nenolod |
---|---|
date | Mon, 18 Sep 2006 01:11:49 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13389e613d67 |
---|---|
1 /* Paranormal - A highly customizable audio visualization library | |
2 * Copyright (C) 2001 Jamie Gennis <jgennis@mindspring.com> | |
3 * | |
4 * This library is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU Library General Public | |
6 * License as published by the Free Software Foundation; either | |
7 * version 2 of the License, or (at your option) any later version. | |
8 * | |
9 * This library is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * Library General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Library General Public | |
15 * License along with this library; if not, write to the Free | |
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
17 */ | |
18 | |
19 #include <glib.h> | |
20 #include "pnactuatorlist.h" | |
21 | |
22 static void pn_actuator_list_class_init (PnActuatorListClass *class); | |
23 static void pn_actuator_list_init (PnActuatorList *actuator_list, | |
24 PnActuatorListClass *class); | |
25 /* PnActuator methods */ | |
26 static void pn_actuator_list_execute (PnActuatorList *actuator_list, | |
27 PnImage *image, | |
28 PnAudioData *audio_data); | |
29 | |
30 static PnActuatorClass *parent_class = NULL; | |
31 | |
32 GType | |
33 pn_actuator_list_get_type (void) | |
34 { | |
35 static GType actuator_list_type = 0; | |
36 | |
37 if (! actuator_list_type) | |
38 { | |
39 static const GTypeInfo actuator_list_info = | |
40 { | |
41 sizeof (PnActuatorListClass), | |
42 NULL, /* base_init */ | |
43 NULL, /* base_finalize */ | |
44 (GClassInitFunc) pn_actuator_list_class_init, | |
45 NULL, /* class_finalize */ | |
46 NULL, /* class_data */ | |
47 sizeof (PnActuatorList), | |
48 0, /* n_preallocs */ | |
49 (GInstanceInitFunc) pn_actuator_list_init | |
50 }; | |
51 | |
52 /* FIXME: should this be dynamic? */ | |
53 actuator_list_type = g_type_register_static (PN_TYPE_CONTAINER, | |
54 "PnActuatorList", | |
55 &actuator_list_info, | |
56 0); | |
57 } | |
58 return actuator_list_type; | |
59 } | |
60 | |
61 static void | |
62 pn_actuator_list_class_init (PnActuatorListClass *class) | |
63 { | |
64 PnObjectClass *object_class; | |
65 PnUserObjectClass *user_object_class; | |
66 PnActuatorClass *actuator_class; | |
67 | |
68 parent_class = g_type_class_peek_parent (class); | |
69 | |
70 object_class = (PnObjectClass *) class; | |
71 user_object_class = (PnUserObjectClass *) class; | |
72 actuator_class = (PnActuatorClass *) class; | |
73 | |
74 /* PnActuator methods */ | |
75 actuator_class->execute = (PnActuatorExecFunc) pn_actuator_list_execute; | |
76 } | |
77 | |
78 static void | |
79 pn_actuator_list_init (PnActuatorList *actuator_list, PnActuatorListClass *class) | |
80 { | |
81 /* Set up the name and description */ | |
82 pn_user_object_set_name (PN_USER_OBJECT (actuator_list), "Container.Actuator_List"); | |
83 pn_user_object_set_description (PN_USER_OBJECT (actuator_list), | |
84 "A container that executes all its actuators sequentially"); | |
85 } | |
86 | |
87 static void | |
88 pn_actuator_list_execute (PnActuatorList *actuator_list, PnImage *image, | |
89 PnAudioData *audio_data) | |
90 { | |
91 guint i; | |
92 GArray *actuators; | |
93 | |
94 g_return_if_fail (actuator_list != NULL); | |
95 g_return_if_fail (PN_IS_ACTUATOR_LIST (actuator_list)); | |
96 g_return_if_fail (image != NULL); | |
97 g_return_if_fail (PN_IS_IMAGE (image)); | |
98 g_return_if_fail (audio_data != NULL); | |
99 | |
100 actuators = ((PnContainer *) (actuator_list))->actuators;; | |
101 | |
102 for (i=0; i<actuators->len; i++) | |
103 pn_actuator_execute (g_array_index (actuators, PnActuator *, i), image, audio_data); | |
104 | |
105 if (PN_ACTUATOR_CLASS (parent_class)->execute) | |
106 PN_ACTUATOR_CLASS (parent_class)->execute(PN_ACTUATOR (actuator_list), image, audio_data); | |
107 } | |
108 | |
109 /** | |
110 * pn_actuator_list_new | |
111 * | |
112 * Creates a new #PnActuatorList. | |
113 * | |
114 * Returns: The new #PnActuatorList. | |
115 */ | |
116 PnActuatorList* | |
117 pn_actuator_list_new (void) | |
118 { | |
119 return (PnActuatorList *) g_object_new (PN_TYPE_ACTUATOR_LIST, NULL); | |
120 } |