no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcmeter.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2008-2019 Adam Williams <broadcast at earthling dot net>
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #ifndef BCMETER_H
21 #define BCMETER_H
22
23 #include "bcmeter.inc"
24 #include "bcsubwindow.h"
25 #include "units.h"
26
27 #define METER_TYPES 2
28
29 #define METER_DB 0
30 #define METER_INT 1
31 #define METER_VERT 0
32 #define METER_HORIZ 1
33
34 // Distance from subwindow border to top and bottom tick mark
35 #define METER_MARGIN 0
36 // tick width
37 #define TICK_W1 xS(10)
38 #define TICK_W2 xS(5)
39
40 class BC_Meter : public BC_SubWindow
41 {
42 public:
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 */,
48                 int is_downmix = 0,
49                 int is_gain_change = 0);
50         virtual ~BC_Meter();
51
52         int initialize();
53         int set_delays(
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();
62
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 */,
68                 int pixels);
69         int reset(int downmix=-1);
70         int reset_over();
71         int change_format(int mode, int min, int max);
72
73 private:
74         void draw_titles(int flush);
75         void draw_face(int flush);
76         int level_to_pixel(float level);
77         void get_divisions();
78
79         BC_Pixmap *images[TOTAL_METER_IMAGES];
80         int orientation;
81 // Number of pixels in the longest dimension
82         int pixels;
83 // Width if variable width
84         int span;
85         int low_division;
86         int medium_division;
87         int high_division;
88         int use_titles;
89 // Tick mark positions
90         ArrayList<int> tick_pixels;
91 // Tick widths
92         ArrayList<int> tick_w;
93 // Title positions
94         ArrayList<int> title_pixels;
95         ArrayList<char*> db_titles;
96         float level, peak;
97         int mode;
98         int peak_timer;
99         int is_gain_change;
100
101         int peak_pixel, level_pixel, peak_pixel1, peak_pixel2;
102         int over_count, over_timer;
103         int min, max;
104         int is_downmix;
105         int over_delay;    // Number of updates the over warning lasts.
106         int peak_delay;    // Number of updates the peak lasts.
107 };
108
109 #endif