1 /* gtk-canvas-waveview.h: GtkCanvas 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 __GTK_CANVAS_WAVEVIEW_H__
23 #define __GTK_CANVAS_WAVEVIEW_H__
27 #include <gtk-canvas/gtk-canvas-defs.h>
28 #include "gtk-canvas/gtk-canvas.h"
30 BEGIN_GTK_CANVAS_DECLS
32 /* Wave viewer item for canvas.
35 #define GTK_CANVAS_TYPE_CANVAS_WAVEVIEW (gtk_canvas_waveview_get_type ())
36 #define GTK_CANVAS_WAVEVIEW(obj) (GTK_CHECK_CAST ((obj), GTK_CANVAS_TYPE_CANVAS_WAVEVIEW, GtkCanvasWaveView))
37 #define GTK_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_CANVAS_TYPE_CANVAS_WAVEVIEW, GtkCanvasWaveViewClass))
38 #define GTK_CANVAS_IS_CANVAS_WAVEVIEW(obj) (GTK_CHECK_TYPE ((obj), GTK_CANVAS_TYPE_CANVAS_WAVEVIEW))
39 #define GTK_CANVAS_IS_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_CANVAS_TYPE_CANVAS_WAVEVIEW))
41 typedef struct _GtkCanvasWaveView GtkCanvasWaveView;
42 typedef struct _GtkCanvasWaveViewClass GtkCanvasWaveViewClass;
43 typedef struct _GtkCanvasWaveViewChannelInfo GtkCanvasWaveViewChannelInfo;
44 typedef struct _GtkCanvasWaveViewCacheEntry GtkCanvasWaveViewCacheEntry;
45 typedef struct _GtkCanvasWaveViewCache GtkCanvasWaveViewCache;
47 /* XXX this needs to be synced with ardour/source.h PeakData */
49 struct _GtkCanvasWaveViewCacheEntry
55 struct _GtkCanvasWaveViewCache
57 GtkCanvasWaveViewCacheEntry* data;
64 GtkCanvasWaveViewCache* gtk_canvas_waveview_cache_new ();
65 void gtk_canvas_waveview_cache_destroy (GtkCanvasWaveViewCache*);
67 struct _GtkCanvasWaveView
71 GtkCanvasWaveViewCache *cache;
72 gboolean cache_updater;
77 void (*peak_function)(void*,gulong,gulong,gulong,gpointer,guint32,double);
78 gulong (*length_function)(void *);
79 gulong (*sourcefile_length_function)(void*);
80 void (*gain_curve_function)(void *arg, double start, double end, float* vector, guint32 veclen);
83 /* x-axis: samples per canvas unit. */
84 double samples_per_unit;
86 /* y-axis: amplitude_above_axis.
88 * the default is that an (scaled, normalized -1.0 ... +1.0) amplitude of 1.0
89 * corresponds to the top of the area assigned to the waveview.
91 * larger values will expand the vertical scale, cutting off the peaks/troughs.
92 * smaller values will decrease the vertical scale, moving peaks/troughs toward
93 * the middle of the area assigned to the waveview.
96 double amplitude_above_axis;
105 /* These are updated by the update() routine
106 to optimize the render() routine, which may
107 be called several times after a single update().
114 unsigned char wave_r, wave_g, wave_b, wave_a;
116 uint32_t region_start;
117 int32_t reload_cache_in_render;
120 struct _GtkCanvasWaveViewClass {
121 GtkCanvasItemClass parent_class;
124 GtkType gtk_canvas_waveview_get_type (void);
128 #endif /* __GTK_CANVAS_WAVEVIEW_H__ */