BEAST/BSE - Better Audio System and Sound Engine  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bstqsampler.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_QSAMPLER_H__
3 #define __BST_QSAMPLER_H__
4 
5 #include "bstutils.hh"
6 
7 G_BEGIN_DECLS
8 
9 /* --- Gtk+ type macros --- */
10 #define BST_TYPE_QSAMPLER (bst_qsampler_get_type ())
11 #define BST_QSAMPLER(object) (GTK_CHECK_CAST ((object), BST_TYPE_QSAMPLER, BstQSampler))
12 #define BST_QSAMPLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BST_TYPE_QSAMPLER, BstQSamplerClass))
13 #define BST_IS_QSAMPLER(object) (GTK_CHECK_TYPE ((object), BST_TYPE_QSAMPLER))
14 #define BST_IS_QSAMPLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BST_TYPE_QSAMPLER))
15 #define BST_QSAMPLER_GET_CLASS(obj) ((BstQSamplerClass*) ((GtkObject*) (obj))->klass)
16 
17 
18 
19 /* --- typedefs --- */
20 typedef struct _BstQSampler BstQSampler;
21 typedef struct _BstQSamplerClass BstQSamplerClass;
22 typedef struct _BstQSamplerPeak BstQSamplerPeak;
23 typedef struct _BstQSamplerTPeak BstQSamplerTPeak;
24 typedef struct _BstQSamplerSource BstQSamplerSource;
25 typedef struct _BstQSamplerBlock BstQSamplerBlock;
26 typedef struct _BstQSamplerMark BstQSamplerMark;
27 typedef struct _BstQSamplerRegion BstQSamplerRegion;
28 typedef guint (*BstQSamplerFill) (gpointer data,
29  guint voffset,
30  gdouble offset_scale,
31  guint block_size,
32  guint n_values,
33  BstQSamplerPeak *values,
34  BstQSampler *qsampler);
35 typedef enum
36 {
37  /* regions & marks */
38  BST_QSAMPLER_ACTIVE = 1 << 1,
39  BST_QSAMPLER_SELECTED = 1 << 2,
40  /* marks only */
41  BST_QSAMPLER_PRELIGHT = 1 << 3,
42 
43  /*< private >*/
44  BST_QSAMPLER_MARK_MASK = (BST_QSAMPLER_SELECTED | BST_QSAMPLER_ACTIVE | BST_QSAMPLER_PRELIGHT),
45  BST_QSAMPLER_REGION_MASK = (BST_QSAMPLER_SELECTED | BST_QSAMPLER_ACTIVE),
46  BST_QSAMPLER_MARK = 1 << 4,
47  BST_QSAMPLER_MASK = 0x1f,
48  BST_QSAMPLER_SKIP = 1 << 5,
49  BST_QSAMPLER_NEEDS_DRAW = 1 << 6,
50  BST_QSAMPLER_DIRTY = 1 << 7
51 } BstQSamplerType;
52 #ifdef __cplusplus
53 constexpr BstQSamplerType operator& (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType (s1 & (long long unsigned) s2); }
54 inline BstQSamplerType& operator&= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 & s2; return s1; }
55 constexpr BstQSamplerType operator| (BstQSamplerType s1, BstQSamplerType s2) { return BstQSamplerType (s1 | (long long unsigned) s2); }
56 inline BstQSamplerType& operator|= (BstQSamplerType &s1, BstQSamplerType s2) { s1 = s1 | s2; return s1; }
57 constexpr BstQSamplerType operator~ (BstQSamplerType s1) { return BstQSamplerType (~(long long unsigned) s1); }
58 #endif // __cplusplus
59 
60 typedef enum
61 {
62  BST_QSAMPLER_DRAW_CRANGE,
63  BST_QSAMPLER_DRAW_CSHAPE,
64  BST_QSAMPLER_DRAW_ZERO_SHAPE,
65  BST_QSAMPLER_DRAW_MINIMUM_LINE,
66  BST_QSAMPLER_DRAW_MIDDLE_LINE,
67  BST_QSAMPLER_DRAW_MAXIMUM_LINE,
68  BST_QSAMPLER_DRAW_MINIMUM_SHAPE,
69  BST_QSAMPLER_DRAW_MAXIMUM_SHAPE,
70  BST_QSAMPLER_DRAW_MODE_LAST /*< skip >*/
71 } BstQSamplerDrawMode;
72 #define BST_QSAMPLER_RELOAD_PRIORITY (GTK_PRIORITY_REDRAW + 5)
73 
74 
75 /* --- structures --- */
77 {
78  GtkWidget parent_instance;
79 
80  guint peak_length; /* pcm length in peaks */
81  guint n_peaks; /* number of cached peaks */
82  BstQSamplerTPeak *peaks;
83  guint peak_offset; /* display offset */
84  guint n_pixels; /* <= n_peaks */
85 
86 
87  /* user settings */
88  guint n_marks;
89  BstQSamplerMark *marks;
90  guint n_regions;
91  BstQSamplerRegion *regions;
92  guint pcm_length;
93  BstQSamplerFill src_filler;
94  gpointer src_data;
95  GDestroyNotify src_destroy;
96  gdouble zoom_factor;
97 
98  GtkAdjustment *adjustment;
99  gdouble vscale_factor;
100 
101  GdkColor red, green;
102  GdkGC *red_gc, *green_gc;
103  GdkWindow *canvas;
104  guint draw_mode : 16;
105  guint expose_frame : 1;
106  guint ignore_adjustment : 1;
107  guint refresh_queued : 1;
108  guint invalid_remains : 1; /* temporary refresh flag */
109 
110  /* user data */
111  gpointer owner;
112  guint owner_index;
113 };
115 {
116  gint16 min, max;
117  guint8 type;
118 };
120 {
121  gint16 min, max;
122 };
124 {
125  GtkWidgetClass parent_class;
126 };
128 {
129  guint index;
130  BstQSamplerType type;
131  guint offset;
132 };
134 {
135  guint index;
136  BstQSamplerType type;
137  guint offset;
138  guint length;
139 };
140 
141 
142 /* --- prototypes --- */
143 GType bst_qsampler_get_type (void);
144 void bst_qsampler_set_source (BstQSampler *qsampler,
145  guint n_total_samples,
146  BstQSamplerFill fill_func,
147  gpointer data,
148  GDestroyNotify destroy);
149 void bst_qsampler_get_bounds (BstQSampler *qsampler,
150  gint *first_offset,
151  gint *last_offset);
152 gboolean bst_qsampler_get_offset_at (BstQSampler *qsampler,
153  gint *x_coord_p);
154 void bst_qsampler_scroll_show (BstQSampler *qsampler,
155  guint offset);
156 void bst_qsampler_scroll_rbounded (BstQSampler *qsampler,
157  guint offset,
158  gfloat boundary_padding,
159  gfloat padding);
160 void bst_qsampler_scroll_lbounded (BstQSampler *qsampler,
161  guint offset,
162  gfloat boundary_padding,
163  gfloat padding);
164 void bst_qsampler_scroll_bounded (BstQSampler *qsampler,
165  guint offset,
166  gfloat boundary_padding,
167  gfloat padding);
168 void bst_qsampler_scroll_to (BstQSampler *qsampler,
169  guint offset);
170 void bst_qsampler_force_refresh (BstQSampler *qsampler);
171 void bst_qsampler_set_mark (BstQSampler *qsampler,
172  guint mark_index,
173  guint offset,
174  BstQSamplerType type);
175 gint bst_qsampler_get_mark_offset (BstQSampler *qsampler,
176  guint mark_index);
177 void bst_qsampler_set_region (BstQSampler *qsampler,
178  guint region_index,
179  guint offset,
180  guint length,
181  BstQSamplerType type);
182 void bst_qsampler_set_zoom (BstQSampler *qsampler,
183  gdouble zoom);
184 void bst_qsampler_set_vscale (BstQSampler *qsampler,
185  gdouble vscale);
186 void bst_qsampler_set_draw_mode (BstQSampler *qsampler,
187  BstQSamplerDrawMode dmode);
188 void bst_qsampler_set_adjustment (BstQSampler *qsampler,
189  GtkAdjustment *adjustment);
190 
191 void bst_qsampler_set_source_from_esample (BstQSampler *qsampler,
192  SfiProxy esample,
193  guint nth_channel);
194 
195 G_END_DECLS
196 
197 #endif /* __BST_QSAMPLER_H__ */
Definition: bstqsampler.hh:119
Definition: bstqsampler.hh:133
Definition: bstqsampler.hh:123
Definition: bstqsampler.hh:127
Definition: bstqsampler.hh:76
Definition: bstqsampler.hh:114