BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BST_DB_METER_H__ 00003 #define __BST_DB_METER_H__ 00004 00005 #include "bstutils.hh" 00006 00007 G_BEGIN_DECLS 00008 00009 /* --- DB Setup --- */ 00010 typedef struct { 00011 double db; 00012 guint rgb; 00013 double pixel; 00014 } BstDBColor; 00015 typedef struct { 00016 gint offset, length; /* scale offset and length in pixels */ 00017 double spzoom; /* pixel/spline corrective zoom */ 00018 GxkSpline *spline; /* dB -> pixel spline */ 00019 gint maxdb, mindb; /* dB range boundaries */ 00020 gint zero_index; /* zero dB segment */ 00021 guint ref_count; 00022 guint n_colors; 00023 BstDBColor *colors; 00024 guint flipdir : 1; 00025 } BstDBSetup; 00026 BstDBSetup* bst_db_setup_new (GxkSpline *db2pixel_spline, 00027 double maxdb, 00028 double mindb); 00029 void bst_db_setup_relocate (BstDBSetup *dbsetup, 00030 gint offset, 00031 gint range, 00032 gboolean flipdir); 00033 guint bst_db_setup_get_color (BstDBSetup *dbsetup, 00034 double pixel, 00035 double saturation); 00036 BstDBSetup* bst_db_setup_copy (BstDBSetup *dbsetup); 00037 BstDBSetup* bst_db_setup_ref (BstDBSetup *dbsetup); 00038 void bst_db_setup_unref (BstDBSetup *dbsetup); 00039 double bst_db_setup_get_pixel (BstDBSetup *dbsetup, 00040 double dbvalue); 00041 double bst_db_setup_get_dbvalue (BstDBSetup *dbsetup, 00042 double pixel); 00043 00044 /* --- type macros --- */ 00045 #define BST_TYPE_DB_LABELING (bst_db_labeling_get_type ()) 00046 #define BST_DB_LABELING(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_LABELING, BstDBLabeling)) 00047 #define BST_DB_LABELING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_LABELING, BstDBLabelingClass)) 00048 #define BST_IS_DB_LABELING(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_LABELING)) 00049 #define BST_IS_DB_LABELING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_LABELING)) 00050 #define BST_DB_LABELING_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_LABELING, BstDBLabelingClass)) 00051 typedef struct { 00052 GtkWidget parent_instance; 00053 BstDBSetup *dbsetup; 00054 guint border; 00055 guint draw_values : 1; 00056 GtkOrientation orientation; 00057 GtkJustification justify; 00058 } BstDBLabeling; 00059 typedef GtkWidgetClass BstDBLabelingClass; 00060 GType bst_db_labeling_get_type (void); 00061 void bst_db_labeling_setup (BstDBLabeling *self, 00062 BstDBSetup *db_setup); 00063 void bst_db_labeling_set_border (BstDBLabeling *self, 00064 guint border); 00065 00066 /* --- type macros --- */ 00067 #define BST_TYPE_DB_BEAM (bst_db_beam_get_type ()) 00068 #define BST_DB_BEAM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_BEAM, BstDBBeam)) 00069 #define BST_DB_BEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_BEAM, BstDBBeamClass)) 00070 #define BST_IS_DB_BEAM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_BEAM)) 00071 #define BST_IS_DB_BEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_BEAM)) 00072 #define BST_DB_BEAM_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_BEAM, BstDBBeamClass)) 00073 typedef struct { 00074 GtkWidget parent_instance; 00075 BstDBSetup *dbsetup; 00076 guint border; 00077 GtkOrientation orientation; 00078 GdkDrawable *pixmap; 00079 double currentdb; 00080 } BstDBBeam; 00081 typedef GtkWidgetClass BstDBBeamClass; 00082 GType bst_db_beam_get_type (void); 00083 void bst_db_beam_setup (BstDBBeam *self, 00084 BstDBSetup *db_setup); 00085 void bst_db_beam_set_border (BstDBBeam *self, 00086 guint border); 00087 void bst_db_beam_set_value (BstDBBeam *self, 00088 double db); 00089 00090 /* --- type macros --- */ 00091 #define BST_TYPE_DB_METER (bst_db_meter_get_type ()) 00092 #define BST_DB_METER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_DB_METER, BstDBMeter)) 00093 #define BST_DB_METER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_DB_METER, BstDBMeterClass)) 00094 #define BST_IS_DB_METER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_DB_METER)) 00095 #define BST_IS_DB_METER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_DB_METER)) 00096 #define BST_DB_METER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_DB_METER, BstDBMeterClass)) 00097 00098 /* --- API --- */ 00099 typedef struct { 00100 GtkAlignment parent_instance; 00101 BstDBSetup *dbsetup; 00102 GtkOrientation orientation; 00103 guint border; 00104 } BstDBMeter; 00105 typedef GtkAlignmentClass BstDBMeterClass; 00106 GType bst_db_meter_get_type (void); 00107 GtkWidget* bst_db_meter_new (GtkOrientation orientation, 00108 guint n_channels); 00109 void bst_db_meter_propagate_border (BstDBMeter *self, 00110 guint border); 00111 void bst_db_meter_propagate_setup (BstDBMeter *self, 00112 BstDBSetup *db_setup); 00113 BstDBBeam* bst_db_meter_create_beam (BstDBMeter *self, 00114 guint padding); 00115 BstDBLabeling* bst_db_meter_create_numbers (BstDBMeter *self, 00116 guint padding); 00117 BstDBLabeling* bst_db_meter_create_dashes (BstDBMeter *self, 00118 GtkJustification justify, 00119 guint padding); 00120 GtkRange* bst_db_meter_create_scale (BstDBMeter *self, 00121 guint padding); 00122 GtkRange* bst_db_meter_get_scale (BstDBMeter *self, 00123 guint nth); 00124 BstDBBeam* bst_db_meter_get_beam (BstDBMeter *self, 00125 guint nth); 00126 BstDBLabeling* bst_db_meter_get_labeling (BstDBMeter *self, 00127 guint nth); 00128 void bst_db_scale_hook_up_param (GtkRange *range, 00129 GxkParam *param); 00130 00131 G_END_DECLS 00132 00133 #endif /* __BST_DB_METER_H__ */