BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
bstdbmeter.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BST_DB_METER_H__
3 #define __BST_DB_METER_H__
4 
5 #include "bstutils.hh"
6 
7 G_BEGIN_DECLS
8 
9 /* --- DB Setup --- */
10 typedef struct {
11  double db;
12  guint rgb;
13  double pixel;
14 } BstDBColor;
15 typedef struct {
16  gint offset, length; /* scale offset and length in pixels */
17  double spzoom; /* pixel/spline corrective zoom */
18  GxkSpline *spline; /* dB -> pixel spline */
19  gint maxdb, mindb; /* dB range boundaries */
20  gint zero_index; /* zero dB segment */
21  guint ref_count;
22  guint n_colors;
23  BstDBColor *colors;
24  guint flipdir : 1;
25 } BstDBSetup;
26 BstDBSetup* bst_db_setup_new (GxkSpline *db2pixel_spline,
27  double maxdb,
28  double mindb);
29 void bst_db_setup_relocate (BstDBSetup *dbsetup,
30  gint offset,
31  gint range,
32  gboolean flipdir);
33 guint bst_db_setup_get_color (BstDBSetup *dbsetup,
34  double pixel,
35  double saturation);
36 BstDBSetup* bst_db_setup_copy (BstDBSetup *dbsetup);
37 BstDBSetup* bst_db_setup_ref (BstDBSetup *dbsetup);
38 void bst_db_setup_unref (BstDBSetup *dbsetup);
39 double bst_db_setup_get_pixel (BstDBSetup *dbsetup,
40  double dbvalue);
41 double bst_db_setup_get_dbvalue (BstDBSetup *dbsetup,
42  double pixel);
43 
44 /* --- type macros --- */
45 #define BST_TYPE_DB_LABELING (bst_db_labeling_get_type ())
46 #define BST_DB_LABELING(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_LABELING, BstDBLabeling))
47 #define BST_DB_LABELING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_LABELING, BstDBLabelingClass))
48 #define BST_IS_DB_LABELING(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_LABELING))
49 #define BST_IS_DB_LABELING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_LABELING))
50 #define BST_DB_LABELING_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_LABELING, BstDBLabelingClass))
51 typedef struct {
52  GtkWidget parent_instance;
53  BstDBSetup *dbsetup;
54  guint border;
55  guint draw_values : 1;
56  GtkOrientation orientation;
57  GtkJustification justify;
59 typedef GtkWidgetClass BstDBLabelingClass;
60 GType bst_db_labeling_get_type (void);
61 void bst_db_labeling_setup (BstDBLabeling *self,
62  BstDBSetup *db_setup);
63 void bst_db_labeling_set_border (BstDBLabeling *self,
64  guint border);
65 
66 /* --- type macros --- */
67 #define BST_TYPE_DB_BEAM (bst_db_beam_get_type ())
68 #define BST_DB_BEAM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_BEAM, BstDBBeam))
69 #define BST_DB_BEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_BEAM, BstDBBeamClass))
70 #define BST_IS_DB_BEAM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_BEAM))
71 #define BST_IS_DB_BEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_BEAM))
72 #define BST_DB_BEAM_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_BEAM, BstDBBeamClass))
73 typedef struct {
74  GtkWidget parent_instance;
75  BstDBSetup *dbsetup;
76  guint border;
77  GtkOrientation orientation;
78  GdkDrawable *pixmap;
79  double currentdb;
80 } BstDBBeam;
81 typedef GtkWidgetClass BstDBBeamClass;
82 GType bst_db_beam_get_type (void);
83 void bst_db_beam_setup (BstDBBeam *self,
84  BstDBSetup *db_setup);
85 void bst_db_beam_set_border (BstDBBeam *self,
86  guint border);
87 void bst_db_beam_set_value (BstDBBeam *self,
88  double db);
89 
90 /* --- type macros --- */
91 #define BST_TYPE_DB_METER (bst_db_meter_get_type ())
92 #define BST_DB_METER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_METER, BstDBMeter))
93 #define BST_DB_METER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_METER, BstDBMeterClass))
94 #define BST_IS_DB_METER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_METER))
95 #define BST_IS_DB_METER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_METER))
96 #define BST_DB_METER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_METER, BstDBMeterClass))
97 
98 /* --- API --- */
99 typedef struct {
100  GtkAlignment parent_instance;
101  BstDBSetup *dbsetup;
102  GtkOrientation orientation;
103  guint border;
104 } BstDBMeter;
105 typedef GtkAlignmentClass BstDBMeterClass;
106 GType bst_db_meter_get_type (void);
107 GtkWidget* bst_db_meter_new (GtkOrientation orientation,
108  guint n_channels);
109 void bst_db_meter_propagate_border (BstDBMeter *self,
110  guint border);
111 void bst_db_meter_propagate_setup (BstDBMeter *self,
112  BstDBSetup *db_setup);
113 BstDBBeam* bst_db_meter_create_beam (BstDBMeter *self,
114  guint padding);
115 BstDBLabeling* bst_db_meter_create_numbers (BstDBMeter *self,
116  guint padding);
117 BstDBLabeling* bst_db_meter_create_dashes (BstDBMeter *self,
118  GtkJustification justify,
119  guint padding);
120 GtkRange* bst_db_meter_create_scale (BstDBMeter *self,
121  guint padding);
122 GtkRange* bst_db_meter_get_scale (BstDBMeter *self,
123  guint nth);
124 BstDBBeam* bst_db_meter_get_beam (BstDBMeter *self,
125  guint nth);
126 BstDBLabeling* bst_db_meter_get_labeling (BstDBMeter *self,
127  guint nth);
128 void bst_db_scale_hook_up_param (GtkRange *range,
129  GxkParam *param);
130 
131 G_END_DECLS
132 
133 #endif /* __BST_DB_METER_H__ */
Definition: bstdbmeter.hh:10
Definition: bstdbmeter.hh:51
Definition: gxkparam.hh:14
Definition: bstdbmeter.hh:99
Definition: bstdbmeter.hh:15
Definition: bstdbmeter.hh:73