Ardour  8.12
audio_region_view.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2007 Doug McLain <doug@nostar.net>
5  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
6  * Copyright (C) 2012 Ben Loftis <ben@harrisonconsoles.com>
7  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef __gtk_ardour_audio_region_view_h__
25 #define __gtk_ardour_audio_region_view_h__
26 
27 #ifdef interface
28 #undef interface
29 #endif
30 
31 #include <vector>
32 
33 #include <sigc++/signal.h>
34 #include "ardour/audioregion.h"
35 
36 #include "canvas/fwd.h"
37 #include "canvas/xfade_curve.h"
38 
39 #include "waveview/wave_view.h"
40 
41 #include "line_merger.h"
42 #include "region_view.h"
43 #include "time_axis_view_item.h"
44 #include "automation_line.h"
45 #include "enums.h"
46 
47 namespace ARDOUR {
48  class AudioRegion;
49  struct PeakData;
50 };
51 
52 class AudioTimeAxisView;
53 class GhostRegion;
55 class RegionFxLine;
56 class RouteTimeAxisView;
57 class PasteContext;
58 
59 class AudioRegionView : public RegionView, public LineMerger
60 {
61 public:
64  std::shared_ptr<ARDOUR::AudioRegion>,
65  double initial_samples_per_pixel,
66  uint32_t base_color);
67 
70  std::shared_ptr<ARDOUR::AudioRegion>,
71  double samples_per_pixel,
72  uint32_t base_color,
73  bool recording,
75 
76  AudioRegionView (const AudioRegionView& other, std::shared_ptr<ARDOUR::AudioRegion>);
77 
79 
80  void init (bool wait_for_data);
81 
82  std::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
83 
84  void create_waves ();
85  void delete_waves ();
86 
87  void set_height (double);
88  void set_samples_per_pixel (double);
89 
90  void set_amplitude_above_axis (gdouble spp);
91 
93  void unhide_envelope ();
94 
97  bool set_region_fx_line (uint32_t, uint32_t);
98  bool set_region_fx_line (std::weak_ptr<PBD::Controllable>);
99  bool get_region_fx_line (PBD::ID&, uint32_t&);
102 
103  sigc::signal<void> region_line_changed;
104 
105  void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points);
106 
107  std::shared_ptr<RegionFxLine> fx_line() const { return _fx_line; }
108 
111 
113 
114  void reset_fade_in_shape_width (std::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
115  void reset_fade_out_shape_width (std::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
116 
119 
120  void set_fade_visibility (bool);
122 
123  void update_transient(float old_pos, float new_pos);
124  void remove_transient(float pos);
125 
127 
129  uint32_t get_fill_color () const;
130 
131  virtual void entered ();
132  virtual void exited ();
133 
135 
136  void drag_start ();
137  void drag_end ();
138 
139  void redraw_start_xfade_to (std::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double);
140  void redraw_end_xfade_to (std::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double, double);
143 
144  void hide_xfades ();
146  void hide_end_xfade ();
147  void show_xfades ();
149  void show_end_xfade ();
150 
151  bool start_xfade_visible () const {
152  return _start_xfade_visible;
153  }
154 
155  bool end_xfade_visible () const {
156  return _end_xfade_visible;
157  }
158 
160 
161 protected:
162 
163  /* this constructor allows derived types
164  * to specify their visibility requirements
165  * to the TimeAxisViewItem parent class
166  */
167 
168  enum Flags {
172  };
173 
174  std::vector<ArdourWaveView::WaveView *> waves;
175  std::vector<ArdourWaveView::WaveView *> tmp_waves;
176 
177  std::list<std::pair<samplepos_t, ArdourCanvas::Line*> > feature_lines;
178 
184 
185  static Cairo::RefPtr<Cairo::Pattern> pending_peak_pattern;
186 
190 
194 
195  std::shared_ptr<RegionFxLine> _fx_line;
196 
198 
206 
208  void region_muted ();
210  void region_renamed ();
211 
212  void create_one_wave (uint32_t, bool);
213  void peaks_ready_handler (uint32_t);
214 
215  void set_colors ();
219 
220  void color_handler ();
221 
223 
225  void _redisplay (bool) {}
226 
227 private:
229 
230  void parameter_changed (std::string const &);
232  void set_some_waveform_colors (std::vector<ArdourWaveView::WaveView*>& waves_to_color);
233 
237  std::vector<PBD::ScopedConnection*> _data_ready_connections;
238 
242  std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
243 
246 
247  void set_region_fx_line (std::shared_ptr<ARDOUR::AutomationControl>, std::shared_ptr<ARDOUR::RegionFxPlugin>, uint32_t);
248 
250  uint32_t _rdx_param;
252 
254 };
255 
256 #endif /* __gtk_ardour_audio_region_view_h__ */
void unhide_envelope()
Dangerous!
void show_region_editor()
virtual void entered()
void set_samples_per_pixel(double)
void reset_fade_out_shape()
void init(bool wait_for_data)
void redraw_start_xfade()
void reset_fade_shapes()
void color_handler()
samplepos_t get_fade_out_shape_width()
void transients_changed()
void update_coverage_frame(LayerDisplay)
void temporarily_hide_envelope()
Dangerous!
std::vector< PBD::ScopedConnection * > _data_ready_connections
bool get_region_fx_line(PBD::ID &, uint32_t &)
void set_frame_color()
void envelope_active_changed()
void hide_start_xfade()
void set_ignore_line_change(bool v)
void remove_transient(float pos)
AudioRegionView(ArdourCanvas::Container *, RouteTimeAxisView &, std::shared_ptr< ARDOUR::AudioRegion >, double samples_per_pixel, uint32_t base_color, bool recording, TimeAxisViewItem::Visibility)
ArdourCanvas::Rectangle * pending_peak_data
void fade_out_changed()
void set_region_fx_line(std::shared_ptr< ARDOUR::AutomationControl >, std::shared_ptr< ARDOUR::RegionFxPlugin >, uint32_t)
bool end_xfade_visible() const
void region_resized(const PBD::PropertyChange &)
void set_height(double)
std::shared_ptr< RegionFxLine > fx_line() const
bool start_xfade_visible() const
void hide_end_xfade()
ArdourCanvas::Rectangle * fade_in_trim_handle
fade in trim handle, or 0
AudioRegionView(ArdourCanvas::Container *, RouteTimeAxisView &, std::shared_ptr< ARDOUR::AudioRegion >, double initial_samples_per_pixel, uint32_t base_color)
std::shared_ptr< RegionFxLine > _fx_line
ArdourCanvas::Rectangle * end_xfade_rect
ArdourCanvas::Rectangle * fade_in_handle
fade in handle, or 0
void region_renamed()
void set_fade_visibility(bool)
bool set_region_fx_line(uint32_t, uint32_t)
void setup_waveform_visibility()
bool set_region_fx_line(std::weak_ptr< PBD::Controllable >)
GhostRegion * add_ghost(TimeAxisView &)
ArdourCanvas::XFadeCurve * start_xfade_curve
AudioRegionView(const AudioRegionView &other, std::shared_ptr< ARDOUR::AudioRegion >)
void show_end_xfade()
void parameter_changed(std::string const &)
void region_changed(const PBD::PropertyChange &)
sigc::signal< void > region_line_changed
void set_fx_line_colors()
std::vector< ArdourWaveView::WaveView * > waves
void show_start_xfade()
std::shared_ptr< ARDOUR::AudioRegion > audio_region() const
void setup_fade_handle_positions()
void fade_out_active_changed()
void fade_in_changed()
bool paste(Temporal::timepos_t const &, const Selection &, PasteContext &)
std::vector< ArdourWaveView::WaveView * > tmp_waves
see create_waves()
samplepos_t get_fade_in_shape_width()
std::pair< std::list< AudioRegionView * >, std::list< AudioRegionView * > > _hidden_xfades
void reset_fade_out_shape_width(std::shared_ptr< ARDOUR::AudioRegion > ar, samplecnt_t, bool drag_active=false)
void fade_in_active_changed()
virtual void exited()
void redraw_start_xfade_to(std::shared_ptr< ARDOUR::AudioRegion >, samplecnt_t, ArdourCanvas::Points &, double, double)
ArdourCanvas::XFadeCurve * end_xfade_curve
ArdourCanvas::Rectangle * fade_out_handle
fade out handle, or 0
void region_scale_amplitude_changed()
void create_one_wave(uint32_t, bool)
void set_amplitude_above_axis(gdouble spp)
void redraw_end_xfade_to(std::shared_ptr< ARDOUR::AudioRegion >, samplecnt_t, ArdourCanvas::Points &, double, double, double)
MergeableLine * make_merger()
void redraw_end_xfade()
void add_gain_point_event(ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points)
void update_envelope_visibility()
void reset_fade_in_shape_width(std::shared_ptr< ARDOUR::AudioRegion > ar, samplecnt_t, bool drag_active=false)
static Cairo::RefPtr< Cairo::Pattern > pending_peak_pattern
void set_waveform_colors()
ArdourCanvas::Rectangle * fade_out_trim_handle
fade out trim handle, or 0
void peaks_ready_handler(uint32_t)
PBD::ScopedConnection _region_fx_connection
AutomationLine::VisibleAspects automation_line_visibility() const
void thaw_after_trim()
void set_some_waveform_colors(std::vector< ArdourWaveView::WaveView * > &waves_to_color)
void reset_fade_in_shape()
void set_region_gain_line()
std::list< std::pair< samplepos_t, ArdourCanvas::Line * > > feature_lines
uint32_t get_fill_color() const
ArdourCanvas::Rectangle * start_xfade_rect
void update_transient(float old_pos, float new_pos)
void reset_width_dependent_items(double pixel_width)
Definition: id.h:35
bool wait_for_data
Definition: region_view.h:215
Lists of selected things.
LayerDisplay
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t
std::vector< Duple > Points
int pixel_width(const std::string &str, const Pango::FontDescription &font)