2 Copyright (C) 2001-2006 Paul Davis
4 This program is free software; you can r>edistribute 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.
24 #include <boost/scoped_array.hpp>
28 #include <gtkmm2ext/gtk_ui.h>
30 #include "ardour/playlist.h"
31 #include "ardour/audioregion.h"
32 #include "ardour/audiosource.h"
33 #include "ardour/profile.h"
34 #include "ardour/session.h"
36 #include "pbd/memento_command.h"
37 #include "pbd/stacktrace.h"
39 #include "evoral/Curve.hpp"
41 #include "canvas/rectangle.h"
42 #include "canvas/polygon.h"
43 #include "canvas/poly_line.h"
44 #include "canvas/line.h"
45 #include "canvas/text.h"
46 #include "canvas/xfade_curve.h"
47 #include "canvas/debug.h"
48 #include "canvas/utils.h"
50 #include "streamview.h"
51 #include "audio_region_view.h"
52 #include "audio_time_axis.h"
53 #include "public_editor.h"
54 #include "audio_region_editor.h"
55 #include "audio_streamview.h"
56 #include "region_gain_line.h"
57 #include "control_point.h"
58 #include "ghostregion.h"
59 #include "audio_time_axis.h"
61 #include "rgb_macros.h"
62 #include "gui_thread.h"
63 #include "ardour_ui.h"
67 #define MUTED_ALPHA 48
70 using namespace ARDOUR;
72 using namespace Editing;
73 using namespace ArdourCanvas;
75 static const int32_t sync_mark_width = 9;
76 static double const handle_size = 10; /* height of fade handles */
78 AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
79 Gdk::Color const & basic_color)
80 : RegionView (parent, tv, r, spu, basic_color)
84 , fade_in_trim_handle(0)
85 , fade_out_trim_handle(0)
86 , start_xfade_curve (0)
87 , start_xfade_rect (0)
88 , _start_xfade_visible (false)
91 , _end_xfade_visible (false)
92 , _amplitude_above_axis(1.0)
94 , trim_fade_in_drag_active(false)
95 , trim_fade_out_drag_active(false)
97 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
100 AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
101 Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
102 : RegionView (parent, tv, r, spu, basic_color, recording, visibility)
106 , fade_in_trim_handle(0)
107 , fade_out_trim_handle(0)
108 , start_xfade_curve (0)
109 , start_xfade_rect (0)
110 , _start_xfade_visible (false)
111 , end_xfade_curve (0)
113 , _end_xfade_visible (false)
114 , _amplitude_above_axis(1.0)
116 , trim_fade_in_drag_active(false)
117 , trim_fade_out_drag_active(false)
119 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
122 AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_ptr<AudioRegion> other_region)
123 : RegionView (other, boost::shared_ptr<Region> (other_region))
126 , fade_in_trim_handle(0)
127 , fade_out_trim_handle(0)
128 , start_xfade_curve (0)
129 , start_xfade_rect (0)
130 , _start_xfade_visible (false)
131 , end_xfade_curve (0)
133 , _end_xfade_visible (false)
134 , _amplitude_above_axis (other._amplitude_above_axis)
136 , trim_fade_in_drag_active(false)
137 , trim_fade_out_drag_active(false)
142 UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
143 c.set_rgb_p (r/255.0, g/255.0, b/255.0);
147 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
151 AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
153 // FIXME: Some redundancy here with RegionView::init. Need to figure out
154 // where order is important and where it isn't...
156 RegionView::init (basic_color, wfd);
158 _amplitude_above_axis = 1.0;
160 compute_colors (basic_color);
165 fade_in_handle = new ArdourCanvas::Rectangle (group);
166 CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name()));
167 fade_in_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
168 fade_in_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
169 fade_in_handle->set_data ("regionview", this);
170 fade_in_handle->hide ();
172 fade_out_handle = new ArdourCanvas::Rectangle (group);
173 CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name()));
174 fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
175 fade_out_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
176 fade_out_handle->set_data ("regionview", this);
177 fade_out_handle->hide ();
179 fade_in_trim_handle = new ArdourCanvas::Rectangle (group);
180 CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in trim handle for %1", region()->name()));
181 fade_in_trim_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
182 fade_in_trim_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
183 fade_in_trim_handle->set_data ("regionview", this);
184 fade_in_trim_handle->hide ();
186 fade_out_trim_handle = new ArdourCanvas::Rectangle (group);
187 CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out trim handle for %1", region()->name()));
188 fade_out_trim_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
189 fade_out_trim_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
190 fade_out_trim_handle->set_data ("regionview", this);
191 fade_out_trim_handle->hide ();
194 setup_fade_handle_positions ();
196 if (!trackview.session()->config.get_show_region_fades()) {
197 set_fade_visibility (false);
200 const string line_name = _region->name() + ":gain";
202 if (!Profile->get_sae()) {
203 gain_line.reset (new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope()));
206 update_envelope_visibility ();
209 set_height (trackview.current_height());
212 region_sync_changed ();
214 region_resized (ARDOUR::bounds_change);
216 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
217 (*i)->set_duration (_region->length() / samples_per_pixel);
221 envelope_active_changed ();
222 fade_in_active_changed ();
223 fade_out_active_changed ();
225 reset_width_dependent_items (_pixel_width);
227 if (fade_in_handle) {
228 fade_in_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this, false));
231 if (fade_out_handle) {
232 fade_out_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this, false));
235 if (fade_in_trim_handle) {
236 fade_in_trim_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_trim_handle, this, true));
239 if (fade_out_trim_handle) {
240 fade_out_trim_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_trim_handle, this, true));
245 setup_waveform_visibility ();
247 if (frame_handle_start) {
248 frame_handle_start->raise_to_top ();
250 if (frame_handle_end) {
251 frame_handle_end->raise_to_top ();
254 /* XXX sync mark drag? */
257 AudioRegionView::~AudioRegionView ()
259 in_destructor = true;
261 RegionViewGoingAway (this); /* EMIT_SIGNAL */
263 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
267 for (list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
268 delete ((*i).second);
271 /* all waveviews etc will be destroyed when the group is destroyed */
274 boost::shared_ptr<ARDOUR::AudioRegion>
275 AudioRegionView::audio_region() const
277 // "Guaranteed" to succeed...
278 return boost::dynamic_pointer_cast<AudioRegion>(_region);
282 AudioRegionView::region_changed (const PropertyChange& what_changed)
284 ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed);
286 RegionView::region_changed (what_changed);
288 if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
289 region_scale_amplitude_changed ();
291 if (what_changed.contains (ARDOUR::Properties::fade_in)) {
294 if (what_changed.contains (ARDOUR::Properties::fade_out)) {
297 if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
298 fade_in_active_changed ();
300 if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
301 fade_out_active_changed ();
303 if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
304 envelope_active_changed ();
306 if (what_changed.contains (ARDOUR::Properties::valid_transients)) {
307 transients_changed ();
312 AudioRegionView::fade_in_changed ()
314 reset_fade_in_shape ();
318 AudioRegionView::fade_out_changed ()
320 reset_fade_out_shape ();
324 AudioRegionView::fade_in_active_changed ()
326 if (start_xfade_rect) {
327 if (audio_region()->fade_in_active()) {
328 start_xfade_rect->set_fill (false);
330 start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveCrossfade());
331 start_xfade_rect->set_fill (true);
337 AudioRegionView::fade_out_active_changed ()
339 if (end_xfade_rect) {
340 if (audio_region()->fade_out_active()) {
341 end_xfade_rect->set_fill (false);
343 end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveCrossfade());
344 end_xfade_rect->set_fill (true);
351 AudioRegionView::region_scale_amplitude_changed ()
353 for (uint32_t n = 0; n < waves.size(); ++n) {
354 waves[n]->gain_changed ();
359 AudioRegionView::region_renamed ()
361 std::string str = RegionView::make_name ();
363 if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
364 str = string ("*") + str;
367 if (_region->muted()) {
368 str = string ("!") + str;
371 set_item_name (str, this);
376 AudioRegionView::region_resized (const PropertyChange& what_changed)
378 AudioGhostRegion* agr;
380 RegionView::region_resized(what_changed);
381 PropertyChange interesting_stuff;
383 interesting_stuff.add (ARDOUR::Properties::start);
384 interesting_stuff.add (ARDOUR::Properties::length);
386 if (what_changed.contains (interesting_stuff)) {
388 for (uint32_t n = 0; n < waves.size(); ++n) {
389 waves[n]->region_resized ();
392 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
393 if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
395 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
396 (*w)->region_resized ();
401 /* hide transient lines that extend beyond the region end */
403 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
405 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
406 if (l->first > _region->length() - 1) {
416 AudioRegionView::reset_width_dependent_items (double pixel_width)
418 RegionView::reset_width_dependent_items(pixel_width);
419 assert(_pixel_width == pixel_width);
421 if (pixel_width <= 6.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
422 if (fade_in_handle) { fade_in_handle->hide(); }
423 if (fade_out_handle) { fade_out_handle->hide(); }
424 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
425 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
426 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
427 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
430 AnalysisFeatureList analysis_features = _region->transients();
431 AnalysisFeatureList::const_iterator i;
433 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
435 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
437 float x_pos = trackview.editor().sample_to_pixel (*i);
439 (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
440 ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
444 (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
445 ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
448 reset_fade_shapes ();
452 AudioRegionView::region_muted ()
454 RegionView::region_muted();
455 set_waveform_colors ();
459 AudioRegionView::setup_fade_handle_positions()
461 /* position of fade handle offset from the top of the region view */
462 double const handle_pos = 0.0;
464 if (fade_in_handle) {
465 fade_in_handle->set_y0 (handle_pos);
466 fade_in_handle->set_y1 (handle_pos + handle_size);
469 if (fade_out_handle) {
470 fade_out_handle->set_y0 (handle_pos);
471 fade_out_handle->set_y1 (handle_pos + handle_size);
474 if (fade_in_trim_handle) {
475 fade_in_trim_handle->set_y0 (_height - handle_size);
476 fade_in_trim_handle->set_y1 (_height);
479 if (fade_out_trim_handle) {
480 fade_out_trim_handle->set_y0 (_height - handle_size );
481 fade_out_trim_handle->set_y1 (_height);
486 AudioRegionView::set_height (gdouble height)
488 RegionView::set_height (height);
490 uint32_t wcnt = waves.size();
492 for (uint32_t n = 0; n < wcnt; ++n) {
495 if (height < NAME_HIGHLIGHT_THRESH) {
496 ht = ((height - 2 * wcnt) / (double) wcnt);
498 ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
501 gdouble yoff = n * (ht + 1);
503 waves[n]->set_height (ht);
504 waves[n]->set_y_position (yoff + 2);
509 if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
512 update_envelope_visibility ();
515 gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2);
518 reset_fade_shapes ();
520 /* Update hights for any active feature lines */
521 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
523 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
525 float pos_x = trackview.editor().sample_to_pixel((*l).first);
527 if (height >= NAME_HIGHLIGHT_THRESH) {
528 (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
529 ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
531 (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
532 ArdourCanvas::Duple (pos_x, _height - 1));
537 name_text->raise_to_top();
540 setup_fade_handle_positions();
544 AudioRegionView::reset_fade_shapes ()
546 if (!trim_fade_in_drag_active) { reset_fade_in_shape (); }
547 if (!trim_fade_out_drag_active) { reset_fade_out_shape (); }
551 AudioRegionView::reset_fade_in_shape ()
553 reset_fade_in_shape_width (audio_region(), (framecnt_t) audio_region()->fade_in()->back()->when);
557 AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
559 trim_fade_in_drag_active = drag_active;
560 if (fade_in_handle == 0) {
564 /* smallest size for a fade is 64 frames */
566 width = std::max ((framecnt_t) 64, width);
568 /* round here to prevent little visual glitches with sub-pixel placement */
569 double const pwidth = rint (width / samples_per_pixel);
570 double const handle_left = pwidth;
572 /* Put the fade in handle so that its left side is at the end-of-fade line */
573 fade_in_handle->set_x0 (handle_left);
574 fade_in_handle->set_x1 (handle_left + handle_size);
576 if (fade_in_trim_handle) {
577 fade_in_trim_handle->set_x0 (0);
578 fade_in_trim_handle->set_x1 (handle_size);
581 if (fade_in_handle->visible()) {
582 //see comment for drag_start
591 if (!trackview.session()->config.get_show_region_fades()) {
596 double effective_height;
598 if (_height >= NAME_HIGHLIGHT_THRESH) {
599 effective_height = _height - NAME_HIGHLIGHT_SIZE;
601 effective_height = _height;
604 /* points *MUST* be in anti-clockwise order */
607 Points::size_type pi;
608 boost::shared_ptr<const Evoral::ControlList> list (audio_region()->fade_in());
609 Evoral::ControlList::const_iterator x;
610 double length = list->length();
612 points.assign (list->size(), Duple());
614 for (x = list->begin(), pi = 0; x != list->end(); ++x, ++pi) {
615 points[pi].x = 1.0 + (pwidth * ((*x)->when/length));
616 points[pi].y = effective_height - ((*x)->value * effective_height);
621 redraw_start_xfade_to (ar, width, points, effective_height, handle_left);
623 /* ensure trim handle stays on top */
624 if (frame_handle_start) {
625 frame_handle_start->raise_to_top();
630 AudioRegionView::reset_fade_out_shape ()
632 reset_fade_out_shape_width (audio_region(), (framecnt_t) audio_region()->fade_out()->back()->when);
636 AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
638 trim_fade_out_drag_active = drag_active;
639 if (fade_out_handle == 0) {
643 /* smallest size for a fade is 64 frames */
645 width = std::max ((framecnt_t) 64, width);
647 double const pwidth = rint(trackview.editor().sample_to_pixel (width));
649 /* the right edge should be right on the region frame is the pixel
650 * width is zero. Hence the additional + 1.0 at the end.
653 double const handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT - pwidth);
654 double const trim_handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT);
656 /* Put the fade out handle so that its right side is at the end-of-fade line;
658 fade_out_handle->set_x0 (1 + handle_right - handle_size);
659 fade_out_handle->set_x1 (1 + handle_right);
660 if (fade_out_trim_handle) {
661 fade_out_trim_handle->set_x0 (1 + trim_handle_right - handle_size);
662 fade_out_trim_handle->set_x1 (1 + trim_handle_right);
665 if (fade_out_handle->visible()) {
666 //see comment for drag_start
669 /* don't show shape if its too small */
676 if (!trackview.session()->config.get_show_region_fades()) {
681 double effective_height;
683 if (_height >= NAME_HIGHLIGHT_THRESH) {
684 effective_height = _height - NAME_HIGHLIGHT_SIZE;
686 effective_height = _height;
689 /* points *MUST* be in anti-clockwise order */
692 Points::size_type pi;
693 boost::shared_ptr<const Evoral::ControlList> list (audio_region()->fade_out());
694 Evoral::ControlList::const_iterator x;
695 double length = list->length();
697 points.assign (list->size(), Duple());
699 for (x = list->begin(), pi = 0; x != list->end(); ++x, ++pi) {
700 points[pi].x = 1.0 + _pixel_width - pwidth + (pwidth * ((*x)->when/length));
701 points[pi].y = effective_height - ((*x)->value * effective_height);
706 redraw_end_xfade_to (ar, width, points, effective_height, handle_right, pwidth);
708 /* ensure trim handle stays on top */
709 if (frame_handle_end) {
710 frame_handle_end->raise_to_top();
715 AudioRegionView::get_fade_in_shape_width ()
717 return audio_region()->fade_in()->back()->when;
721 AudioRegionView::get_fade_out_shape_width ()
723 return audio_region()->fade_out()->back()->when;
728 AudioRegionView::redraw_start_xfade ()
730 boost::shared_ptr<AudioRegion> ar (audio_region());
732 if (!ar->fade_in() || ar->fade_in()->empty()) {
737 reset_fade_in_shape_width (ar, ar->fade_in()->back()->when);
741 AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t /*width*/, Points& points, double effective_height,
744 if (points.size() < 2) {
748 if (!start_xfade_curve) {
749 start_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::Start);
750 CANVAS_DEBUG_NAME (start_xfade_curve, string_compose ("xfade start out line for %1", region()->name()));
751 start_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
752 start_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
753 start_xfade_curve->set_ignore_events (true);
755 if (!start_xfade_rect) {
756 start_xfade_rect = new ArdourCanvas::Rectangle (group);
757 CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name()));
758 start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
759 start_xfade_rect->set_fill (false);
760 start_xfade_rect->set_outline (false);
761 start_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT));
762 start_xfade_rect->set_outline_width (0.5);
763 start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
764 start_xfade_rect->set_data ("regionview", this);
767 start_xfade_rect->set (ArdourCanvas::Rect (0.0, 0.0, rect_width, effective_height));
771 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in ();
773 Points::size_type npoints;
777 /* there is no explicit inverse fade in curve, so take the
778 * regular fade in curve given to use as "points" (already a
779 * set of coordinates), and convert to the inverse shape.
782 npoints = points.size();
783 ipoints.assign (npoints, Duple());
785 for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
786 ArdourCanvas::Duple &p (ipoints[pci]);
787 /* leave x-axis alone but invert with respect to y-axis */
788 p.y = effective_height - points[pci].y;
793 /* there is an explicit inverse fade in curve. Grab the points
794 and convert them into coordinates for the inverse fade in
798 npoints = inverse->size();
799 ipoints.assign (npoints, Duple());
801 Evoral::ControlList::const_iterator x;
802 Points::size_type pi;
803 double length = inverse->length();
805 for (x = inverse->begin(), pi = 0; x != inverse->end(); ++x, ++pi) {
806 ArdourCanvas::Duple& p (ipoints[pi]);
807 p.x = 1.0 + (rect_width * ((*x)->when/length));
808 p.y = effective_height - ((*x)->value * effective_height);
812 start_xfade_curve->set_inout (points, ipoints);
818 AudioRegionView::redraw_end_xfade ()
820 boost::shared_ptr<AudioRegion> ar (audio_region());
822 if (!ar->fade_out() || ar->fade_out()->empty()) {
828 reset_fade_out_shape_width (ar, ar->fade_out()->back()->when);
832 AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t width, Points& points, double effective_height,
833 double rect_edge, double rect_width)
835 if (points.size() < 2) {
839 if (!end_xfade_curve) {
840 end_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::End);
841 CANVAS_DEBUG_NAME (end_xfade_curve, string_compose ("xfade end out line for %1", region()->name()));
842 end_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
843 end_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
844 end_xfade_curve->set_ignore_events (true);
847 if (!end_xfade_rect) {
848 end_xfade_rect = new ArdourCanvas::Rectangle (group);
849 CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name()));
850 end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
851 end_xfade_rect->set_fill (false);
852 end_xfade_rect->set_outline (false);
853 end_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT));
854 end_xfade_rect->set_outline_width (0.5);
855 end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
856 end_xfade_rect->set_data ("regionview", this);
859 end_xfade_rect->set (ArdourCanvas::Rect (rect_edge, 0.0, rect_edge + rect_width + TimeAxisViewItem::RIGHT_EDGE_SHIFT, effective_height));
863 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
865 Points::size_type npoints;
869 /* there is no explicit inverse fade out curve, so take the
870 * regular fade out curve given to use as "points" (already a
871 * set of coordinates), and convert to the inverse shape.
874 npoints = points.size();
875 ipoints.assign (npoints, Duple());
877 Points::size_type pci;
879 for (pci = 0; pci < npoints; ++pci) {
880 ArdourCanvas::Duple &p (ipoints[pci]);
881 p.y = effective_height - points[pci].y;
886 /* there is an explicit inverse fade out curve. Grab the points
887 and convert them into coordinates for the inverse fade out
891 npoints = inverse->size();
892 ipoints.assign (npoints, Duple());
894 const double rend = trackview.editor().sample_to_pixel (_region->length() - width);
896 Evoral::ControlList::const_iterator x;
898 Points::size_type pi;
899 double length = inverse->length();
901 for (x = inverse->begin(), i = 0, pi = 0; x != inverse->end(); ++x, ++pi, ++i) {
902 ArdourCanvas::Duple& p (ipoints[pi]);
903 p.x = 1.0 + (rect_width * ((*x)->when/length)) + rend;
904 p.y = effective_height - ((*x)->value * effective_height);
908 end_xfade_curve->set_inout (ipoints, points);
914 AudioRegionView::hide_xfades ()
921 AudioRegionView::hide_start_xfade ()
923 if (start_xfade_curve) {
924 start_xfade_curve->hide();
926 if (start_xfade_rect) {
927 start_xfade_rect->hide ();
930 _start_xfade_visible = false;
934 AudioRegionView::hide_end_xfade ()
936 if (end_xfade_curve) {
937 end_xfade_curve->hide();
939 if (end_xfade_rect) {
940 end_xfade_rect->hide ();
943 _end_xfade_visible = false;
947 AudioRegionView::show_start_xfade ()
949 if (start_xfade_curve) {
950 start_xfade_curve->show();
952 if (start_xfade_rect) {
953 start_xfade_rect->show ();
956 _start_xfade_visible = true;
960 AudioRegionView::show_end_xfade ()
962 if (end_xfade_curve) {
963 end_xfade_curve->show();
965 if (end_xfade_rect) {
966 end_xfade_rect->show ();
969 _end_xfade_visible = true;
973 AudioRegionView::set_samples_per_pixel (gdouble fpp)
975 RegionView::set_samples_per_pixel (fpp);
977 if (Config->get_show_waveforms ()) {
978 for (uint32_t n = 0; n < waves.size(); ++n) {
979 waves[n]->set_samples_per_pixel (fpp);
987 reset_fade_shapes ();
991 AudioRegionView::set_amplitude_above_axis (gdouble a)
993 for (uint32_t n=0; n < waves.size(); ++n) {
994 waves[n]->set_amplitude_above_axis (a);
999 AudioRegionView::compute_colors (Gdk::Color const & basic_color)
1001 RegionView::compute_colors (basic_color);
1003 /* gain color computed in envelope_active_changed() */
1005 fade_color = UINT_RGBA_CHANGE_A (fill_color, 120);
1009 AudioRegionView::set_colors ()
1011 RegionView::set_colors();
1014 gain_line->set_line_color (audio_region()->envelope_active() ?
1015 ARDOUR_UI::config()->get_canvasvar_GainLine() :
1016 ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
1019 set_waveform_colors ();
1021 if (start_xfade_curve) {
1022 start_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
1023 start_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1025 if (end_xfade_curve) {
1026 end_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
1027 end_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1030 if (start_xfade_rect) {
1031 start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1033 if (end_xfade_rect) {
1034 end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1039 AudioRegionView::setup_waveform_visibility ()
1041 if (Config->get_show_waveforms ()) {
1042 for (uint32_t n = 0; n < waves.size(); ++n) {
1043 /* make sure the zoom level is correct, since we don't update
1044 this when waveforms are hidden.
1047 // waves[n]->set_samples_per_pixel (_samples_per_pixel);
1051 for (uint32_t n = 0; n < waves.size(); ++n) {
1058 AudioRegionView::temporarily_hide_envelope ()
1066 AudioRegionView::unhide_envelope ()
1068 update_envelope_visibility ();
1072 AudioRegionView::update_envelope_visibility ()
1078 if (Config->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseGain) {
1079 gain_line->add_visibility (AutomationLine::Line);
1086 AudioRegionView::create_waves ()
1088 // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
1089 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
1095 ChanCount nchans = atv.track()->n_channels();
1097 // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data
1098 // << " and channels = " << nchans.n_audio() << endl;
1100 /* in tmp_waves, set up null pointers for each channel so the vector is allocated */
1101 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
1102 tmp_waves.push_back (0);
1105 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
1109 _data_ready_connections.clear ();
1111 for (uint32_t i = 0; i < nchans.n_audio(); ++i) {
1112 _data_ready_connections.push_back (0);
1115 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
1117 if (n >= audio_region()->n_channels()) {
1121 // cerr << "\tchannel " << n << endl;
1123 if (wait_for_data) {
1124 if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), &_data_ready_connections[n], gui_context())) {
1125 // cerr << "\tData is ready\n";
1126 create_one_wave (n, true);
1128 // cerr << "\tdata is not ready\n";
1129 // we'll get a PeaksReady signal from the source in the future
1130 // and will call create_one_wave(n) then.
1134 // cerr << "\tdon't delay, display today!\n";
1135 create_one_wave (n, true);
1142 AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
1144 //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
1145 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
1146 uint32_t nchans = atv.track()->n_channels().n_audio();
1148 uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
1151 if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) {
1152 ht = ((trackview.current_height()) / (double) nchans);
1154 ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans);
1157 gdouble yoff = which * ht;
1159 WaveView *wave = new WaveView (group, audio_region ());
1160 CANVAS_DEBUG_NAME (wave, string_compose ("wave view for chn %1 of %2", which, get_item_name()));
1162 wave->set_channel (which);
1163 wave->set_y_position (yoff);
1164 wave->set_height (ht);
1165 wave->set_samples_per_pixel (samples_per_pixel);
1166 wave->set_show_zero_line (true);
1167 wave->set_clip_level (Config->get_waveform_clip_level ());
1169 switch (Config->get_waveform_shape()) {
1171 wave->set_shape (WaveView::Rectified);
1174 wave->set_shape (WaveView::Normal);
1177 wave->set_logscaled (Config->get_waveform_scale() == Logarithmic);
1179 if (!Config->get_show_waveforms ()) {
1183 /* note: calling this function is serialized by the lock
1184 held in the peak building thread that signals that
1185 peaks are ready for use *or* by the fact that it is
1186 called one by one from the GUI thread.
1189 if (which < nchans) {
1190 tmp_waves[which] = wave;
1192 /* n-channel track, >n-channel source */
1195 /* see if we're all ready */
1197 for (n = 0; n < nchans; ++n) {
1198 if (tmp_waves[n] == 0) {
1203 if (n == nwaves && waves.empty()) {
1204 /* all waves are ready */
1205 tmp_waves.resize(nwaves);
1210 /* all waves created, don't hook into peaks ready anymore */
1211 delete _data_ready_connections[which];
1212 _data_ready_connections[which] = 0;
1217 AudioRegionView::peaks_ready_handler (uint32_t which)
1219 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AudioRegionView::create_one_wave, this, which, false));
1220 // cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl;
1224 AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev, bool with_guard_points)
1232 /* don't create points that can't be seen */
1234 update_envelope_visibility ();
1239 item->canvas_to_item (x, y);
1241 framepos_t fx = trackview.editor().pixel_to_sample (x);
1243 if (fx > _region->length()) {
1247 /* compute vertical fractional position */
1249 y = 1.0 - (y / (_height - NAME_HIGHLIGHT_SIZE));
1251 /* map using gain line */
1253 gain_line->view_to_model_coord (x, y);
1255 /* XXX STATEFUL: can't convert to stateful diff until we
1256 can represent automation data with it.
1259 trackview.session()->begin_reversible_command (_("add gain control point"));
1260 XMLNode &before = audio_region()->envelope()->get_state();
1262 if (!audio_region()->envelope_active()) {
1263 XMLNode ®ion_before = audio_region()->get_state();
1264 audio_region()->set_envelope_active(true);
1265 XMLNode ®ion_after = audio_region()->get_state();
1266 trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
1269 audio_region()->envelope()->add (fx, y, with_guard_points);
1271 XMLNode &after = audio_region()->envelope()->get_state();
1272 trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
1273 trackview.session()->commit_reversible_command ();
1277 AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent* /*ev*/)
1279 ControlPoint *cp = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"));
1280 audio_region()->envelope()->erase (cp->model());
1284 AudioRegionView::add_ghost (TimeAxisView& tv)
1286 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&trackview);
1289 double unit_position = _region->position () / samples_per_pixel;
1290 AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
1293 nchans = rtv->track()->n_channels().n_audio();
1295 for (uint32_t n = 0; n < nchans; ++n) {
1297 if (n >= audio_region()->n_channels()) {
1301 WaveView *wave = new WaveView (ghost->group, audio_region());
1302 CANVAS_DEBUG_NAME (wave, string_compose ("ghost wave for %1", get_item_name()));
1304 wave->set_channel (n);
1305 wave->set_samples_per_pixel (samples_per_pixel);
1306 wave->set_amplitude_above_axis (_amplitude_above_axis);
1308 ghost->waves.push_back(wave);
1311 ghost->set_height ();
1312 ghost->set_duration (_region->length() / samples_per_pixel);
1313 ghost->set_colors();
1314 ghosts.push_back (ghost);
1320 AudioRegionView::entered (bool internal_editing)
1322 trackview.editor().set_current_trimmable (_region);
1323 trackview.editor().set_current_movable (_region);
1326 /* these may or may not be visible depending on mouse mode */
1327 gain_line->add_visibility (AutomationLine::ControlPoints);
1330 if (!internal_editing) {
1331 if (start_xfade_rect) {
1332 start_xfade_rect->set_outline (true);
1334 if (end_xfade_rect) {
1335 end_xfade_rect->set_outline (true);
1337 if (fade_in_handle) {
1338 fade_in_handle->show ();
1339 fade_in_handle->raise_to_top ();
1341 if (fade_out_handle) {
1342 fade_out_handle->show ();
1343 fade_out_handle->raise_to_top ();
1345 if (fade_in_trim_handle) {
1346 boost::shared_ptr<AudioRegion> ar (audio_region());
1347 if (!ar->locked() && (ar->fade_in()->back()->when > 64 || (ar->can_trim() & Trimmable::FrontTrimEarlier))) {
1348 fade_in_trim_handle->show ();
1349 fade_in_trim_handle->raise_to_top ();
1351 fade_in_trim_handle->hide ();
1354 if (fade_out_trim_handle) {
1355 boost::shared_ptr<AudioRegion> ar (audio_region());
1356 if (!ar->locked() && (ar->fade_out()->back()->when > 64 || (ar->can_trim() & Trimmable::EndTrimLater))) {
1357 fade_out_trim_handle->show ();
1358 fade_out_trim_handle->raise_to_top ();
1360 fade_out_trim_handle->hide ();
1367 AudioRegionView::exited ()
1369 trackview.editor().set_current_trimmable (boost::shared_ptr<Trimmable>());
1370 trackview.editor().set_current_movable (boost::shared_ptr<Movable>());
1373 gain_line->remove_visibility (AutomationLine::ControlPoints);
1376 if (fade_in_handle) { fade_in_handle->hide(); }
1377 if (fade_out_handle) { fade_out_handle->hide(); }
1378 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
1379 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
1380 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
1381 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
1385 AudioRegionView::envelope_active_changed ()
1388 gain_line->set_line_color (audio_region()->envelope_active() ?
1389 ARDOUR_UI::config()->get_canvasvar_GainLine() :
1390 ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
1391 update_envelope_visibility ();
1396 AudioRegionView::color_handler ()
1398 //case cMutedWaveForm:
1400 //case cWaveFormClip:
1404 //case cGainLineInactive:
1406 envelope_active_changed();
1411 AudioRegionView::set_waveform_colors ()
1413 ArdourCanvas::Color fill;
1414 ArdourCanvas::Color outline;
1415 ArdourCanvas::Color clip = ARDOUR_UI::config()->get_canvasvar_WaveFormClip();
1416 ArdourCanvas::Color zero = ARDOUR_UI::config()->get_canvasvar_ZeroLine();
1419 if (_region->muted()) {
1420 /* hide outline with zero alpha */
1421 outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm(), 0);
1422 fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill(), MUTED_ALPHA);
1424 outline = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
1425 fill = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
1427 if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
1428 /* just use a slightly transparent version of the selected
1429 * color so that some of the track color bleeds through
1431 fill = UINT_RGBA_CHANGE_A (fill, 217);
1436 outline = ARDOUR_UI::config()->get_canvasvar_RecWaveForm();
1437 fill = ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill();
1439 if (_region->muted()) {
1440 /* hide outline with zero alpha */
1441 outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), 0);
1442 fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveFormFill(), MUTED_ALPHA);
1444 outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
1445 fill = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
1447 if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
1448 /* just use a slightly transparent version of the selected
1449 * color so that some of the track color bleeds through
1451 fill = UINT_RGBA_CHANGE_A (fill, 217);
1457 for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
1458 (*w)->set_fill_color (fill);
1459 (*w)->set_outline_color (outline);
1460 (*w)->set_clip_color (clip);
1461 (*w)->set_zero_color (zero);
1466 AudioRegionView::set_frame_color ()
1472 RegionView::set_frame_color ();
1474 set_waveform_colors ();
1478 AudioRegionView::set_fade_visibility (bool yn)
1481 if (start_xfade_curve) { start_xfade_curve->show (); }
1482 if (end_xfade_curve) { end_xfade_curve->show (); }
1483 if (start_xfade_rect) { start_xfade_rect->show (); }
1484 if (end_xfade_rect) { end_xfade_rect->show (); }
1486 if (start_xfade_curve) { start_xfade_curve->hide(); }
1487 if (end_xfade_curve) { end_xfade_curve->hide(); }
1488 if (fade_in_handle) { fade_in_handle->hide(); }
1489 if (fade_out_handle) { fade_out_handle->hide(); }
1490 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
1491 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
1492 if (start_xfade_rect) { start_xfade_rect->hide (); }
1493 if (end_xfade_rect) { end_xfade_rect->hide (); }
1494 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
1495 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
1500 AudioRegionView::update_coverage_frames (LayerDisplay d)
1502 RegionView::update_coverage_frames (d);
1504 if (fade_in_handle) { fade_in_handle->raise_to_top (); }
1505 if (fade_out_handle) { fade_out_handle->raise_to_top (); }
1506 if (fade_in_trim_handle) { fade_in_trim_handle->raise_to_top (); }
1507 if (fade_out_trim_handle) { fade_out_trim_handle->raise_to_top (); }
1511 AudioRegionView::show_region_editor ()
1514 editor = new AudioRegionEditor (trackview.session(), audio_region());
1522 AudioRegionView::transients_changed ()
1524 AnalysisFeatureList analysis_features = _region->transients();
1526 while (feature_lines.size() < analysis_features.size()) {
1528 ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(group);
1529 CANVAS_DEBUG_NAME (canvas_item, string_compose ("transient group for %1", region()->name()));
1531 canvas_item->set (ArdourCanvas::Duple (-1.0, 2.0),
1532 ArdourCanvas::Duple (1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1534 canvas_item->raise_to_top ();
1535 canvas_item->show ();
1537 canvas_item->set_data ("regionview", this);
1538 canvas_item->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
1540 feature_lines.push_back (make_pair(0, canvas_item));
1543 while (feature_lines.size() > analysis_features.size()) {
1544 ArdourCanvas::Line* line = feature_lines.back().second;
1545 feature_lines.pop_back ();
1549 AnalysisFeatureList::const_iterator i;
1550 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1552 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
1554 float *pos = new float;
1555 *pos = trackview.editor().sample_to_pixel (*i);
1558 ArdourCanvas::Duple (*pos, 2.0),
1559 ArdourCanvas::Duple (*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)
1562 (*l).second->set_data ("position", pos);
1568 AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
1570 /* Find frame at old pos, calulate new frame then update region transients*/
1571 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1573 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1575 /* Line has been updated in drag so we compare to new_pos */
1577 float* pos = (float*) (*l).second->get_data ("position");
1579 if (rint(new_pos) == rint(*pos)) {
1581 framepos_t old_frame = (*l).first;
1582 framepos_t new_frame = trackview.editor().pixel_to_sample (new_pos);
1584 _region->update_transient (old_frame, new_frame);
1592 AudioRegionView::remove_transient(float pos)
1594 /* Find frame at old pos, calulate new frame then update region transients*/
1595 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1597 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1599 /* Line has been updated in drag so we compare to new_pos */
1600 float *line_pos = (float*) (*l).second->get_data ("position");
1602 if (rint(pos) == rint(*line_pos)) {
1603 _region->remove_transient ((*l).first);
1610 AudioRegionView::thaw_after_trim ()
1612 RegionView::thaw_after_trim ();
1619 AudioRegionView::show_xfades ()
1621 show_start_xfade ();
1626 AudioRegionView::drag_start ()
1628 TimeAxisViewItem::drag_start ();
1630 //we used to hide xfades here. I don't see the point with the new model, but we can re-implement if needed
1634 AudioRegionView::drag_end ()
1636 TimeAxisViewItem::drag_end ();
1637 //see comment for drag_start
1639 if (fade_in_handle && fade_in_handle->visible()) {
1640 // lenght of region or fade changed, re-check
1641 // if fade_in_trim_handle or fade_out_trim_handle should
1642 // be visible. -- If the fade_in_handle is visible
1643 // we have focus and are not in internal edit mode.
1649 AudioRegionView::parameter_changed (string const & p)
1651 if (p == "show-waveforms") {
1652 setup_waveform_visibility ();