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"
60 #include "rgb_macros.h"
61 #include "gui_thread.h"
62 #include "ardour_ui.h"
66 #define MUTED_ALPHA 48
69 using namespace ARDOUR;
71 using namespace Editing;
72 using namespace ArdourCanvas;
74 static const int32_t sync_mark_width = 9;
75 static double const handle_size = 10; /* height of fade handles */
77 AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
79 : RegionView (parent, tv, r, spu, basic_color)
83 , fade_in_trim_handle(0)
84 , fade_out_trim_handle(0)
85 , start_xfade_curve (0)
86 , start_xfade_rect (0)
87 , _start_xfade_visible (false)
90 , _end_xfade_visible (false)
91 , _amplitude_above_axis(1.0)
92 , trim_fade_in_drag_active(false)
93 , trim_fade_out_drag_active(false)
95 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
98 AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
99 uint32_t basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
100 : RegionView (parent, tv, r, spu, basic_color, recording, visibility)
104 , fade_in_trim_handle(0)
105 , fade_out_trim_handle(0)
106 , start_xfade_curve (0)
107 , start_xfade_rect (0)
108 , _start_xfade_visible (false)
109 , end_xfade_curve (0)
111 , _end_xfade_visible (false)
112 , _amplitude_above_axis(1.0)
113 , trim_fade_in_drag_active(false)
114 , trim_fade_out_drag_active(false)
116 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
119 AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_ptr<AudioRegion> other_region)
120 : RegionView (other, boost::shared_ptr<Region> (other_region))
123 , fade_in_trim_handle(0)
124 , fade_out_trim_handle(0)
125 , start_xfade_curve (0)
126 , start_xfade_rect (0)
127 , _start_xfade_visible (false)
128 , end_xfade_curve (0)
130 , _end_xfade_visible (false)
131 , _amplitude_above_axis (other._amplitude_above_axis)
132 , trim_fade_in_drag_active(false)
133 , trim_fade_out_drag_active(false)
137 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
141 AudioRegionView::init (bool wfd)
143 // FIXME: Some redundancy here with RegionView::init. Need to figure out
144 // where order is important and where it isn't...
146 RegionView::init (wfd);
148 _amplitude_above_axis = 1.0;
153 fade_in_handle = new ArdourCanvas::Rectangle (group);
154 CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name()));
155 fade_in_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
156 fade_in_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
157 fade_in_handle->set_data ("regionview", this);
158 fade_in_handle->hide ();
160 fade_out_handle = new ArdourCanvas::Rectangle (group);
161 CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name()));
162 fade_out_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
163 fade_out_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
164 fade_out_handle->set_data ("regionview", this);
165 fade_out_handle->hide ();
167 fade_in_trim_handle = new ArdourCanvas::Rectangle (group);
168 CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in trim handle for %1", region()->name()));
169 fade_in_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
170 fade_in_trim_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
171 fade_in_trim_handle->set_data ("regionview", this);
172 fade_in_trim_handle->hide ();
174 fade_out_trim_handle = new ArdourCanvas::Rectangle (group);
175 CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out trim handle for %1", region()->name()));
176 fade_out_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
177 fade_out_trim_handle->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
178 fade_out_trim_handle->set_data ("regionview", this);
179 fade_out_trim_handle->hide ();
182 setup_fade_handle_positions ();
184 if (!trackview.session()->config.get_show_region_fades()) {
185 set_fade_visibility (false);
188 const string line_name = _region->name() + ":gain";
190 if (!Profile->get_sae()) {
191 gain_line.reset (new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope()));
194 update_envelope_visibility ();
197 set_height (trackview.current_height());
200 region_sync_changed ();
202 region_resized (ARDOUR::bounds_change);
204 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
205 (*i)->set_duration (_region->length() / samples_per_pixel);
209 envelope_active_changed ();
210 fade_in_active_changed ();
211 fade_out_active_changed ();
213 reset_width_dependent_items (_pixel_width);
215 if (fade_in_handle) {
216 fade_in_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this, false));
219 if (fade_out_handle) {
220 fade_out_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this, false));
223 if (fade_in_trim_handle) {
224 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));
227 if (fade_out_trim_handle) {
228 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));
233 setup_waveform_visibility ();
235 if (frame_handle_start) {
236 frame_handle_start->raise_to_top ();
238 if (frame_handle_end) {
239 frame_handle_end->raise_to_top ();
242 /* XXX sync mark drag? */
245 AudioRegionView::~AudioRegionView ()
247 in_destructor = true;
249 RegionViewGoingAway (this); /* EMIT_SIGNAL */
251 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
255 for (list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
256 delete ((*i).second);
259 /* all waveviews etc will be destroyed when the group is destroyed */
262 boost::shared_ptr<ARDOUR::AudioRegion>
263 AudioRegionView::audio_region() const
265 // "Guaranteed" to succeed...
266 return boost::dynamic_pointer_cast<AudioRegion>(_region);
270 AudioRegionView::region_changed (const PropertyChange& what_changed)
272 ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed);
274 RegionView::region_changed (what_changed);
276 if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
277 region_scale_amplitude_changed ();
279 if (what_changed.contains (ARDOUR::Properties::fade_in)) {
282 if (what_changed.contains (ARDOUR::Properties::fade_out)) {
285 if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
286 fade_in_active_changed ();
288 if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
289 fade_out_active_changed ();
291 if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
292 envelope_active_changed ();
294 if (what_changed.contains (ARDOUR::Properties::valid_transients)) {
295 transients_changed ();
300 AudioRegionView::fade_in_changed ()
302 reset_fade_in_shape ();
306 AudioRegionView::fade_out_changed ()
308 reset_fade_out_shape ();
312 AudioRegionView::fade_in_active_changed ()
314 if (start_xfade_rect) {
315 if (audio_region()->fade_in_active()) {
316 start_xfade_rect->set_fill (false);
318 start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveCrossfade());
319 start_xfade_rect->set_fill (true);
325 AudioRegionView::fade_out_active_changed ()
327 if (end_xfade_rect) {
328 if (audio_region()->fade_out_active()) {
329 end_xfade_rect->set_fill (false);
331 end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveCrossfade());
332 end_xfade_rect->set_fill (true);
339 AudioRegionView::region_scale_amplitude_changed ()
341 for (uint32_t n = 0; n < waves.size(); ++n) {
342 waves[n]->gain_changed ();
347 AudioRegionView::region_renamed ()
349 std::string str = RegionView::make_name ();
351 if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
352 str = string ("*") + str;
355 if (_region->muted()) {
356 str = string ("!") + str;
359 set_item_name (str, this);
364 AudioRegionView::region_resized (const PropertyChange& what_changed)
366 AudioGhostRegion* agr;
368 RegionView::region_resized(what_changed);
369 PropertyChange interesting_stuff;
371 interesting_stuff.add (ARDOUR::Properties::start);
372 interesting_stuff.add (ARDOUR::Properties::length);
374 if (what_changed.contains (interesting_stuff)) {
376 for (uint32_t n = 0; n < waves.size(); ++n) {
377 waves[n]->region_resized ();
380 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
381 if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
383 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
384 (*w)->region_resized ();
389 /* hide transient lines that extend beyond the region end */
391 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
393 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
394 if (l->first > _region->length() - 1) {
404 AudioRegionView::reset_width_dependent_items (double pixel_width)
406 RegionView::reset_width_dependent_items(pixel_width);
407 assert(_pixel_width == pixel_width);
409 if (pixel_width <= 20.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
410 if (fade_in_handle) { fade_in_handle->hide(); }
411 if (fade_out_handle) { fade_out_handle->hide(); }
412 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
413 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
414 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
415 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
418 AnalysisFeatureList analysis_features = _region->transients();
419 AnalysisFeatureList::const_iterator i;
421 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
423 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
425 float x_pos = trackview.editor().sample_to_pixel (*i);
427 (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
428 ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
432 (*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
433 ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
436 reset_fade_shapes ();
440 AudioRegionView::region_muted ()
442 RegionView::region_muted();
443 set_waveform_colors ();
447 AudioRegionView::setup_fade_handle_positions()
449 /* position of fade handle offset from the top of the region view */
450 double const handle_pos = 0.0;
452 if (fade_in_handle) {
453 fade_in_handle->set_y0 (handle_pos);
454 fade_in_handle->set_y1 (handle_pos + handle_size);
457 if (fade_out_handle) {
458 fade_out_handle->set_y0 (handle_pos);
459 fade_out_handle->set_y1 (handle_pos + handle_size);
462 if (fade_in_trim_handle) {
463 fade_in_trim_handle->set_y0 (_height - handle_size);
464 fade_in_trim_handle->set_y1 (_height);
467 if (fade_out_trim_handle) {
468 fade_out_trim_handle->set_y0 (_height - handle_size );
469 fade_out_trim_handle->set_y1 (_height);
474 AudioRegionView::set_height (gdouble height)
476 RegionView::set_height (height);
478 uint32_t wcnt = waves.size();
480 for (uint32_t n = 0; n < wcnt; ++n) {
483 if (height < NAME_HIGHLIGHT_THRESH) {
484 ht = ((height - 2 * wcnt) / (double) wcnt);
486 ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
489 gdouble yoff = n * (ht + 1);
491 waves[n]->set_height (ht);
492 waves[n]->set_y_position (yoff + 2);
497 if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
500 update_envelope_visibility ();
503 gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2);
506 reset_fade_shapes ();
508 /* Update hights for any active feature lines */
509 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
511 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
513 float pos_x = trackview.editor().sample_to_pixel((*l).first);
515 if (height >= NAME_HIGHLIGHT_THRESH) {
516 (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
517 ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
519 (*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
520 ArdourCanvas::Duple (pos_x, _height - 1));
525 name_text->raise_to_top();
528 setup_fade_handle_positions();
532 AudioRegionView::reset_fade_shapes ()
534 if (!trim_fade_in_drag_active) { reset_fade_in_shape (); }
535 if (!trim_fade_out_drag_active) { reset_fade_out_shape (); }
539 AudioRegionView::reset_fade_in_shape ()
541 reset_fade_in_shape_width (audio_region(), (framecnt_t) audio_region()->fade_in()->back()->when);
545 AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
547 trim_fade_in_drag_active = drag_active;
548 if (fade_in_handle == 0) {
552 /* smallest size for a fade is 64 frames */
554 width = std::max ((framecnt_t) 64, width);
556 /* round here to prevent little visual glitches with sub-pixel placement */
557 double const pwidth = rint (width / samples_per_pixel);
558 double const handle_left = pwidth;
560 /* Put the fade in handle so that its left side is at the end-of-fade line */
561 fade_in_handle->set_x0 (handle_left);
562 fade_in_handle->set_x1 (handle_left + handle_size);
564 if (fade_in_trim_handle) {
565 fade_in_trim_handle->set_x0 (0);
566 fade_in_trim_handle->set_x1 (handle_size);
569 if (fade_in_handle->visible()) {
570 //see comment for drag_start
579 if (!trackview.session()->config.get_show_region_fades()) {
584 double effective_height;
586 if (_height >= NAME_HIGHLIGHT_THRESH) {
587 effective_height = _height - NAME_HIGHLIGHT_SIZE;
589 effective_height = _height;
592 /* points *MUST* be in anti-clockwise order */
595 Points::size_type pi;
596 boost::shared_ptr<const Evoral::ControlList> list (audio_region()->fade_in());
597 Evoral::ControlList::const_iterator x;
598 double length = list->length();
600 points.assign (list->size(), Duple());
602 for (x = list->begin(), pi = 0; x != list->end(); ++x, ++pi) {
603 points[pi].x = 1.0 + (pwidth * ((*x)->when/length));
604 points[pi].y = effective_height - ((*x)->value * effective_height);
609 redraw_start_xfade_to (ar, width, points, effective_height, handle_left);
611 /* ensure trim handle stays on top */
612 if (frame_handle_start) {
613 frame_handle_start->raise_to_top();
618 AudioRegionView::reset_fade_out_shape ()
620 reset_fade_out_shape_width (audio_region(), (framecnt_t) audio_region()->fade_out()->back()->when);
624 AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar, framecnt_t width, bool drag_active)
626 trim_fade_out_drag_active = drag_active;
627 if (fade_out_handle == 0) {
631 /* smallest size for a fade is 64 frames */
633 width = std::max ((framecnt_t) 64, width);
635 double const pwidth = rint(trackview.editor().sample_to_pixel (width));
637 /* the right edge should be right on the region frame is the pixel
638 * width is zero. Hence the additional + 1.0 at the end.
641 double const handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT - pwidth);
642 double const trim_handle_right = rint(trackview.editor().sample_to_pixel (_region->length()) + TimeAxisViewItem::RIGHT_EDGE_SHIFT);
644 /* Put the fade out handle so that its right side is at the end-of-fade line;
646 fade_out_handle->set_x0 (1 + handle_right - handle_size);
647 fade_out_handle->set_x1 (1 + handle_right);
648 if (fade_out_trim_handle) {
649 fade_out_trim_handle->set_x0 (1 + trim_handle_right - handle_size);
650 fade_out_trim_handle->set_x1 (1 + trim_handle_right);
653 if (fade_out_handle->visible()) {
654 //see comment for drag_start
657 /* don't show shape if its too small */
664 if (!trackview.session()->config.get_show_region_fades()) {
669 double effective_height;
671 if (_height >= NAME_HIGHLIGHT_THRESH) {
672 effective_height = _height - NAME_HIGHLIGHT_SIZE;
674 effective_height = _height;
677 /* points *MUST* be in anti-clockwise order */
680 Points::size_type pi;
681 boost::shared_ptr<const Evoral::ControlList> list (audio_region()->fade_out());
682 Evoral::ControlList::const_iterator x;
683 double length = list->length();
685 points.assign (list->size(), Duple());
687 for (x = list->begin(), pi = 0; x != list->end(); ++x, ++pi) {
688 points[pi].x = 1.0 + _pixel_width - pwidth + (pwidth * ((*x)->when/length));
689 points[pi].y = effective_height - ((*x)->value * effective_height);
694 redraw_end_xfade_to (ar, width, points, effective_height, handle_right, pwidth);
696 /* ensure trim handle stays on top */
697 if (frame_handle_end) {
698 frame_handle_end->raise_to_top();
703 AudioRegionView::get_fade_in_shape_width ()
705 return audio_region()->fade_in()->back()->when;
709 AudioRegionView::get_fade_out_shape_width ()
711 return audio_region()->fade_out()->back()->when;
716 AudioRegionView::redraw_start_xfade ()
718 boost::shared_ptr<AudioRegion> ar (audio_region());
720 if (!ar->fade_in() || ar->fade_in()->empty()) {
725 reset_fade_in_shape_width (ar, ar->fade_in()->back()->when);
729 AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t /*width*/, Points& points, double effective_height,
732 if (points.size() < 2) {
736 if (!start_xfade_curve) {
737 start_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::Start);
738 CANVAS_DEBUG_NAME (start_xfade_curve, string_compose ("xfade start out line for %1", region()->name()));
739 start_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
740 start_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
741 start_xfade_curve->set_ignore_events (true);
743 if (!start_xfade_rect) {
744 start_xfade_rect = new ArdourCanvas::Rectangle (group);
745 CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name()));
746 start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
747 start_xfade_rect->set_fill (false);
748 start_xfade_rect->set_outline (false);
749 start_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT));
750 start_xfade_rect->set_outline_width (0.5);
751 start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
752 start_xfade_rect->set_data ("regionview", this);
755 start_xfade_rect->set (ArdourCanvas::Rect (0.0, 0.0, rect_width, effective_height));
759 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in ();
761 Points::size_type npoints;
765 /* there is no explicit inverse fade in curve, so take the
766 * regular fade in curve given to use as "points" (already a
767 * set of coordinates), and convert to the inverse shape.
770 npoints = points.size();
771 ipoints.assign (npoints, Duple());
773 for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
774 ArdourCanvas::Duple &p (ipoints[pci]);
775 /* leave x-axis alone but invert with respect to y-axis */
776 p.y = effective_height - points[pci].y;
781 /* there is an explicit inverse fade in curve. Grab the points
782 and convert them into coordinates for the inverse fade in
786 npoints = inverse->size();
787 ipoints.assign (npoints, Duple());
789 Evoral::ControlList::const_iterator x;
790 Points::size_type pi;
791 double length = inverse->length();
793 for (x = inverse->begin(), pi = 0; x != inverse->end(); ++x, ++pi) {
794 ArdourCanvas::Duple& p (ipoints[pi]);
795 p.x = 1.0 + (rect_width * ((*x)->when/length));
796 p.y = effective_height - ((*x)->value * effective_height);
800 start_xfade_curve->set_inout (points, ipoints);
806 AudioRegionView::redraw_end_xfade ()
808 boost::shared_ptr<AudioRegion> ar (audio_region());
810 if (!ar->fade_out() || ar->fade_out()->empty()) {
816 reset_fade_out_shape_width (ar, ar->fade_out()->back()->when);
820 AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t width, Points& points, double effective_height,
821 double rect_edge, double rect_width)
823 if (points.size() < 2) {
827 if (!end_xfade_curve) {
828 end_xfade_curve = new ArdourCanvas::XFadeCurve (group, ArdourCanvas::XFadeCurve::End);
829 CANVAS_DEBUG_NAME (end_xfade_curve, string_compose ("xfade end out line for %1", region()->name()));
830 end_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
831 end_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
832 end_xfade_curve->set_ignore_events (true);
835 if (!end_xfade_rect) {
836 end_xfade_rect = new ArdourCanvas::Rectangle (group);
837 CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name()));
838 end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
839 end_xfade_rect->set_fill (false);
840 end_xfade_rect->set_outline (false);
841 end_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT));
842 end_xfade_rect->set_outline_width (0.5);
843 end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
844 end_xfade_rect->set_data ("regionview", this);
847 end_xfade_rect->set (ArdourCanvas::Rect (rect_edge, 0.0, rect_edge + rect_width + TimeAxisViewItem::RIGHT_EDGE_SHIFT, effective_height));
851 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
853 Points::size_type npoints;
857 /* there is no explicit inverse fade out curve, so take the
858 * regular fade out curve given to use as "points" (already a
859 * set of coordinates), and convert to the inverse shape.
862 npoints = points.size();
863 ipoints.assign (npoints, Duple());
865 Points::size_type pci;
867 for (pci = 0; pci < npoints; ++pci) {
868 ArdourCanvas::Duple &p (ipoints[pci]);
869 p.y = effective_height - points[pci].y;
874 /* there is an explicit inverse fade out curve. Grab the points
875 and convert them into coordinates for the inverse fade out
879 npoints = inverse->size();
880 ipoints.assign (npoints, Duple());
882 const double rend = trackview.editor().sample_to_pixel (_region->length() - width);
884 Evoral::ControlList::const_iterator x;
886 Points::size_type pi;
887 double length = inverse->length();
889 for (x = inverse->begin(), i = 0, pi = 0; x != inverse->end(); ++x, ++pi, ++i) {
890 ArdourCanvas::Duple& p (ipoints[pi]);
891 p.x = 1.0 + (rect_width * ((*x)->when/length)) + rend;
892 p.y = effective_height - ((*x)->value * effective_height);
896 end_xfade_curve->set_inout (ipoints, points);
902 AudioRegionView::hide_xfades ()
909 AudioRegionView::hide_start_xfade ()
911 if (start_xfade_curve) {
912 start_xfade_curve->hide();
914 if (start_xfade_rect) {
915 start_xfade_rect->hide ();
918 _start_xfade_visible = false;
922 AudioRegionView::hide_end_xfade ()
924 if (end_xfade_curve) {
925 end_xfade_curve->hide();
927 if (end_xfade_rect) {
928 end_xfade_rect->hide ();
931 _end_xfade_visible = false;
935 AudioRegionView::show_start_xfade ()
937 if (start_xfade_curve) {
938 start_xfade_curve->show();
940 if (start_xfade_rect) {
941 start_xfade_rect->show ();
944 _start_xfade_visible = true;
948 AudioRegionView::show_end_xfade ()
950 if (end_xfade_curve) {
951 end_xfade_curve->show();
953 if (end_xfade_rect) {
954 end_xfade_rect->show ();
957 _end_xfade_visible = true;
961 AudioRegionView::set_samples_per_pixel (gdouble fpp)
963 RegionView::set_samples_per_pixel (fpp);
965 if (Config->get_show_waveforms ()) {
966 for (uint32_t n = 0; n < waves.size(); ++n) {
967 waves[n]->set_samples_per_pixel (fpp);
975 reset_fade_shapes ();
979 AudioRegionView::set_amplitude_above_axis (gdouble a)
981 for (uint32_t n=0; n < waves.size(); ++n) {
982 waves[n]->set_amplitude_above_axis (a);
987 AudioRegionView::set_colors ()
989 RegionView::set_colors();
992 gain_line->set_line_color (audio_region()->envelope_active() ?
993 ARDOUR_UI::config()->get_canvasvar_GainLine() :
994 ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
997 set_waveform_colors ();
999 if (start_xfade_curve) {
1000 start_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
1001 start_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1003 if (end_xfade_curve) {
1004 end_xfade_curve->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
1005 end_xfade_curve->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1008 if (start_xfade_rect) {
1009 start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1011 if (end_xfade_rect) {
1012 end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
1017 AudioRegionView::setup_waveform_visibility ()
1019 if (Config->get_show_waveforms ()) {
1020 for (uint32_t n = 0; n < waves.size(); ++n) {
1021 /* make sure the zoom level is correct, since we don't update
1022 this when waveforms are hidden.
1025 // waves[n]->set_samples_per_pixel (_samples_per_pixel);
1029 for (uint32_t n = 0; n < waves.size(); ++n) {
1036 AudioRegionView::temporarily_hide_envelope ()
1044 AudioRegionView::unhide_envelope ()
1046 update_envelope_visibility ();
1050 AudioRegionView::update_envelope_visibility ()
1056 if (Config->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseGain || trackview.editor().current_mouse_mode() == Editing::MouseRange ) {
1057 gain_line->add_visibility (AutomationLine::Line);
1064 AudioRegionView::create_waves ()
1066 // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
1067 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
1073 ChanCount nchans = atv.track()->n_channels();
1075 // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data
1076 // << " and channels = " << nchans.n_audio() << endl;
1078 /* in tmp_waves, set up null pointers for each channel so the vector is allocated */
1079 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
1080 tmp_waves.push_back (0);
1083 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
1087 _data_ready_connections.clear ();
1089 for (uint32_t i = 0; i < nchans.n_audio(); ++i) {
1090 _data_ready_connections.push_back (0);
1093 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
1095 if (n >= audio_region()->n_channels()) {
1099 // cerr << "\tchannel " << n << endl;
1101 if (wait_for_data) {
1102 if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), &_data_ready_connections[n], gui_context())) {
1103 // cerr << "\tData is ready\n";
1104 create_one_wave (n, true);
1106 // cerr << "\tdata is not ready\n";
1107 // we'll get a PeaksReady signal from the source in the future
1108 // and will call create_one_wave(n) then.
1112 // cerr << "\tdon't delay, display today!\n";
1113 create_one_wave (n, true);
1120 AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
1122 //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
1123 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
1124 uint32_t nchans = atv.track()->n_channels().n_audio();
1126 uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
1129 if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) {
1130 ht = ((trackview.current_height()) / (double) nchans);
1132 ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans);
1135 gdouble yoff = which * ht;
1137 WaveView *wave = new WaveView (group, audio_region ());
1138 CANVAS_DEBUG_NAME (wave, string_compose ("wave view for chn %1 of %2", which, get_item_name()));
1140 wave->set_channel (which);
1141 wave->set_y_position (yoff);
1142 wave->set_height (ht);
1143 wave->set_samples_per_pixel (samples_per_pixel);
1144 wave->set_show_zero_line (true);
1145 wave->set_clip_level (Config->get_waveform_clip_level ());
1147 wave->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_wave_view_event), wave, this));
1149 switch (Config->get_waveform_shape()) {
1151 wave->set_shape (WaveView::Rectified);
1154 wave->set_shape (WaveView::Normal);
1157 wave->set_logscaled (Config->get_waveform_scale() == Logarithmic);
1159 vector<ArdourCanvas::WaveView*> v;
1161 set_some_waveform_colors (v);
1163 if (!Config->get_show_waveforms ()) {
1167 /* note: calling this function is serialized by the lock
1168 held in the peak building thread that signals that
1169 peaks are ready for use *or* by the fact that it is
1170 called one by one from the GUI thread.
1173 if (which < nchans) {
1174 tmp_waves[which] = wave;
1176 /* n-channel track, >n-channel source */
1179 /* see if we're all ready */
1181 for (n = 0; n < nchans; ++n) {
1182 if (tmp_waves[n] == 0) {
1187 if (n == nwaves && waves.empty()) {
1188 /* all waves are ready */
1189 tmp_waves.resize(nwaves);
1194 /* all waves created, don't hook into peaks ready anymore */
1195 delete _data_ready_connections[which];
1196 _data_ready_connections[which] = 0;
1201 AudioRegionView::peaks_ready_handler (uint32_t which)
1203 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AudioRegionView::create_one_wave, this, which, false));
1204 // cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl;
1208 AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev, bool with_guard_points)
1216 /* don't create points that can't be seen */
1218 update_envelope_visibility ();
1223 item->canvas_to_item (x, y);
1225 framepos_t fx = trackview.editor().pixel_to_sample (x);
1227 if (fx > _region->length()) {
1231 /* compute vertical fractional position */
1233 y = 1.0 - (y / (_height - NAME_HIGHLIGHT_SIZE));
1235 /* map using gain line */
1237 gain_line->view_to_model_coord (x, y);
1239 /* XXX STATEFUL: can't convert to stateful diff until we
1240 can represent automation data with it.
1243 trackview.session()->begin_reversible_command (_("add gain control point"));
1244 XMLNode &before = audio_region()->envelope()->get_state();
1246 if (!audio_region()->envelope_active()) {
1247 XMLNode ®ion_before = audio_region()->get_state();
1248 audio_region()->set_envelope_active(true);
1249 XMLNode ®ion_after = audio_region()->get_state();
1250 trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
1253 audio_region()->envelope()->add (fx, y, with_guard_points);
1255 XMLNode &after = audio_region()->envelope()->get_state();
1256 trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
1257 trackview.session()->commit_reversible_command ();
1261 AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent* /*ev*/)
1263 ControlPoint *cp = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"));
1264 audio_region()->envelope()->erase (cp->model());
1268 AudioRegionView::add_ghost (TimeAxisView& tv)
1270 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&trackview);
1273 double unit_position = _region->position () / samples_per_pixel;
1274 AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
1277 nchans = rtv->track()->n_channels().n_audio();
1279 for (uint32_t n = 0; n < nchans; ++n) {
1281 if (n >= audio_region()->n_channels()) {
1285 WaveView *wave = new WaveView (ghost->group, audio_region());
1286 CANVAS_DEBUG_NAME (wave, string_compose ("ghost wave for %1", get_item_name()));
1288 wave->set_channel (n);
1289 wave->set_samples_per_pixel (samples_per_pixel);
1290 wave->set_amplitude_above_axis (_amplitude_above_axis);
1292 ghost->waves.push_back(wave);
1295 ghost->set_height ();
1296 ghost->set_duration (_region->length() / samples_per_pixel);
1297 ghost->set_colors();
1298 ghosts.push_back (ghost);
1304 AudioRegionView::entered (bool internal_editing)
1306 trackview.editor().set_current_trimmable (_region);
1307 trackview.editor().set_current_movable (_region);
1310 /* these may or may not be visible depending on mouse mode */
1311 gain_line->add_visibility (AutomationLine::ControlPoints);
1314 if (!internal_editing && ( trackview.editor().current_mouse_mode() == Editing::MouseObject ) ) {
1315 if (start_xfade_rect) {
1316 start_xfade_rect->set_outline (true);
1318 if (end_xfade_rect) {
1319 end_xfade_rect->set_outline (true);
1321 if (fade_in_handle) {
1322 fade_in_handle->show ();
1323 fade_in_handle->raise_to_top ();
1325 if (fade_out_handle) {
1326 fade_out_handle->show ();
1327 fade_out_handle->raise_to_top ();
1329 if (fade_in_trim_handle) {
1330 boost::shared_ptr<AudioRegion> ar (audio_region());
1331 if (!ar->locked() && (ar->fade_in()->back()->when > 64 || (ar->can_trim() & Trimmable::FrontTrimEarlier))) {
1332 fade_in_trim_handle->show ();
1333 fade_in_trim_handle->raise_to_top ();
1335 fade_in_trim_handle->hide ();
1338 if (fade_out_trim_handle) {
1339 boost::shared_ptr<AudioRegion> ar (audio_region());
1340 if (!ar->locked() && (ar->fade_out()->back()->when > 64 || (ar->can_trim() & Trimmable::EndTrimLater))) {
1341 fade_out_trim_handle->show ();
1342 fade_out_trim_handle->raise_to_top ();
1344 fade_out_trim_handle->hide ();
1351 AudioRegionView::exited ()
1353 trackview.editor().set_current_trimmable (boost::shared_ptr<Trimmable>());
1354 trackview.editor().set_current_movable (boost::shared_ptr<Movable>());
1357 gain_line->remove_visibility (AutomationLine::ControlPoints);
1360 if (fade_in_handle) { fade_in_handle->hide(); }
1361 if (fade_out_handle) { fade_out_handle->hide(); }
1362 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
1363 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
1364 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
1365 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
1369 AudioRegionView::envelope_active_changed ()
1372 gain_line->set_line_color (audio_region()->envelope_active() ?
1373 ARDOUR_UI::config()->get_canvasvar_GainLine() :
1374 ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
1375 update_envelope_visibility ();
1380 AudioRegionView::color_handler ()
1382 //case cMutedWaveForm:
1384 //case cWaveFormClip:
1388 //case cGainLineInactive:
1390 envelope_active_changed();
1395 AudioRegionView::set_waveform_colors ()
1397 set_some_waveform_colors (waves);
1401 AudioRegionView::set_some_waveform_colors (vector<ArdourCanvas::WaveView*>& waves_to_color)
1403 ArdourCanvas::Color fill;
1404 ArdourCanvas::Color outline;
1405 ArdourCanvas::Color clip = ARDOUR_UI::config()->get_canvasvar_WaveFormClip();
1406 ArdourCanvas::Color zero = ARDOUR_UI::config()->get_canvasvar_ZeroLine();
1409 if (_region->muted()) {
1410 /* hide outline with zero alpha */
1411 outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm(), 0);
1412 fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill(), MUTED_ALPHA);
1414 outline = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
1415 fill = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
1417 if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
1418 /* just use a slightly transparent version of the selected
1419 * color so that some of the track color bleeds through
1421 fill = UINT_RGBA_CHANGE_A (fill, 217);
1426 outline = ARDOUR_UI::config()->get_canvasvar_RecWaveForm();
1427 fill = ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill();
1429 if (_region->muted()) {
1430 /* hide outline with zero alpha */
1431 outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), 0);
1432 fill = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveFormFill(), MUTED_ALPHA);
1434 outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
1435 fill = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
1437 if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
1438 /* just use a slightly transparent version of the selected
1439 * color so that some of the track color bleeds through
1441 fill = UINT_RGBA_CHANGE_A (fill, 217);
1447 for (vector<ArdourCanvas::WaveView*>::iterator w = waves_to_color.begin(); w != waves_to_color.end(); ++w) {
1448 (*w)->set_fill_color (fill);
1449 (*w)->set_outline_color (outline);
1450 (*w)->set_clip_color (clip);
1451 (*w)->set_zero_color (zero);
1456 AudioRegionView::set_frame_color ()
1462 RegionView::set_frame_color ();
1464 set_waveform_colors ();
1468 AudioRegionView::set_fade_visibility (bool yn)
1471 if (start_xfade_curve) { start_xfade_curve->show (); }
1472 if (end_xfade_curve) { end_xfade_curve->show (); }
1473 if (start_xfade_rect) { start_xfade_rect->show (); }
1474 if (end_xfade_rect) { end_xfade_rect->show (); }
1476 if (start_xfade_curve) { start_xfade_curve->hide(); }
1477 if (end_xfade_curve) { end_xfade_curve->hide(); }
1478 if (fade_in_handle) { fade_in_handle->hide(); }
1479 if (fade_out_handle) { fade_out_handle->hide(); }
1480 if (fade_in_trim_handle) { fade_in_trim_handle->hide(); }
1481 if (fade_out_trim_handle) { fade_out_trim_handle->hide(); }
1482 if (start_xfade_rect) { start_xfade_rect->hide (); }
1483 if (end_xfade_rect) { end_xfade_rect->hide (); }
1484 if (start_xfade_rect) { start_xfade_rect->set_outline (false); }
1485 if (end_xfade_rect) { end_xfade_rect->set_outline (false); }
1490 AudioRegionView::update_coverage_frames (LayerDisplay d)
1492 RegionView::update_coverage_frames (d);
1494 if (fade_in_handle) { fade_in_handle->raise_to_top (); }
1495 if (fade_out_handle) { fade_out_handle->raise_to_top (); }
1496 if (fade_in_trim_handle) { fade_in_trim_handle->raise_to_top (); }
1497 if (fade_out_trim_handle) { fade_out_trim_handle->raise_to_top (); }
1501 AudioRegionView::show_region_editor ()
1504 editor = new AudioRegionEditor (trackview.session(), audio_region());
1512 AudioRegionView::transients_changed ()
1514 AnalysisFeatureList analysis_features = _region->transients();
1516 while (feature_lines.size() < analysis_features.size()) {
1518 ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(group);
1519 CANVAS_DEBUG_NAME (canvas_item, string_compose ("transient group for %1", region()->name()));
1521 canvas_item->set (ArdourCanvas::Duple (-1.0, 2.0),
1522 ArdourCanvas::Duple (1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1524 canvas_item->raise_to_top ();
1525 canvas_item->show ();
1527 canvas_item->set_data ("regionview", this);
1528 canvas_item->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
1530 feature_lines.push_back (make_pair(0, canvas_item));
1533 while (feature_lines.size() > analysis_features.size()) {
1534 ArdourCanvas::Line* line = feature_lines.back().second;
1535 feature_lines.pop_back ();
1539 AnalysisFeatureList::const_iterator i;
1540 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1542 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
1544 float *pos = new float;
1545 *pos = trackview.editor().sample_to_pixel (*i);
1548 ArdourCanvas::Duple (*pos, 2.0),
1549 ArdourCanvas::Duple (*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)
1552 (*l).second->set_data ("position", pos);
1558 AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
1560 /* Find frame at old pos, calulate new frame then update region transients*/
1561 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1563 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1565 /* Line has been updated in drag so we compare to new_pos */
1567 float* pos = (float*) (*l).second->get_data ("position");
1569 if (rint(new_pos) == rint(*pos)) {
1571 framepos_t old_frame = (*l).first;
1572 framepos_t new_frame = trackview.editor().pixel_to_sample (new_pos);
1574 _region->update_transient (old_frame, new_frame);
1582 AudioRegionView::remove_transient(float pos)
1584 /* Find frame at old pos, calulate new frame then update region transients*/
1585 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1587 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1589 /* Line has been updated in drag so we compare to new_pos */
1590 float *line_pos = (float*) (*l).second->get_data ("position");
1592 if (rint(pos) == rint(*line_pos)) {
1593 _region->remove_transient ((*l).first);
1600 AudioRegionView::thaw_after_trim ()
1602 RegionView::thaw_after_trim ();
1609 AudioRegionView::show_xfades ()
1611 show_start_xfade ();
1616 AudioRegionView::drag_start ()
1618 TimeAxisViewItem::drag_start ();
1620 //we used to hide xfades here. I don't see the point with the new model, but we can re-implement if needed
1624 AudioRegionView::drag_end ()
1626 TimeAxisViewItem::drag_end ();
1627 //see comment for drag_start
1629 if (fade_in_handle && fade_in_handle->visible()) {
1630 // lenght of region or fade changed, re-check
1631 // if fade_in_trim_handle or fade_out_trim_handle should
1632 // be visible. -- If the fade_in_handle is visible
1633 // we have focus and are not in internal edit mode.
1639 AudioRegionView::parameter_changed (string const & p)
1641 if (p == "show-waveforms") {
1642 setup_waveform_visibility ();