Mercurial > audlegacy-plugins
comparison src/paranormal-ng/freq.c @ 2078:1fa3c8cd366a
paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 15 Oct 2007 06:20:13 -0500 |
parents | |
children | f1b6f1b2cdb3 |
comparison
equal
deleted
inserted
replaced
2077:e5b639ab62b0 | 2078:1fa3c8cd366a |
---|---|
1 /* | |
2 * paranormal: iterated pipeline-driven visualization plugin | |
3 * Copyright (c) 2006, 2007 William Pitcock <nenolod@dereferenced.org> | |
4 * Portions copyright (c) 2001 Jamie Gennis <jgennis@mindspring.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; under version 2 of the License. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 */ | |
19 | |
20 #include <config.h> | |
21 | |
22 #include <stdlib.h> | |
23 #include <stdio.h> | |
24 | |
25 #include <glib.h> | |
26 | |
27 #include "paranormal.h" | |
28 #include "actuators.h" | |
29 #include "pn_utils.h" | |
30 | |
31 /* **************** freq_dots **************** */ | |
32 /* FIXME: take this piece of crap out */ | |
33 static void | |
34 freq_dots_exec (const struct pn_actuator_option *opts, | |
35 gpointer data) | |
36 { | |
37 int i, basex; | |
38 | |
39 basex = (pn_image_data->width>>1)-128; | |
40 for (i=basex < 0 ? -basex : 0 ; i < 256; i++) | |
41 { | |
42 pn_image_data->surface[0][PN_IMG_INDEX (basex+i, (pn_image_data->height>>1) | |
43 - CAP (pn_sound_data->freq_data[0][i], 120))] | |
44 = 0xff; | |
45 pn_image_data->surface[0][PN_IMG_INDEX (basex+256-i, (pn_image_data->height>>1) | |
46 + CAP (pn_sound_data->freq_data[1][i], 120))] | |
47 = 0xff; | |
48 } | |
49 } | |
50 | |
51 struct pn_actuator_desc builtin_freq_dots = | |
52 { | |
53 "freq_dots", | |
54 "Frequency Scope", | |
55 "Draws dots varying vertically with the freqency data.", | |
56 0, NULL, | |
57 NULL, NULL, freq_dots_exec | |
58 }; | |
59 | |
60 /* **************** freq_drops **************** */ | |
61 static void | |
62 freq_drops_exec (const struct pn_actuator_option *opts, | |
63 gpointer data) | |
64 { | |
65 int i,j; | |
66 | |
67 for (i=0; i<256; i++) | |
68 for (j=0; j<pn_sound_data->freq_data[0][i]>>3; i++) | |
69 pn_image_data->surface[0][PN_IMG_INDEX (rand() % pn_image_data->width, | |
70 rand() % pn_image_data->height)] | |
71 = 0xff; | |
72 } | |
73 | |
74 struct pn_actuator_desc builtin_freq_drops = | |
75 { | |
76 "freq_drops", | |
77 "Random Dots", | |
78 "Draws dots at random on the image (louder music = more dots)", | |
79 0, NULL, | |
80 NULL, NULL, freq_drops_exec | |
81 }; |