Mercurial > audlegacy
annotate audacious/widgets/vis.c @ 2307:d4c2cbfce304 trunk
[svn] - i see no reason to keep the BMP changelogs
| author | nenolod |
|---|---|
| date | Wed, 10 Jan 2007 04:54:30 -0800 |
| parents | 37076c4efff7 |
| children |
| rev | line source |
|---|---|
| 1653 | 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" | |
| 31 | |
| 32 static const gfloat vis_afalloff_speeds[] = { 0.34, 0.5, 1.0, 1.3, 1.6 }; | |
| 33 static const gfloat vis_pfalloff_speeds[] = { 1.2, 1.3, 1.4, 1.5, 1.6 }; | |
| 34 static const gint vis_redraw_delays[] = { 1, 2, 4, 8 }; | |
| 35 static const guint8 vis_scope_colors[] = | |
| 36 { 21, 21, 20, 20, 19, 19, 18, 19, 19, 20, 20, 21, 21 }; | |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
37 //static guint8 vs_data_ext[76 * 16 * 4]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
38 static guchar voiceprint_data[76*16]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
39 //static guchar voiceprint_data_normal[76*16]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
40 //static guchar voiceprint_data_rgb[76*16*4]; |
| 1653 | 41 |
| 42 void | |
| 43 vis_timeout_func(Vis * vis, guchar * data) | |
| 44 { | |
| 45 static GTimer *timer = NULL; | |
| 46 gulong micros = 9999999; | |
| 47 gboolean falloff = FALSE; | |
|
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
48 gint i, n; |
| 1653 | 49 |
| 50 if (!timer) { | |
| 51 timer = g_timer_new(); | |
| 52 g_timer_start(timer); | |
| 53 } | |
| 54 else { | |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
55 g_timer_elapsed(timer, µs); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
56 if (micros > 14000) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
57 g_timer_reset(timer); |
| 1653 | 58 } |
| 59 if (cfg.vis_type == VIS_ANALYZER) { | |
| 60 if (micros > 14000) | |
| 61 falloff = TRUE; | |
| 62 if (data || falloff) { | |
| 63 for (i = 0; i < 75; i++) { | |
| 64 if (data && data[i] > vis->vs_data[i]) { | |
| 65 vis->vs_data[i] = data[i]; | |
| 66 if (vis->vs_data[i] > vis->vs_peak[i]) { | |
| 67 vis->vs_peak[i] = vis->vs_data[i]; | |
| 68 vis->vs_peak_speed[i] = 0.01; | |
| 69 | |
| 70 } | |
| 71 else if (vis->vs_peak[i] > 0.0) { | |
| 72 vis->vs_peak[i] -= vis->vs_peak_speed[i]; | |
| 73 vis->vs_peak_speed[i] *= | |
| 74 vis_pfalloff_speeds[cfg.peaks_falloff]; | |
| 75 if (vis->vs_peak[i] < vis->vs_data[i]) | |
| 76 vis->vs_peak[i] = vis->vs_data[i]; | |
| 77 if (vis->vs_peak[i] < 0.0) | |
| 78 vis->vs_peak[i] = 0.0; | |
| 79 } | |
| 80 } | |
| 81 else if (falloff) { | |
| 82 if (vis->vs_data[i] > 0.0) { | |
| 83 vis->vs_data[i] -= | |
| 84 vis_afalloff_speeds[cfg.analyzer_falloff]; | |
| 85 if (vis->vs_data[i] < 0.0) | |
| 86 vis->vs_data[i] = 0.0; | |
| 87 } | |
| 88 if (vis->vs_peak[i] > 0.0) { | |
| 89 vis->vs_peak[i] -= vis->vs_peak_speed[i]; | |
| 90 vis->vs_peak_speed[i] *= | |
| 91 vis_pfalloff_speeds[cfg.peaks_falloff]; | |
| 92 if (vis->vs_peak[i] < vis->vs_data[i]) | |
| 93 vis->vs_peak[i] = vis->vs_data[i]; | |
| 94 if (vis->vs_peak[i] < 0.0) | |
| 95 vis->vs_peak[i] = 0.0; | |
| 96 } | |
| 97 } | |
| 98 } | |
| 99 } | |
| 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 { |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
104 vis->vs_data[i] = data[15 - i]; |
|
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
105 } |
|
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
106 } |
| 1653 | 107 else if (data) { |
| 108 for (i = 0; i < 75; i++) | |
| 109 vis->vs_data[i] = data[i]; | |
| 110 } | |
| 111 | |
| 112 if (micros > 14000) { | |
| 113 if (!vis->vs_refresh_delay) { | |
| 114 vis_draw((Widget *) vis); | |
| 115 vis->vs_refresh_delay = vis_redraw_delays[cfg.vis_refresh]; | |
| 116 | |
| 117 } | |
| 118 vis->vs_refresh_delay--; | |
| 119 } | |
| 120 } | |
| 121 void | |
| 122 vis_draw(Widget * w) | |
| 123 { | |
| 124 Vis *vis = (Vis *) w; | |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
125 gint x, y, n, h = 0, h2; |
| 1653 | 126 guchar vis_color[24][3]; |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
127 guchar rgb_data[76 * 16 * 3 * 2 * 2], *ptr, c; |
| 1653 | 128 guint32 colors[24]; |
| 129 GdkRgbCmap *cmap; | |
| 130 | |
| 131 if (!vis->vs_widget.visible) | |
| 132 return; | |
| 133 | |
| 134 skin_get_viscolor(bmp_active_skin, vis_color); | |
| 135 for (y = 0; y < 24; y++) { | |
| 136 colors[y] = | |
| 137 vis_color[y][0] << 16 | vis_color[y][1] << 8 | vis_color[y][2]; | |
| 138 } | |
| 139 cmap = gdk_rgb_cmap_new(colors, 24); | |
| 140 | |
| 1938 | 141 if (!vis->vs_doublesize) { |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
142 if(cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
143 memset(rgb_data, 0, 76 * 16 * 3); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
144 } |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
145 else{ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
146 memset(rgb_data, 0, 76 * 16); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
147 for (y = 1; y < 16; y += 2) { |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
148 ptr = rgb_data + (y * 76); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
149 for (x = 0; x < 76; x += 2, ptr += 2) |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
150 *ptr = 1; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
151 } |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
152 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
153 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
154 else{ |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
155 if(cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
156 memset(rgb_data, 0, 3 * 4 * 16 * 76); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
157 } |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
158 else{ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
159 memset(rgb_data, 0, 152 * 32); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
160 for (y = 1; y < 16; y += 2) { |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
161 ptr = rgb_data + (y * 304); |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
162 for (x = 0; x < 76; x += 2, ptr += 4) { |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
163 *ptr = 1; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
164 *(ptr + 1) = 1; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
165 *(ptr + 152) = 1; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
166 *(ptr + 153) = 1; |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
167 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
168 } |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
169 } |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
170 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
171 if (cfg.vis_type == VIS_ANALYZER) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
172 for (x = 0; x < 75; x++) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
173 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
174 h = vis->vs_data[x >> 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
175 else if (cfg.analyzer_type == ANALYZER_LINES) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
176 h = vis->vs_data[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
177 if (h && (cfg.analyzer_type == ANALYZER_LINES || |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
178 (x % 4) != 3)) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
179 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
180 ptr = rgb_data + ((16 - h) * 76) + x; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
181 switch (cfg.analyzer_mode) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
182 case ANALYZER_NORMAL: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
183 for (y = 0; y < h; y++, ptr += 76) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
184 *ptr = 18 - h + y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
185 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
186 case ANALYZER_FIRE: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
187 for (y = 0; y < h; y++, ptr += 76) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
188 *ptr = y + 2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
189 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
190 case ANALYZER_VLINES: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
191 for (y = 0; y < h; y++, ptr += 76) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
192 *ptr = 18 - h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
193 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
194 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
195 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
196 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
197 ptr = rgb_data + ((16 - h) * 304) + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
198 switch (cfg.analyzer_mode) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
199 case ANALYZER_NORMAL: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
200 for (y = 0; y < h; y++, ptr += 304) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
201 *ptr = 18 - h + y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
202 *(ptr + 1) = 18 - h + y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
203 *(ptr + 152) = 18 - h + y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
204 *(ptr + 153) = 18 - h + y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
205 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
206 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
207 case ANALYZER_FIRE: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
208 for (y = 0; y < h; y++, ptr += 304) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
209 *ptr = y + 2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
210 *(ptr + 1) = y + 2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
211 *(ptr + 152) = y + 2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
212 *(ptr + 153) = y + 2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
213 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
214 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
215 case ANALYZER_VLINES: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
216 for (y = 0; y < h; y++, ptr += 304) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
217 *ptr = 18 - h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
218 *(ptr + 1) = 18 - h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
219 *(ptr + 152) = 18 - h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
220 *(ptr + 153) = 18 - h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
221 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
222 |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
223 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
224 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
225 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
226 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
227 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
228 if (cfg.analyzer_peaks) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
229 for (x = 0; x < 75; x++) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
230 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
231 h = vis->vs_peak[x >> 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
232 else if (cfg.analyzer_type == ANALYZER_LINES) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
233 h = vis->vs_peak[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
234 if (h && (cfg.analyzer_type == ANALYZER_LINES || (x % 4) != 3)){ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
235 |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
236 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
237 rgb_data[(16 - h) * 76 + x] = 23; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
238 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
239 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
240 ptr = rgb_data + (16 - h) * 304 + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
241 *ptr = 23; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
242 *(ptr + 1) = 23; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
243 *(ptr + 152) = 23; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
244 *(ptr + 153) = 23; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
245 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
246 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
247 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
248 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
249 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
250 else if (cfg.vis_type == VIS_VOICEPRINT) { |
|
2229
37076c4efff7
[svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten in widgetcore, hmm.
nenolod
parents:
2216
diff
changeset
|
251 if(!playback_get_paused() && playback_get_playing()){/*Don't scroll when it's paused or stopped*/ |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
252 for (y = 0; y < 16; y ++) |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
253 for (x = 75; x > 0; x--) |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
254 voiceprint_data[x + y * 76] = voiceprint_data[x-1+y*76]; |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
255 for(y=0;y<16;y++) |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
256 voiceprint_data[y * 76] = vis->vs_data[y]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
257 } |
|
2229
37076c4efff7
[svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten in widgetcore, hmm.
nenolod
parents:
2216
diff
changeset
|
258 if(playback_get_playing()){ /*Only draw the data if we're playing*/ |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
259 for (y = 0; y < 16; y ++){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
260 for (x = 0; x < 76; x++){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
261 guint8 d = voiceprint_data[x + y*76]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
262 if(cfg.voiceprint_mode == VOICEPRINT_NORMAL){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
263 d = d > 64 ? 17 : d >> 3 ; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
264 if(!vis->vs_doublesize){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
265 rgb_data[x + y * 76] = d; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
266 } |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
267 else{ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
268 ptr = rgb_data + (x << 1) + y * 304; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
269 *ptr = d; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
270 *(ptr + 1) = d; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
271 *(ptr + 152) = d; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
272 *(ptr + 153) = d; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
273 } |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
274 } |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
275 else{ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
276 guint8 c[3]; // R, G, B array |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
277 if(cfg.voiceprint_mode == VOICEPRINT_FIRE){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
278 c[0] = d < 64 ? (d * 2) : 255; //R |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
279 c[1] = d < 64 ? 0 : (d < 128 ? (d-64) * 2 : 255); //G |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
280 c[2] = d < 128 ? 0 : (d-128) * 2; //B |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
281 } |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
282 else if(cfg.voiceprint_mode == VOICEPRINT_ICE){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
283 //c[0] = d < 192 ? 0 : (d-192) * 4; //R |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
284 //c[1] = d < 192 ? 0 : (d-192) * 4; //G |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
285 c[0] = d; //R |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
286 c[1] = d < 128 ? d * 2 : 255; //G |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
287 c[2] = d < 64 ? d * 4 : 255; //B |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
288 } |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
289 if(!vis->vs_doublesize){ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
290 for(n=0;n<3;n++) |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
291 rgb_data[x * 3 + y * 76*3+n] = c[n]; |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
292 } |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
293 else{ |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
294 ptr = rgb_data + x * 3 * 2 + y * 2 * 76 * 3 * 2; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
295 for(n=0;n<3;n++) |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
296 { |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
297 *(ptr + n) = c[n]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
298 *(ptr + n + 3) = c[n]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
299 *(ptr + n + 76 * 2 * 3) = c[n]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
300 *(ptr + n + 3 + 76 * 2 * 3) = c[n]; |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
301 } |
|
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
302 } |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
303 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
304 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
305 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
306 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
307 } |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
308 if (cfg.vis_type == VIS_SCOPE) { |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
309 for (x = 0; x < 75; x++) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
310 switch (cfg.scope_mode) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
311 case SCOPE_DOT: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
312 h = vis->vs_data[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
313 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
314 ptr = rgb_data + ((14 - h) * 76) + x; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
315 *ptr = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
316 }else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
317 ptr = rgb_data + ((14 - h) * 304) + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
318 *ptr = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
319 *(ptr + 1) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
320 *(ptr + 152) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
321 *(ptr + 153) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
322 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
323 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
324 case SCOPE_LINE: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
325 if (x != 74) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
326 h = 14 - vis->vs_data[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
327 h2 = 14 - vis->vs_data[x + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
328 if (h > h2) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
329 y = h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
330 h = h2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
331 h2 = y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
332 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
333 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
334 ptr = rgb_data + (h * 76) + x; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
335 for (y = h; y <= h2; y++, ptr += 76) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
336 *ptr = vis_scope_colors[y - 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
337 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
338 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
339 ptr = rgb_data + (h * 304) + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
340 for (y = h; y <= h2; y++, ptr += 304) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
341 *ptr = vis_scope_colors[y - 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
342 *(ptr + 1) = vis_scope_colors[y - 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
343 *(ptr + 152) = vis_scope_colors[y - 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
344 *(ptr + 153) = vis_scope_colors[y - 2]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
345 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
346 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
347 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
348 else { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
349 h = 14 - vis->vs_data[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
350 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
351 ptr = rgb_data + (h * 76) + x; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
352 *ptr = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
353 }else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
354 ptr = rgb_data + (h * 304) + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
355 *ptr = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
356 *(ptr + 1) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
357 *(ptr + 152) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
358 *(ptr + 153) = vis_scope_colors[h + 1]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
359 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
360 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
361 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
362 case SCOPE_SOLID: |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
363 h = 14 - vis->vs_data[x]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
364 h2 = 8; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
365 c = vis_scope_colors[(gint) vis->vs_data[x]]; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
366 if (h > h2) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
367 y = h; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
368 h = h2; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
369 h2 = y; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
370 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
371 if (!vis->vs_doublesize) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
372 ptr = rgb_data + (h * 76) + x; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
373 for (y = h; y <= h2; y++, ptr += 76) |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
374 *ptr = c; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
375 }else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
376 ptr = rgb_data + (h * 304) + (x << 1); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
377 for (y = h; y <= h2; y++, ptr += 304) { |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
378 *ptr = c; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
379 *(ptr + 1) = c; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
380 *(ptr + 152) = c; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
381 *(ptr + 153) = c; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
382 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
383 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
384 break; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
385 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
386 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
387 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
388 |
| 1938 | 389 |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
390 |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
391 if (!vis->vs_doublesize) { |
| 1938 | 392 GDK_THREADS_ENTER(); |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
393 if (cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
394 gdk_draw_rgb_image(vis->vs_window, vis->vs_widget.gc, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
395 vis->vs_widget.x, vis->vs_widget.y, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
396 vis->vs_widget.width, vis->vs_widget.height, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
397 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
398 76 * 3); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
399 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
400 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
401 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
402 vis->vs_widget.x, vis->vs_widget.y, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
403 vis->vs_widget.width, vis->vs_widget.height, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
404 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
405 76, cmap); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
406 } |
| 1938 | 407 GDK_THREADS_LEAVE(); |
| 408 } | |
| 409 else { | |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
410 GDK_THREADS_ENTER(); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
411 if (cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
412 gdk_draw_rgb_image(vis->vs_window, vis->vs_widget.gc, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
413 vis->vs_widget.x << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
414 vis->vs_widget.y << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
415 vis->vs_widget.width << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
416 vis->vs_widget.height << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
417 GDK_RGB_DITHER_NONE, (guchar *) rgb_data, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
418 76 * 2 * 3); |
|
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
419 } |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
420 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
421 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
422 vis->vs_widget.x << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
423 vis->vs_widget.y << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
424 vis->vs_widget.width << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
425 vis->vs_widget.height << 1, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
426 GDK_RGB_DITHER_NONE, (guchar *) rgb_data, |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
427 76 * 2 , cmap); |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
428 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
429 GDK_THREADS_LEAVE(); |
| 1938 | 430 } |
| 1653 | 431 gdk_rgb_cmap_free(cmap); |
| 432 } | |
| 433 | |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
434 |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
435 |
| 1653 | 436 void |
| 437 vis_clear_data(Vis * vis) | |
| 438 { | |
| 439 gint i; | |
| 440 | |
| 441 if (!vis) | |
| 442 return; | |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
443 memset(voiceprint_data, 0, 16*76); |
| 1653 | 444 for (i = 0; i < 75; i++) { |
| 445 vis->vs_data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0; | |
| 446 vis->vs_peak[i] = 0; | |
| 447 } | |
| 448 } | |
| 449 | |
| 450 void | |
| 1938 | 451 vis_set_doublesize(Vis * vis, gboolean doublesize) |
| 452 { | |
| 453 vis->vs_doublesize = doublesize; | |
| 454 } | |
| 455 | |
| 456 void | |
| 1653 | 457 vis_clear(Vis * vis) |
| 458 { | |
| 1938 | 459 if (!vis->vs_doublesize) |
| 460 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x, | |
| 461 vis->vs_widget.y, vis->vs_widget.width, | |
| 462 vis->vs_widget.height); | |
| 463 else | |
| 464 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x << 1, | |
| 465 vis->vs_widget.y << 1, | |
| 466 vis->vs_widget.width << 1, | |
| 467 vis->vs_widget.height << 1); | |
| 1653 | 468 } |
| 469 | |
| 470 void | |
| 471 vis_set_window(Vis * vis, GdkWindow * window) | |
| 472 { | |
| 473 vis->vs_window = window; | |
| 474 } | |
| 475 | |
|
2203
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
476 void vis_draw_pixel(Vis * vis, guchar* texture, gint x, gint y, guint8 colour){ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
477 if(vis->vs_doublesize){ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
478 texture[y * 76 + x] = colour; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
479 texture[y * 76 + x + 1] = colour; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
480 texture[y * 76 * 4 + x] = colour; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
481 texture[y * 76 * 4 + x + 1] = colour; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
482 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
483 else{ |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
484 texture[y * 76 + x] = colour; |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
485 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
486 } |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
487 |
|
60bd49189fde
[svn] - two realcolour modes for voiceprint vis: Fire and Ice
marvin
parents:
2194
diff
changeset
|
488 |
| 1653 | 489 Vis * |
| 490 create_vis(GList ** wlist, | |
| 491 GdkPixmap * parent, | |
| 492 GdkWindow * window, | |
| 493 GdkGC * gc, | |
| 494 gint x, gint y, | |
| 1938 | 495 gint width, |
| 496 gboolean doublesize) | |
| 1653 | 497 { |
| 498 Vis *vis; | |
| 499 | |
| 500 vis = g_new0(Vis, 1); | |
|
2216
f8e68d1aadd0
[svn] - Make voiceprint behave nicer, esp. in doublesize mode
marvin
parents:
2203
diff
changeset
|
501 memset(voiceprint_data, 0, 16*76); |
| 1653 | 502 widget_init(&vis->vs_widget, parent, gc, x, y, width, 16, 1); |
| 1938 | 503 |
| 504 vis->vs_doublesize = doublesize; | |
| 505 | |
| 1653 | 506 widget_list_add(wlist, WIDGET(vis)); |
| 507 | |
| 508 return vis; | |
| 509 } |
