Set mixbufs count in the case of a panner being used, as
[ardour2.git] / gtk2_ardour / canvas-waveview.h
blobf04a4b38c2e4acb0867652642221c484cba8c3c3
1 /* libgnomecanvas/gnome-canvas-waveview.h: GnomeCanvas item for displaying wave data
3 * Copyright (C) 2001 Paul Davis <pbd@op.net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library 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 GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 #ifndef __GNOME_CANVAS_WAVEVIEW_H__
23 #define __GNOME_CANVAS_WAVEVIEW_H__
25 #include <stdint.h>
27 #include <libgnomecanvas/libgnomecanvas.h>
29 G_BEGIN_DECLS
31 /* Wave viewer item for canvas.
34 #define GNOME_TYPE_CANVAS_WAVEVIEW (gnome_canvas_waveview_get_type ())
35 #define GNOME_CANVAS_WAVEVIEW(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveView))
36 #define GNOME_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass))
37 #define GNOME_IS_CANVAS_WAVEVIEW(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_WAVEVIEW))
38 #define GNOME_IS_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_WAVEVIEW))
39 #define GNOME_CANVAS_WAVEVIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass))
41 typedef struct _GnomeCanvasWaveView GnomeCanvasWaveView;
42 typedef struct _GnomeCanvasWaveViewClass GnomeCanvasWaveViewClass;
43 typedef struct _GnomeCanvasWaveViewChannelInfo GnomeCanvasWaveViewChannelInfo;
44 typedef struct _GnomeCanvasWaveViewCacheEntry GnomeCanvasWaveViewCacheEntry;
45 typedef struct _GnomeCanvasWaveViewCache GnomeCanvasWaveViewCache;
47 /* XXX this needs to be synced with ardour/source.h PeakData */
49 struct _GnomeCanvasWaveViewCacheEntry
51 float min;
52 float max;
55 struct _GnomeCanvasWaveViewCache
57 GnomeCanvasWaveViewCacheEntry* data;
58 guint32 allocated;
59 guint64 data_size;
60 gulong start;
61 gulong end;
64 GnomeCanvasWaveViewCache* gnome_canvas_waveview_cache_new ();
65 void gnome_canvas_waveview_cache_destroy (GnomeCanvasWaveViewCache*);
67 typedef gulong (*waveview_length_function_t)(void*);
68 typedef gulong (*waveview_sourcefile_length_function_t)(void*, double);
69 typedef void (*waveview_gain_curve_function_t)(void *arg, double start, double end, float* vector, gint64 veclen);
70 typedef void (*waveview_peak_function_t)(void*,gulong,gulong,gulong,gpointer,guint32,double);
72 struct _GnomeCanvasWaveView
74 GnomeCanvasItem item;
76 GnomeCanvasWaveViewCache *cache;
77 gboolean cache_updater;
78 gint screen_width;
80 void *data_src;
81 guint32 channel;
82 waveview_peak_function_t peak_function;
83 waveview_length_function_t length_function;
84 waveview_sourcefile_length_function_t sourcefile_length_function;
85 waveview_gain_curve_function_t gain_curve_function;
86 void *gain_src;
88 /** x-axis: samples per canvas unit. */
89 double samples_per_unit;
91 /** y-axis: amplitude_above_axis.
93 * the default is that an (scaled, normalized -1.0 ... +1.0) amplitude of 1.0
94 * corresponds to the top of the area assigned to the waveview.
96 * larger values will expand the vertical scale, cutting off the peaks/troughs.
97 * smaller values will decrease the vertical scale, moving peaks/troughs toward
98 * the middle of the area assigned to the waveview.
100 double amplitude_above_axis;
102 double x;
103 double y;
104 double height;
105 double half_height;
106 uint32_t wave_color;
107 uint32_t clip_color;
108 uint32_t zero_color;
109 uint32_t fill_color;
111 char filled;
112 char rectified;
113 char zero_line;
114 char logscaled;
116 /* These are updated by the update() routine
117 to optimize the render() routine, which may
118 be called several times after a single update().
121 int32_t bbox_ulx;
122 int32_t bbox_uly;
123 int32_t bbox_lrx;
124 int32_t bbox_lry;
125 unsigned char wave_r, wave_g, wave_b, wave_a;
126 unsigned char clip_r, clip_g, clip_b, clip_a;
127 unsigned char fill_r, fill_g, fill_b, fill_a;
128 uint32_t samples;
129 uint32_t region_start;
130 int32_t reload_cache_in_render;
133 struct _GnomeCanvasWaveViewClass {
134 GnomeCanvasItemClass parent_class;
137 GType gnome_canvas_waveview_get_type (void) G_GNUC_CONST;
139 G_END_DECLS
141 #endif /* __GNOME_CANVAS_WAVEVIEW_H__ */