diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-06-16 22:29:33 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-06-16 22:29:33 +0000 |
commit | 797149c5a9ee0c7c70947f72cbaece5efd3dd687 (patch) | |
tree | 1c5a8e9dcb09c08e7741c806650c5ef1163387d0 /src/win_main.c | |
parent | 593e1cbe3470f409c19a7f06f5d10c6f5677361a (diff) | |
download | 2012-violon-leds-797149c5a9ee0c7c70947f72cbaece5efd3dd687.tar.gz 2012-violon-leds-797149c5a9ee0c7c70947f72cbaece5efd3dd687.tar.bz2 2012-violon-leds-797149c5a9ee0c7c70947f72cbaece5efd3dd687.zip |
Création du source tree princpal. Les routines de maths pour calculer le gain déconnent encore je trouve.
Reste à intégrer la partie DMX et a améliorer tout ce qui a été laissé de côté...
git-svn-id: file:///var/svn/2012-violon-leds/trunk@20 6be1fa4d-33ac-4c33-becc-79fcb3794bb6
Diffstat (limited to 'src/win_main.c')
-rw-r--r-- | src/win_main.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/win_main.c b/src/win_main.c new file mode 100644 index 0000000..daa0a34 --- /dev/null +++ b/src/win_main.c @@ -0,0 +1,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,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_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; +} + |