1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include "win_main.h"
#include "gtkvumeter.h"
GtkWidget *vumeter_sound, *vumeter_r, *vumeter_g, *vumeter_b, *vumeter_h, *vumeter_s, *vumeter_v;
GtkWidget *win_main_build() {
GtkWidget *win, *hbox1;
GdkColor f_gradient_red[2] = {{0,65535,0,0},{0,32767,0,0}};
GdkColor b_gradient_red[2] = {{0,49151,0,0},{0,24575,0,0}};
GdkColor f_gradient_green[2] = {{0,0,65535,0},{0,0,32767,0}};
GdkColor b_gradient_green[2] = {{0,0,49151,0},{0,0,24575,0}};
GdkColor f_gradient_blue[2] = {{0,0,0,65535},{0,0,0,32767}};
GdkColor b_gradient_blue[2] = {{0,0,0,49151},{0,0,0,24575}};
GdkColor f_gradient_hue[7] = {{0,65535,0,0},{0,65535,0,65535},{0,0,0,65535},{0,0,65535,65535},{0,0,65535,0},{0,65535,65535,0},{0,65535,0,0}};
GdkColor b_gradient_hue[7] = {{0,49151,0,0},{0,49151,0,49151},{0,0,0,49151},{0,0,49151,49151},{0,0,49151,0},{0,49151,49151,0},{0,49151,0,0}};
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
hbox1 = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(win), hbox1);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
//TODO : gtk_vumeter_set_min_max (GTK_VU_METER(vumeter), min, max);
vumeter_sound = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_sound), -50, 0);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_sound, FALSE, FALSE, 0);
vumeter_h = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_h), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_h), 7, f_gradient_hue, 7, b_gradient_hue);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_h, FALSE, FALSE, 0);
vumeter_s = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_s), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_s), 2, f_gradient_red, 2, b_gradient_red);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_s, FALSE, FALSE, 0);
vumeter_v = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_v), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_v), 2, f_gradient_red, 2, b_gradient_red);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_v, FALSE, FALSE, 0);
vumeter_r = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_r), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_r), 2, f_gradient_red, 2, b_gradient_red);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_r, FALSE, FALSE, 0);
vumeter_g = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_g), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_g), 2, f_gradient_green, 2, b_gradient_green);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_g, FALSE, FALSE, 0);
vumeter_b = gtk_vu_meter_new (TRUE);
gtk_vu_meter_set_min_max(GTK_VU_METER(vumeter_b), 0, 255);
gtk_vu_meter_set_gradient(GTK_VU_METER(vumeter_b), 2, f_gradient_blue, 2, b_gradient_blue);
gtk_box_pack_start(GTK_BOX(hbox1), vumeter_b, FALSE, FALSE, 0);
return win;
}
gboolean win_main_update_vumeters(gpointer vals) {
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_sound), ((gint*)vals)[0]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_h), ((gint*)vals)[1]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_s), ((gint*)vals)[2]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_v), ((gint*)vals)[3]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_r), ((gint*)vals)[4]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_g), ((gint*)vals)[5]);
gtk_vu_meter_set_level(GTK_VU_METER(vumeter_b), ((gint*)vals)[6]);
return TRUE;
}
|