annotate audacious/widgets/vis.c @ 2179:8bdcac47760b trunk

[svn] Keep the voiceprint inside the range for the theme.
author marvin
date Tue, 19 Dec 2006 15:13:17 -0800
parents 7267fc6b2c67
children 65ca93cd72bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
3 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
4 * Based on XMMS:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
6 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
10 * (at your option) any later version.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
11 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
16 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
20 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
21
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
22 #include "widgetcore.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
23
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
24 #include <glib.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
25 #include <gdk/gdk.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
26 #include <string.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
27
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
28 #include "main.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
29 #include "skin.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
30 #include "widget.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
31
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
32 static const gfloat vis_afalloff_speeds[] = { 0.34, 0.5, 1.0, 1.3, 1.6 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
33 static const gfloat vis_pfalloff_speeds[] = { 1.2, 1.3, 1.4, 1.5, 1.6 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
34 static const gint vis_redraw_delays[] = { 1, 2, 4, 8 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
35 static const guint8 vis_scope_colors[] =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
36 { 21, 21, 20, 20, 19, 19, 18, 19, 19, 20, 20, 21, 21 };
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
37 static guint8 vs_data_ext[1216];
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
38
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
39
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
40 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
41 vis_timeout_func(Vis * vis, guchar * data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
42 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
43 static GTimer *timer = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
44 gulong micros = 9999999;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
45 gboolean falloff = FALSE;
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
46 gint i, n;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
47
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
48 if (!timer) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
49 timer = g_timer_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
50 g_timer_start(timer);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
51 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
52 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
53 g_timer_elapsed(timer, &micros);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
54 if (micros > 14000)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
55 g_timer_reset(timer);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
56
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
57 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
58
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
59 if (cfg.vis_type == VIS_ANALYZER) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
60 if (micros > 14000)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
61 falloff = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
62 if (data || falloff) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
63 for (i = 0; i < 75; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
64 if (data && data[i] > vis->vs_data[i]) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
65 vis->vs_data[i] = data[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
66 if (vis->vs_data[i] > vis->vs_peak[i]) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
67 vis->vs_peak[i] = vis->vs_data[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
68 vis->vs_peak_speed[i] = 0.01;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
69
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
70 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
71 else if (vis->vs_peak[i] > 0.0) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
72 vis->vs_peak[i] -= vis->vs_peak_speed[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
73 vis->vs_peak_speed[i] *=
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
74 vis_pfalloff_speeds[cfg.peaks_falloff];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
75 if (vis->vs_peak[i] < vis->vs_data[i])
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
76 vis->vs_peak[i] = vis->vs_data[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
77 if (vis->vs_peak[i] < 0.0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
78 vis->vs_peak[i] = 0.0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
79 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
80 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
81 else if (falloff) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
82 if (vis->vs_data[i] > 0.0) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
83 vis->vs_data[i] -=
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
84 vis_afalloff_speeds[cfg.analyzer_falloff];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
85 if (vis->vs_data[i] < 0.0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
86 vis->vs_data[i] = 0.0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
87 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
88 if (vis->vs_peak[i] > 0.0) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
89 vis->vs_peak[i] -= vis->vs_peak_speed[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
90 vis->vs_peak_speed[i] *=
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
91 vis_pfalloff_speeds[cfg.peaks_falloff];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
92 if (vis->vs_peak[i] < vis->vs_data[i])
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
93 vis->vs_peak[i] = vis->vs_data[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
94 if (vis->vs_peak[i] < 0.0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
95 vis->vs_peak[i] = 0.0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
96 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
97 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
98 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
99 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
100 }
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
101 else if (cfg.vis_type == VIS_VOICEPRINT && data){
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
102 for(i = 0; i < 16; i++)
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
103 {
2179
8bdcac47760b [svn] Keep the voiceprint inside the range for the theme.
marvin
parents: 2171
diff changeset
104 /*The color palette is in the range [0-17]. This makes sure we stay there.*/
8bdcac47760b [svn] Keep the voiceprint inside the range for the theme.
marvin
parents: 2171
diff changeset
105 vis->vs_data[i] = data[15 - i] > 17 ? 17 : data[15-i];
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
106 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
107 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
108 else if (data) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
109 for (i = 0; i < 75; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
110 vis->vs_data[i] = data[i];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
111 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
112
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
113 if (micros > 14000) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
114 if (!vis->vs_refresh_delay) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
115 vis_draw((Widget *) vis);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
116 vis->vs_refresh_delay = vis_redraw_delays[cfg.vis_refresh];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
117
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
118 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
119 vis->vs_refresh_delay--;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
120 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
121 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
122
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
123 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
124 vis_draw(Widget * w)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
125 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
126 Vis *vis = (Vis *) w;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
127 gint x, y, h = 0, h2;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
128 guchar vis_color[24][3];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
129 guchar rgb_data[152 * 32], *ptr, c;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
130 guint32 colors[24];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
131 GdkRgbCmap *cmap;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
132
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
133 if (!vis->vs_widget.visible)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
134 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
135
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
136 skin_get_viscolor(bmp_active_skin, vis_color);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
137 for (y = 0; y < 24; y++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
138 colors[y] =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
139 vis_color[y][0] << 16 | vis_color[y][1] << 8 | vis_color[y][2];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
140 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
141 cmap = gdk_rgb_cmap_new(colors, 24);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
142
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
143 if (!vis->vs_doublesize) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
144 memset(rgb_data, 0, 76 * 16);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
145 for (y = 1; y < 16; y += 2) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
146 ptr = rgb_data + (y * 76);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
147 for (x = 0; x < 76; x += 2, ptr += 2)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
148 *ptr = 1;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
149 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
150 if (cfg.vis_type == VIS_ANALYZER) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
151 for (x = 0; x < 75; x++) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
152 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
153 h = vis->vs_data[x >> 2];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
154 else if (cfg.analyzer_type == ANALYZER_LINES)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
155 h = vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
156 if (h && (cfg.analyzer_type == ANALYZER_LINES ||
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
157 (x % 4) != 3)) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
158 ptr = rgb_data + ((16 - h) * 76) + x;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
159 switch (cfg.analyzer_mode) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
160 case ANALYZER_NORMAL:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
161 for (y = 0; y < h; y++, ptr += 76)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
162 *ptr = 18 - h + y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
163 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
164 case ANALYZER_FIRE:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
165 for (y = 0; y < h; y++, ptr += 76)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
166 *ptr = y + 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
167 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
168 case ANALYZER_VLINES:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
169 for (y = 0; y < h; y++, ptr += 76)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
170 *ptr = 18 - h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
171 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
172 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
173 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
174 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
175 if (cfg.analyzer_peaks) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
176 for (x = 0; x < 75; x++) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
177 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
178 h = vis->vs_peak[x >> 2];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
179 else if (cfg.analyzer_type == ANALYZER_LINES)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
180 h = vis->vs_peak[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
181 if (h
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
182 && (cfg.analyzer_type == ANALYZER_LINES
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
183 || (x % 4) != 3))
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
184 rgb_data[(16 - h) * 76 + x] = 23;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
185 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
186 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
187 }
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
188 else if (cfg.vis_type == VIS_VOICEPRINT) {
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
189 for (y = 0; y < 16; y ++) {
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
190
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
191 for (x = 74; x > 0; x--)
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
192 {
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
193 vs_data_ext[x + (y * 76)] = vs_data_ext[x-1+(y*76)];
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
194 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
195 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
196 for(y=0;y<16;y++){
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
197 vs_data_ext[y * 76] = vis->vs_data[y];
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
198 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
199
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
200 memcpy(rgb_data, vs_data_ext,1216);
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
201
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
202 }
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
203 else if (cfg.vis_type == VIS_SCOPE) {
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
204 for (x = 0; x < 75; x++) {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
205 switch (cfg.scope_mode) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
206 case SCOPE_DOT:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
207 h = vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
208 ptr = rgb_data + ((15 - h) * 76) + x;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
209 *ptr = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
210 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
211 case SCOPE_LINE:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
212 if (x != 74) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
213 h = 15 - vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
214 h2 = 15 - vis->vs_data[x + 1];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
215 if (h > h2) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
216 y = h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
217 h = h2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
218 h2 = y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
219 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
220 ptr = rgb_data + (h * 76) + x;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
221 for (y = h; y <= h2; y++, ptr += 76)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
222 *ptr = vis_scope_colors[y - 3];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
223
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
224 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
225 else {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
226 h = 15 - vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
227 ptr = rgb_data + (h * 76) + x;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
228 *ptr = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
229 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
230 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
231 case SCOPE_SOLID:
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
232 h = 15 - vis->vs_data[x];
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
233 h2 = 9;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
234 c = vis_scope_colors[(gint) vis->vs_data[x]];
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
235 if (h > h2) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
236 y = h;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
237 h = h2;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
238 h2 = y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
239 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
240 ptr = rgb_data + (h * 76) + x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
241 for (y = h; y <= h2; y++, ptr += 76)
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
242 *ptr = c;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
243 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
244 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
245 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
246 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
247
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
248 /* FIXME: The check "shouldn't" be neccessary? */
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
249 /* if (GTK_IS_WINDOW(vis->vs_window)) { */
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
250 GDK_THREADS_ENTER();
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
251 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
252 vis->vs_widget.x, vis->vs_widget.y,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
253 vis->vs_widget.width, vis->vs_widget.height,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
254 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
255 76, cmap);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
256 GDK_THREADS_LEAVE();
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
257 /* } else {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
258 vis->vs_window = mainwin->window;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
259 GDK_THREADS_ENTER();
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
260 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
261 vis->vs_widget.x, vis->vs_widget.y,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
262 vis->vs_widget.width, vis->vs_widget.height,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
263 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
264 76, cmap);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
265 GDK_THREADS_LEAVE();
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
266 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
267 */
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
268 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
269 else {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
270 memset(rgb_data, 0, 152 * 32);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
271 for (y = 1; y < 16; y += 2) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
272 ptr = rgb_data + (y * 304);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
273 for (x = 0; x < 76; x += 2, ptr += 4) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
274 *ptr = 1;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
275 *(ptr + 1) = 1;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
276 *(ptr + 152) = 1;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
277 *(ptr + 153) = 1;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
278 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
279 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
280 if (cfg.vis_type == VIS_ANALYZER) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
281 for (x = 0; x < 75; x++) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
282 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
283 h = vis->vs_data[x >> 2];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
284 else if (cfg.analyzer_type == ANALYZER_LINES)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
285 h = vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
286 if (h
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
287 && (cfg.analyzer_type == ANALYZER_LINES
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
288 || (x % 4) != 3)) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
289 ptr = rgb_data + ((16 - h) * 304) + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
290 switch (cfg.analyzer_mode) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
291 case ANALYZER_NORMAL:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
292 for (y = 0; y < h; y++, ptr += 304) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
293 *ptr = 18 - h + y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
294 *(ptr + 1) = 18 - h + y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
295 *(ptr + 152) = 18 - h + y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
296 *(ptr + 153) = 18 - h + y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
297 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
298 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
299 case ANALYZER_FIRE:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
300 for (y = 0; y < h; y++, ptr += 304) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
301 *ptr = y + 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
302 *(ptr + 1) = y + 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
303 *(ptr + 152) = y + 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
304 *(ptr + 153) = y + 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
305 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
306 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
307 case ANALYZER_VLINES:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
308 for (y = 0; y < h; y++, ptr += 304) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
309 *ptr = 18 - h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
310 *(ptr + 1) = 18 - h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
311 *(ptr + 152) = 18 - h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
312 *(ptr + 153) = 18 - h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
313 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
314
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
315 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
316 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
317
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
318 }
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
319 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
320 if (cfg.analyzer_peaks) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
321
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
322 for (x = 0; x < 75; x++) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
323 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
324 h = vis->vs_peak[x >> 2];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
325 else if (cfg.analyzer_type == ANALYZER_LINES)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
326 h = vis->vs_peak[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
327
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
328 if (h
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
329 && (cfg.analyzer_type == ANALYZER_LINES
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
330 || (x % 4) != 3)) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
331 ptr = rgb_data + (16 - h) * 304 + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
332 *ptr = 23;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
333 *(ptr + 1) = 23;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
334 *(ptr + 152) = 23;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
335 *(ptr + 153) = 23;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
336 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
337 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
338 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
339 }
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
340 else if (cfg.vis_type == VIS_VOICEPRINT) {
2171
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
341 for (y = 0; y < 15; y ++) {
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
342 for (x = 74; x > 0; x--)
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
343 {
2171
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
344 ptr = rgb_data + (x << 1) + y * 304;
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
345 vs_data_ext[x + y * 76] = vs_data_ext[x - 1 + y * 76];
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
346 *ptr = vs_data_ext[x - 1 + y * 76];
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
347 *(ptr+1) = vs_data_ext[x - 1 + y * 76];
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
348
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
349 //FIXME. Currently only every other line is shown in
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
350 //doublesize mode.
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
351 //*(ptr+304) = vs_data_ext[x + y * 76];
7267fc6b2c67 [svn] -added analyzer vis to windowshade mode
marvin
parents: 2169
diff changeset
352 //*(ptr+1+304) = vs_data_ext[x - 1 + y * 76];
2161
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
353 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
354 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
355 for(y=0;y<16;y++){
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
356 vs_data_ext[y * 76] = vis->vs_data[y];
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
357 }
c12319817d7e [svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents: 1938
diff changeset
358 }
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
359 else if (cfg.vis_type == VIS_SCOPE) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
360 for (x = 0; x < 75; x++) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
361 switch (cfg.scope_mode) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
362 case SCOPE_DOT:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
363 h = vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
364 ptr = rgb_data + ((15 - h) * 304) + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
365 *ptr = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
366 *(ptr + 1) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
367 *(ptr + 152) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
368 *(ptr + 153) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
369 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
370 case SCOPE_LINE:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
371 if (x != 74) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
372 h = 15 - vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
373 h2 = 15 - vis->vs_data[x + 1];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
374 if (h > h2) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
375 y = h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
376 h = h2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
377 h2 = y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
378 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
379 ptr = rgb_data + (h * 304) + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
380 for (y = h; y <= h2; y++, ptr += 304) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
381 *ptr = vis_scope_colors[y - 3];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
382 *(ptr + 1) = vis_scope_colors[y - 3];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
383 *(ptr + 152) = vis_scope_colors[y - 3];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
384 *(ptr + 153) = vis_scope_colors[y - 3];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
385 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
386 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
387 else {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
388 h = 15 - vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
389 ptr = rgb_data + (h * 304) + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
390 *ptr = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
391 *(ptr + 1) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
392 *(ptr + 152) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
393 *(ptr + 153) = vis_scope_colors[h];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
394 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
395 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
396 case SCOPE_SOLID:
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
397 h = 15 - vis->vs_data[x];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
398 h2 = 9;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
399 c = vis_scope_colors[(gint) vis->vs_data[x]];
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
400 if (h > h2) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
401 y = h;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
402 h = h2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
403 h2 = y;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
404 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
405 ptr = rgb_data + (h * 304) + (x << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
406 for (y = h; y <= h2; y++, ptr += 304) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
407 *ptr = c;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
408 *(ptr + 1) = c;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
409 *(ptr + 152) = c;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
410 *(ptr + 153) = c;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
411 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
412 break;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
413 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
414 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
415 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
416
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
417 GDK_THREADS_ENTER();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
418 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
419 vis->vs_widget.x << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
420 vis->vs_widget.y << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
421 vis->vs_widget.width << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
422 vis->vs_widget.height << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
423 GDK_RGB_DITHER_NONE, (guchar *) rgb_data,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
424 152, cmap);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
425 GDK_THREADS_LEAVE();
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
426 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
427
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
428 gdk_rgb_cmap_free(cmap);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
429 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
430
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
431 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
432 vis_clear_data(Vis * vis)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
433 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
434 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
435
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
436 if (!vis)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
437 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
438
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
439 for (i = 0; i < 75; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
440 vis->vs_data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
441 vis->vs_peak[i] = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
442 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
443 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
444
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
445 void
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
446 vis_set_doublesize(Vis * vis, gboolean doublesize)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
447 {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
448 vis->vs_doublesize = doublesize;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
449 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
450
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
451 void
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
452 vis_clear(Vis * vis)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
453 {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
454 if (!vis->vs_doublesize)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
455 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
456 vis->vs_widget.y, vis->vs_widget.width,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
457 vis->vs_widget.height);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
458 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
459 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
460 vis->vs_widget.y << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
461 vis->vs_widget.width << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
462 vis->vs_widget.height << 1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
463 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
464
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
465 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
466 vis_set_window(Vis * vis, GdkWindow * window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
467 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
468 vis->vs_window = window;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
469 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
470
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
471 Vis *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
472 create_vis(GList ** wlist,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
473 GdkPixmap * parent,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
474 GdkWindow * window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
475 GdkGC * gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
476 gint x, gint y,
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
477 gint width,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
478 gboolean doublesize)
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
479 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
480 Vis *vis;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
481
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
482 vis = g_new0(Vis, 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
483
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
484 widget_init(&vis->vs_widget, parent, gc, x, y, width, 16, 1);
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
485
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
486 vis->vs_doublesize = doublesize;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
487
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
488 widget_list_add(wlist, WIDGET(vis));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
489
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
490 return vis;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
491 }