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