1 /*
2    gnauralVU.c
3 
4    Copyright (C) 20101014  Bret Logan
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 #include "main.h"
26 #include "BinauralBeat.h"
27 #include "gnauralVU.h"
28 
29 GtkWidget *gnauralVU_VolL = NULL;
30 GtkWidget *gnauralVU_VolR = NULL;
31 
32 ////////////////////////////////////////////
33 //added 20101014
gnauralVU_init(GtkBuilder * xml)34 void gnauralVU_init (GtkBuilder * xml)
35 {
36  gnauralVU_VolL =
37   GTK_WIDGET (gtk_builder_get_object (xml, "progressbar_VolL"));
38  gnauralVU_VolR =
39   GTK_WIDGET (gtk_builder_get_object (xml, "progressbar_VolR"));
40 }
41 
42 /////////////////////////////////////////////////////
43 //added 20101014
main_UpdateVU()44 void main_UpdateVU ()
45 {
46  float left;
47  float right;
48 
49  left = BB_PeakL * 0.000030518;
50  if (left > 1.0) left = 1.0;
51  right = BB_PeakR * 0.000030518;
52  if (right > 1.0) right = 1.0;
53 
54  gtk_progress_bar_set_fraction ((GtkProgressBar *) gnauralVU_VolL, left);
55  gtk_progress_bar_set_fraction ((GtkProgressBar *) gnauralVU_VolR, right);
56  BB_PeakR*=.6;
57  BB_PeakL*=.6;
58 }
59