2 Copyright (C) 2001-2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __gtk_ardour_audio_region_view_h__
20 #define __gtk_ardour_audio_region_view_h__
24 #include <libgnomecanvasmm.h>
25 #include <libgnomecanvasmm/polygon.h>
26 #include <sigc++/signal.h>
27 #include "ardour/audioregion.h"
29 #include "region_view.h"
30 #include "time_axis_view_item.h"
31 #include "automation_line.h"
41 class AudioTimeAxisView;
42 class AudioRegionGainLine;
44 class AutomationTimeAxisView;
45 class RouteTimeAxisView;
47 class AudioRegionView : public RegionView
50 AudioRegionView (ArdourCanvas::Group *,
52 boost::shared_ptr<ARDOUR::AudioRegion>,
53 double initial_samples_per_unit,
54 Gdk::Color const & basic_color);
56 AudioRegionView (ArdourCanvas::Group *,
58 boost::shared_ptr<ARDOUR::AudioRegion>,
59 double samples_per_unit,
60 Gdk::Color const & basic_color,
62 TimeAxisViewItem::Visibility);
64 AudioRegionView (const AudioRegionView& other, boost::shared_ptr<ARDOUR::AudioRegion>);
68 virtual void init (Gdk::Color const & base_color, bool wait_for_data);
70 boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
74 void set_height (double);
75 void set_samples_per_unit (double);
77 void set_amplitude_above_axis (gdouble spp);
79 void temporarily_hide_envelope (); ///< Dangerous!
80 void unhide_envelope (); ///< Dangerous!
82 void update_envelope_visible ();
83 void set_waveform_visible (bool yn);
84 void set_waveform_shape (ARDOUR::WaveformShape);
85 void set_waveform_scale (ARDOUR::WaveformScale);
87 bool waveform_rectified() const { return _flags & WaveformRectified; }
88 bool waveform_logscaled() const { return _flags & WaveformLogScaled; }
89 bool waveform_visible() const { return _flags & WaveformVisible; }
91 void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
92 void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
94 boost::shared_ptr<AudioRegionGainLine> get_gain_line() const { return gain_line; }
96 void region_changed (const PBD::PropertyChange&);
97 void envelope_active_changed ();
99 GhostRegion* add_ghost (TimeAxisView&);
101 void reset_fade_in_shape_width (framecnt_t);
102 void reset_fade_out_shape_width (framecnt_t);
104 void show_fade_line(framepos_t pos);
105 void hide_fade_line();
107 void set_fade_visibility (bool);
108 void update_coverage_frames (LayerDisplay);
110 void update_transient(float old_pos, float new_pos);
111 void remove_transient(float pos);
113 void show_region_editor ();
115 virtual void entered (bool);
116 virtual void exited ();
118 void thaw_after_trim ();
123 void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
124 void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
125 void redraw_start_xfade ();
126 void redraw_end_xfade ();
133 /* this constructor allows derived types
134 to specify their visibility requirements
135 to the TimeAxisViewItem parent class
139 WaveformVisible = 0x4,
140 WaveformRectified = 0x8,
141 WaveformLogScaled = 0x10,
144 std::vector<ArdourCanvas::WaveView *> waves;
145 std::vector<ArdourCanvas::WaveView *> tmp_waves; ///< see ::create_waves()
147 std::list<std::pair<framepos_t, ArdourCanvas::Line*> > feature_lines;
149 ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position
150 ArdourCanvas::Polygon* fade_in_shape;
151 ArdourCanvas::Polygon* fade_out_shape;
152 ArdourCanvas::SimpleRect* fade_in_handle; ///< fade in handle, or 0
153 ArdourCanvas::SimpleRect* fade_out_handle; ///< fade out handle, or 0
154 ArdourCanvas::SimpleLine* fade_position_line;
156 ArdourCanvas::Line *start_xfade_in;
157 ArdourCanvas::Line *start_xfade_out;
158 ArdourCanvas::SimpleRect* start_xfade_rect;
160 ArdourCanvas::Line *end_xfade_in;
161 ArdourCanvas::Line *end_xfade_out;
162 ArdourCanvas::SimpleRect* end_xfade_rect;
164 boost::shared_ptr<AudioRegionGainLine> gain_line;
166 double _amplitude_above_axis;
171 void reset_fade_shapes ();
172 void reset_fade_in_shape ();
173 void reset_fade_out_shape ();
174 void fade_in_changed ();
175 void fade_out_changed ();
176 void fade_in_active_changed ();
177 void fade_out_active_changed ();
179 void region_resized (const PBD::PropertyChange&);
180 void region_muted ();
181 void region_scale_amplitude_changed ();
182 void region_renamed ();
184 void create_one_wave (uint32_t, bool);
185 void peaks_ready_handler (uint32_t);
186 void set_flags (XMLNode *);
190 void compute_colors (Gdk::Color const &);
191 void reset_width_dependent_items (double pixel_width);
192 void set_waveview_data_src();
193 void set_frame_color ();
195 void color_handler ();
197 std::vector<GnomeCanvasWaveViewCache*> wave_caches;
199 void transients_changed();
201 AutomationLine::VisibleAspects automation_line_visibility () const;
204 void setup_fade_handle_positions ();
206 /** A ScopedConnection for each PeaksReady callback (one per channel). Each member
207 * may be 0 if no connection exists.
209 std::vector<PBD::ScopedConnection*> _data_ready_connections;
212 #endif /* __gtk_ardour_audio_region_view_h__ */