summaryrefslogtreecommitdiff
path: root/tests/test4/win_main.c
blob: c0249cf1692d813afd5398aad3f98e55cbf4f666 (plain)
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
#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,0,0,0}};
	GdkColor b_gradient_red[2] = {{0,49151,0,0},{0,0,0,0}};
	GdkColor f_gradient_green[2] = {{0,0,65535,0},{0,0,0,0}};
	GdkColor b_gradient_green[2] = {{0,0,49151,0},{0,0,0,0}};
	GdkColor f_gradient_blue[2] = {{0,0,0,65535},{0,0,0,0}};
	GdkColor b_gradient_blue[2] = {{0,0,0,49151},{0,0,0,0}};
	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_VUMETER(vumeter), min, max);
	vumeter_sound = gtk_vumeter_new (TRUE);
	gtk_box_pack_start(GTK_BOX(hbox1), vumeter_sound, FALSE, FALSE, 0);

	vumeter_h = gtk_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(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_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(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_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(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_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(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_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(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_vumeter_new (TRUE);
	gtk_vumeter_set_gradient(GTK_VUMETER(vumeter_b), 2, f_gradient_blue, 2, b_gradient_blue);
	gtk_box_pack_start(GTK_BOX(hbox1), vumeter_b, FALSE, FALSE, 0);

	return win;
}

void win_main_update_vumeters(void *vals) {
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_sound), ((gint*)vals)[0]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_h), ((gint*)vals)[1]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_s), ((gint*)vals)[2]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_v), ((gint*)vals)[3]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_r), ((gint*)vals)[4]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_g), ((gint*)vals)[5]);
	gtk_vumeter_set_level(GTK_VUMETER(vumeter_b), ((gint*)vals)[6]);
}