Ardour  9.0-pre0-350-gf17a656217
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 #pragma once
25 
26 #ifdef interface
27 #undef interface
28 #endif
29 
30 #include <vector>
31 
32 #include <sigc++/signal.h>
33 #include "ardour/audioregion.h"
34 
35 #include "canvas/fwd.h"
36 #include "canvas/xfade_curve.h"
37 
38 #include "waveview/wave_view.h"
39 
40 #include "line_merger.h"
41 #include "region_view.h"
42 #include "time_axis_view_item.h"
43 #include "editor_automation_line.h"
44 #include "enums.h"
45 
46 namespace ARDOUR {
47  class AudioRegion;
48  struct PeakData;
49 };
50 
51 class AudioTimeAxisView;
52 class GhostRegion;
54 class RegionFxLine;
55 class RouteTimeAxisView;
56 class PasteContext;
57 
58 class AudioRegionView : public RegionView, public LineMerger
59 {
60 public:
63  std::shared_ptr<ARDOUR::AudioRegion>,
64  double initial_samples_per_pixel,
65  uint32_t base_color);
66 
69  std::shared_ptr<ARDOUR::AudioRegion>,
70  double samples_per_pixel,
71  uint32_t base_color,
72  bool recording,
74 
75  AudioRegionView (const AudioRegionView& other, std::shared_ptr<ARDOUR::AudioRegion>);
76 
78 
79  void init (bool wait_for_data);
80 
81  std::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
82 
83  void create_waves ();
84  void delete_waves ();
85 
86  void set_height (double);
87  void set_samples_per_pixel (double);
88 
89  void set_amplitude_above_axis (gdouble spp);
90 
92  void unhide_envelope ();
93 
96  bool set_region_fx_line (uint32_t, uint32_t);
97  bool set_region_fx_line (std::weak_ptr<PBD::Controllable>);
98  bool get_region_fx_line (PBD::ID&, uint32_t&);
101 
102  sigc::signal<void> region_line_changed;
103 
104  void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points);
105 
106  std::shared_ptr<RegionFxLine> fx_line() const { return _fx_line; }
107 
110 
112 
113  void reset_fade_in_shape_width (std::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
114  void reset_fade_out_shape_width (std::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
115 
118 
119  void set_fade_visibility (bool);
121 
122  void update_transient(float old_pos, float new_pos);
123  void remove_transient(float pos);
124 
126 
128  uint32_t get_fill_color () const;
129 
130  virtual void entered ();
131  virtual void exited ();
132 
134 
135  void drag_start ();
136  void drag_end ();
137 
138  void redraw_start_xfade_to (std::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double);
139  void redraw_end_xfade_to (std::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double, double);
142 
143  void hide_xfades ();
145  void hide_end_xfade ();
146  void show_xfades ();
148  void show_end_xfade ();
149 
150  bool start_xfade_visible () const {
151  return _start_xfade_visible;
152  }
153 
154  bool end_xfade_visible () const {
155  return _end_xfade_visible;
156  }
157 
159 
160 protected:
161 
162  /* this constructor allows derived types
163  * to specify their visibility requirements
164  * to the TimeAxisViewItem parent class
165  */
166 
167  enum Flags {
171  };
172 
173  std::vector<ArdourWaveView::WaveView *> waves;
174  std::vector<ArdourWaveView::WaveView *> tmp_waves;
175 
176  std::list<std::pair<samplepos_t, ArdourCanvas::Line*> > feature_lines;
177 
183 
184  static Cairo::RefPtr<Cairo::Pattern> pending_peak_pattern;
185 
189 
193 
194  std::shared_ptr<RegionFxLine> _fx_line;
195 
197 
205 
207  void region_muted ();
209  void region_renamed ();
210 
211  void create_one_wave (uint32_t, bool);
212  void peaks_ready_handler (uint32_t);
213 
214  void set_colors ();
218 
219  void color_handler ();
220 
222 
224  void redisplay (bool) {}
225 
226 private:
228 
229  void parameter_changed (std::string const &);
231  void set_some_waveform_colors (std::vector<ArdourWaveView::WaveView*>& waves_to_color);
232 
236  std::vector<PBD::ScopedConnection*> _data_ready_connections;
237 
241  std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
242 
245 
246  void set_region_fx_line (std::shared_ptr<ARDOUR::AutomationControl>, std::shared_ptr<ARDOUR::RegionFxPlugin>, uint32_t);
247 
249  uint32_t _rdx_param;
251 
253 };
254 
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()
EditorAutomationLine::VisibleAspects automation_line_visibility() const
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
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:34
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)