3 * Copyright (C) 2008-2019 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "bcmeter.inc"
24 #include "bcsubwindow.h"
34 // Distance from subwindow border to top and bottom tick mark
35 #define METER_MARGIN 0
37 #define TICK_W1 xS(10)
40 class BC_Meter : public BC_SubWindow
43 BC_Meter(int x, int y, int orientation, int pixels,
44 int min, /* = -40, */ int max,
45 int mode, /* = METER_DB, */
46 int use_titles, /* = 0, */
47 int span /* = -1 width for vertical mode only */,
49 int is_gain_change = 0);
54 // Number of updates before over dissappears
55 int over_delay, /* = 150, */
56 // Number of updates before peak updates
57 int peak_delay /* = 15 */);
58 void set_images(VFrame **data);
59 int region_pixel(int region);
60 int region_pixels(int region);
61 virtual int button_press_event();
63 static int get_title_w();
64 static int get_meter_w();
65 int update(float new_value, int over, int downmix=-1);
66 int reposition_window(int x, int y,
67 int span /* = -1 for vertical mode only */,
69 int reset(int downmix=-1);
71 int change_format(int mode, int min, int max);
74 void draw_titles(int flush);
75 void draw_face(int flush);
76 int level_to_pixel(float level);
79 BC_Pixmap *images[TOTAL_METER_IMAGES];
81 // Number of pixels in the longest dimension
83 // Width if variable width
89 // Tick mark positions
90 ArrayList<int> tick_pixels;
92 ArrayList<int> tick_w;
94 ArrayList<int> title_pixels;
95 ArrayList<char*> db_titles;
101 int peak_pixel, level_pixel, peak_pixel1, peak_pixel2;
102 int over_count, over_timer;
105 int over_delay; // Number of updates the over warning lasts.
106 int peak_delay; // Number of updates the peak lasts.