summaryrefslogtreecommitdiff
path: root/tests/test4/win_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test4/win_main.c')
-rw-r--r--tests/test4/win_main.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/test4/win_main.c b/tests/test4/win_main.c
new file mode 100644
index 0000000..c0249cf
--- /dev/null
+++ b/tests/test4/win_main.c
@@ -0,0 +1,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]);
+}
+