annotate src/paranormal/freq.c @ 3203:f5456241bff9 default tip

changed include path from audacious to audlegacy.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 10 Nov 2009 05:19:25 +0900
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: 1943
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
1943
56bb18dd3fdd paranormal: CONFIG_H removal
William Pitcock <nenolod@atheme.org>
parents: 1892
diff changeset
20 #include <config.h>
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
21
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
22 #include <stdlib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
23 #include <stdio.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
24
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
25 #include <glib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
26
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
27 #include "paranormal.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
28 #include "actuators.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
29 #include "pn_utils.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
30
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
31 /* **************** freq_dots **************** */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
32 /* FIXME: take this piece of crap out */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
33 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
34 freq_dots_exec (const struct pn_actuator_option *opts,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
35 gpointer data)
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 int i, basex;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
38
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
39 basex = (pn_image_data->width>>1)-128;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
40 for (i=basex < 0 ? -basex : 0 ; i < 256; i++)
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 pn_image_data->surface[0][PN_IMG_INDEX (basex+i, (pn_image_data->height>>1)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
43 - CAP (pn_sound_data->freq_data[0][i], 120))]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
44 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
45 pn_image_data->surface[0][PN_IMG_INDEX (basex+256-i, (pn_image_data->height>>1)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
46 + CAP (pn_sound_data->freq_data[1][i], 120))]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
47 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
48 }
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 struct pn_actuator_desc builtin_freq_dots =
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
52 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
53 "freq_dots",
155
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
54 "Frequency Scope",
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
55 "Draws dots varying vertically with the freqency data.",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
56 0, NULL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
57 NULL, NULL, freq_dots_exec
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
58 };
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
59
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
60 /* **************** freq_drops **************** */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
61 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
62 freq_drops_exec (const struct pn_actuator_option *opts,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
63 gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
64 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
65 int i,j;
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 for (i=0; i<256; i++)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
68 for (j=0; j<pn_sound_data->freq_data[0][i]>>3; i++)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
69 pn_image_data->surface[0][PN_IMG_INDEX (rand() % pn_image_data->width,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
70 rand() % pn_image_data->height)]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
71 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
72 }
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 struct pn_actuator_desc builtin_freq_drops =
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
75 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
76 "freq_drops",
155
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
77 "Random Dots",
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
78 "Draws dots at random on the image (louder music = more dots)",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
79 0, NULL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
80 NULL, NULL, freq_drops_exec
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
81 };