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