annotate src/paranormal/freq.c @ 866:d8b8b36d2709 trunk

[svn] - prevent skin list overlap when it's first populated and user quickly switchs to other tabs in the prefswin
author giacomo
date Fri, 16 Mar 2007 18:47:24 -0700
parents adf9f4b26039
children 3b034150d31e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
1 #ifdef HAVE_CONFIG_H
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
2 # include <config.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
3 #endif
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
4
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
5 #include <stdlib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
6 #include <stdio.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
7
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
8 #include <glib.h>
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
9
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
10 #include "paranormal.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
11 #include "actuators.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
12 #include "pn_utils.h"
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
13
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
14 /* **************** freq_dots **************** */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
15 /* FIXME: take this piece of crap out */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
16 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
17 freq_dots_exec (const struct pn_actuator_option *opts,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
18 gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
19 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
20 int i, basex;
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 basex = (pn_image_data->width>>1)-128;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
23 for (i=basex < 0 ? -basex : 0 ; i < 256; i++)
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 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
26 - CAP (pn_sound_data->freq_data[0][i], 120))]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
27 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
28 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
29 + CAP (pn_sound_data->freq_data[1][i], 120))]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
30 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
31 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
32 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
33
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
34 struct pn_actuator_desc builtin_freq_dots =
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
35 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
36 "freq_dots",
155
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
37 "Frequency Scope",
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
38 "Draws dots varying vertically with the freqency data.",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
39 0, NULL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
40 NULL, NULL, freq_dots_exec
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
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
43 /* **************** freq_drops **************** */
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
44 static void
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
45 freq_drops_exec (const struct pn_actuator_option *opts,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
46 gpointer data)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
47 {
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
48 int i,j;
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 for (i=0; i<256; i++)
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
51 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
52 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
53 rand() % pn_image_data->height)]
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
54 = 0xff;
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
55 }
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
56
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
57 struct pn_actuator_desc builtin_freq_drops =
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 "freq_drops",
155
adf9f4b26039 [svn] - user-friendly names (UI side unimplemented still)
nenolod
parents: 149
diff changeset
60 "Random Dots",
149
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
61 "Draws dots at random on the image (louder music = more dots)",
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
62 0, NULL,
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
63 NULL, NULL, freq_drops_exec
fd9c0a5871ac [svn] - new and IMPROVED paranormal visualization studio
nenolod
parents:
diff changeset
64 };