Mercurial > audlegacy-plugins
comparison src/paranormal/freq.c @ 149:fd9c0a5871ac trunk
[svn] - new and IMPROVED paranormal visualization studio
author | nenolod |
---|---|
date | Mon, 30 Oct 2006 23:02:33 -0800 |
parents | |
children | adf9f4b26039 |
comparison
equal
deleted
inserted
replaced
148:9d9fc9e1de48 | 149:fd9c0a5871ac |
---|---|
1 #ifdef HAVE_CONFIG_H | |
2 # include <config.h> | |
3 #endif | |
4 | |
5 #include <stdlib.h> | |
6 #include <stdio.h> | |
7 | |
8 #include <glib.h> | |
9 | |
10 #include "paranormal.h" | |
11 #include "actuators.h" | |
12 #include "pn_utils.h" | |
13 | |
14 /* **************** freq_dots **************** */ | |
15 /* FIXME: take this piece of crap out */ | |
16 static void | |
17 freq_dots_exec (const struct pn_actuator_option *opts, | |
18 gpointer data) | |
19 { | |
20 int i, basex; | |
21 | |
22 basex = (pn_image_data->width>>1)-128; | |
23 for (i=basex < 0 ? -basex : 0 ; i < 256; i++) | |
24 { | |
25 pn_image_data->surface[0][PN_IMG_INDEX (basex+i, (pn_image_data->height>>1) | |
26 - CAP (pn_sound_data->freq_data[0][i], 120))] | |
27 = 0xff; | |
28 pn_image_data->surface[0][PN_IMG_INDEX (basex+256-i, (pn_image_data->height>>1) | |
29 + CAP (pn_sound_data->freq_data[1][i], 120))] | |
30 = 0xff; | |
31 } | |
32 } | |
33 | |
34 struct pn_actuator_desc builtin_freq_dots = | |
35 { | |
36 "freq_dots", | |
37 "Draws dots varying vertically with the freqency data.", | |
38 0, NULL, | |
39 NULL, NULL, freq_dots_exec | |
40 }; | |
41 | |
42 /* **************** freq_drops **************** */ | |
43 static void | |
44 freq_drops_exec (const struct pn_actuator_option *opts, | |
45 gpointer data) | |
46 { | |
47 int i,j; | |
48 | |
49 for (i=0; i<256; i++) | |
50 for (j=0; j<pn_sound_data->freq_data[0][i]>>3; i++) | |
51 pn_image_data->surface[0][PN_IMG_INDEX (rand() % pn_image_data->width, | |
52 rand() % pn_image_data->height)] | |
53 = 0xff; | |
54 } | |
55 | |
56 struct pn_actuator_desc builtin_freq_drops = | |
57 { | |
58 "freq_drops", | |
59 "Draws dots at random on the image (louder music = more dots)", | |
60 0, NULL, | |
61 NULL, NULL, freq_drops_exec | |
62 }; |