ardour
audio_region_view.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001-2006 Paul Davis
3 
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.
8 
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.
13 
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.
17 */
18 
19 #ifndef __gtk_ardour_audio_region_view_h__
20 #define __gtk_ardour_audio_region_view_h__
21 
22 #ifdef interface
23 #undef interface
24 #endif
25 
26 #include <vector>
27 
28 #include <sigc++/signal.h>
29 #include "ardour/audioregion.h"
30 
31 #include "canvas/fwd.h"
32 #include "canvas/wave_view.h"
33 #include "canvas/xfade_curve.h"
34 
35 #include "region_view.h"
36 #include "time_axis_view_item.h"
37 #include "automation_line.h"
38 #include "enums.h"
39 
40 namespace ARDOUR {
41  class AudioRegion;
42  struct PeakData;
43 };
44 
45 class AudioTimeAxisView;
47 class GhostRegion;
49 class RouteTimeAxisView;
50 
52 {
53  public:
54  AudioRegionView (ArdourCanvas::Container *,
57  double initial_samples_per_pixel,
58  uint32_t base_color);
59 
60  AudioRegionView (ArdourCanvas::Container *,
63  double samples_per_pixel,
64  uint32_t base_color,
65  bool recording,
67 
69 
71 
72  void init (bool wait_for_data);
73 
75 
76  void create_waves ();
77 
78  void set_height (double);
79  void set_samples_per_pixel (double);
80 
81  void set_amplitude_above_axis (gdouble spp);
82 
84  void unhide_envelope ();
85 
87 
88  void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points);
89  void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
90 
92 
93  void region_changed (const PBD::PropertyChange&);
95 
97 
100 
103 
104  void set_fade_visibility (bool);
106 
107  void update_transient(float old_pos, float new_pos);
108  void remove_transient(float pos);
109 
110  void show_region_editor ();
111 
112  virtual void entered ();
113  virtual void exited ();
114 
115  void thaw_after_trim ();
116 
117  void drag_start ();
118  void drag_end ();
119 
120  void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double);
121  void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double, double);
122  void redraw_start_xfade ();
123  void redraw_end_xfade ();
124 
125  void hide_xfades ();
126  void hide_start_xfade ();
127  void hide_end_xfade ();
128  void show_xfades ();
129  void show_start_xfade ();
130  void show_end_xfade ();
131 
132  bool start_xfade_visible () const {
133  return _start_xfade_visible;
134  }
135 
136  bool end_xfade_visible () const {
137  return _end_xfade_visible;
138  }
139 
140  protected:
141 
142  /* this constructor allows derived types
143  to specify their visibility requirements
144  to the TimeAxisViewItem parent class
145  */
146 
147  enum Flags {
151  };
152 
153  std::vector<ArdourCanvas::WaveView *> waves;
154  std::vector<ArdourCanvas::WaveView *> tmp_waves;
155 
156  std::list<std::pair<framepos_t, ArdourCanvas::Line*> > feature_lines;
157 
158  ArdourCanvas::Polygon* sync_mark;
159  ArdourCanvas::Rectangle* fade_in_handle;
160  ArdourCanvas::Rectangle* fade_out_handle;
161  ArdourCanvas::Rectangle* fade_in_trim_handle;
162  ArdourCanvas::Rectangle* fade_out_trim_handle;
163 
164  ArdourCanvas::XFadeCurve* start_xfade_curve;
165  ArdourCanvas::Rectangle* start_xfade_rect;
167 
168  ArdourCanvas::XFadeCurve* end_xfade_curve;
169  ArdourCanvas::Rectangle* end_xfade_rect;
171 
173 
175 
176  void reset_fade_shapes ();
177  void reset_fade_in_shape ();
178  void reset_fade_out_shape ();
179  void fade_in_changed ();
180  void fade_out_changed ();
181  void fade_in_active_changed ();
182  void fade_out_active_changed ();
183 
184  void region_resized (const PBD::PropertyChange&);
185  void region_muted ();
187  void region_renamed ();
188 
189  void create_one_wave (uint32_t, bool);
190  void peaks_ready_handler (uint32_t);
191 
192  void set_colors ();
193  void set_waveform_colors ();
195  void set_frame_color ();
196 
197  void color_handler ();
198 
199  void transients_changed();
200 
202 
203 private:
205 
206  void parameter_changed (std::string const &);
208  void set_some_waveform_colors (std::vector<ArdourCanvas::WaveView*>& waves_to_color);
209 
213  std::vector<PBD::ScopedConnection*> _data_ready_connections;
214 
218  std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
219 
222 };
223 
224 #endif /* __gtk_ardour_audio_region_view_h__ */
ArdourCanvas::Polygon * sync_mark
polgyon for sync position
void reset_width_dependent_items(double pixel_width)
void peaks_ready_handler(uint32_t)
boost::shared_ptr< AudioRegionGainLine > gain_line
void update_coverage_frames(LayerDisplay)
ArdourCanvas::Rectangle * fade_out_handle
fade out handle, or 0
void region_scale_amplitude_changed()
ArdourCanvas::Rectangle * fade_out_trim_handle
fade out trim handle, or 0
bool start_xfade_visible() const
void temporarily_hide_envelope()
Dangerous!
void reset_fade_out_shape_width(boost::shared_ptr< ARDOUR::AudioRegion > ar, framecnt_t, bool drag_active=false)
void remove_gain_point_event(ArdourCanvas::Item *item, GdkEvent *event)
boost::shared_ptr< AudioRegionGainLine > get_gain_line() const
ArdourCanvas::Rectangle * end_xfade_rect
ArdourCanvas::Rectangle * fade_in_handle
fade in handle, or 0
void init(bool wait_for_data)
void create_one_wave(uint32_t, bool)
boost::shared_ptr< ARDOUR::AudioRegion > audio_region() const
void set_height(double)
void remove_transient(float pos)
void set_fade_visibility(bool)
void update_transient(float old_pos, float new_pos)
void region_changed(const PBD::PropertyChange &)
void setup_fade_handle_positions()
void set_samples_per_pixel(double)
int64_t framecnt_t
Definition: types.h:76
framepos_t get_fade_out_shape_width()
virtual void exited()
ArdourCanvas::XFadeCurve * start_xfade_curve
void add_gain_point_event(ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points)
std::vector< ArdourCanvas::WaveView * > tmp_waves
see ::create_waves()
Definition: amp.h:29
std::pair< std::list< AudioRegionView * >, std::list< AudioRegionView * > > _hidden_xfades
void set_some_waveform_colors(std::vector< ArdourCanvas::WaveView * > &waves_to_color)
std::vector< PBD::ScopedConnection * > _data_ready_connections
ArdourCanvas::XFadeCurve * end_xfade_curve
void redraw_start_xfade_to(boost::shared_ptr< ARDOUR::AudioRegion >, framecnt_t, ArdourCanvas::Points &, double, double)
void set_amplitude_above_axis(gdouble spp)
framepos_t get_fade_in_shape_width()
GhostRegion * add_ghost(TimeAxisView &)
void region_resized(const PBD::PropertyChange &)
std::list< std::pair< framepos_t, ArdourCanvas::Line * > > feature_lines
std::vector< ArdourCanvas::WaveView * > waves
ArdourCanvas::Rectangle * fade_in_trim_handle
fade in trim handle, or 0
void reset_fade_in_shape_width(boost::shared_ptr< ARDOUR::AudioRegion > ar, framecnt_t, bool drag_active=false)
bool end_xfade_visible() const
void unhide_envelope()
Dangerous!
ArdourCanvas::Rectangle * start_xfade_rect
LayerDisplay
Definition: enums.h:34
void redraw_end_xfade_to(boost::shared_ptr< ARDOUR::AudioRegion >, framecnt_t, ArdourCanvas::Points &, double, double, double)
bool wait_for_data
Definition: region_view.h:174
LIBGTKMM2EXT_API int pixel_width(const std::string &str, Pango::FontDescription &font)
void parameter_changed(std::string const &)
AudioRegionView(ArdourCanvas::Container *, RouteTimeAxisView &, boost::shared_ptr< ARDOUR::AudioRegion >, double initial_samples_per_pixel, uint32_t base_color)
virtual void entered()
int64_t framepos_t
AutomationLine::VisibleAspects automation_line_visibility() const