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.
23 #include <boost/scoped_ptr.hpp>
27 #include <gtkmm2ext/gtk_ui.h>
29 #include "ardour/playlist.h"
30 #include "ardour/audioregion.h"
31 #include "ardour/audiosource.h"
32 #include "ardour/profile.h"
33 #include "ardour/session.h"
35 #include "pbd/memento_command.h"
36 #include "pbd/stacktrace.h"
38 #include "evoral/Curve.hpp"
40 #include "streamview.h"
41 #include "audio_region_view.h"
42 #include "audio_time_axis.h"
43 #include "simplerect.h"
44 #include "simpleline.h"
46 #include "public_editor.h"
47 #include "audio_region_editor.h"
48 #include "audio_streamview.h"
49 #include "region_gain_line.h"
50 #include "control_point.h"
51 #include "ghostregion.h"
52 #include "audio_time_axis.h"
54 #include "rgb_macros.h"
55 #include "gui_thread.h"
56 #include "ardour_ui.h"
60 #define MUTED_ALPHA 10
63 using namespace ARDOUR;
65 using namespace Editing;
66 using namespace ArdourCanvas;
68 static const int32_t sync_mark_width = 9;
70 AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
71 Gdk::Color const & basic_color)
72 : RegionView (parent, tv, r, spu, basic_color)
78 , fade_position_line(0)
81 , start_xfade_rect (0)
85 , _amplitude_above_axis(1.0)
88 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
91 AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
92 Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
93 : RegionView (parent, tv, r, spu, basic_color, recording, visibility)
99 , fade_position_line(0)
101 , start_xfade_out (0)
102 , start_xfade_rect (0)
106 , _amplitude_above_axis(1.0)
109 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
112 AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_ptr<AudioRegion> other_region)
113 : RegionView (other, boost::shared_ptr<Region> (other_region))
118 , fade_position_line(0)
120 , start_xfade_out (0)
121 , start_xfade_rect (0)
125 , _amplitude_above_axis (other._amplitude_above_axis)
131 UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
132 c.set_rgb_p (r/255.0, g/255.0, b/255.0);
136 Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context());
140 AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
142 // FIXME: Some redundancy here with RegionView::init. Need to figure out
143 // where order is important and where it isn't...
145 RegionView::init (basic_color, wfd);
147 _amplitude_above_axis = 1.0;
149 compute_colors (basic_color);
153 fade_in_shape = new ArdourCanvas::Polygon (*group);
154 fade_in_shape->property_fill_color_rgba() = fade_color;
155 fade_in_shape->set_data ("regionview", this);
157 fade_out_shape = new ArdourCanvas::Polygon (*group);
158 fade_out_shape->property_fill_color_rgba() = fade_color;
159 fade_out_shape->set_data ("regionview", this);
162 fade_in_handle = new ArdourCanvas::SimpleRect (*group);
163 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
164 fade_in_handle->property_outline_pixels() = 0;
166 fade_in_handle->set_data ("regionview", this);
168 fade_out_handle = new ArdourCanvas::SimpleRect (*group);
169 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
170 fade_out_handle->property_outline_pixels() = 0;
172 fade_out_handle->set_data ("regionview", this);
174 fade_position_line = new ArdourCanvas::SimpleLine (*group);
175 fade_position_line->property_color_rgba() = 0xBBBBBBAA;
176 fade_position_line->property_y1() = 7;
177 fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
179 fade_position_line->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);
203 set_waveview_data_src();
205 envelope_active_changed ();
206 fade_in_active_changed ();
207 fade_out_active_changed ();
209 reset_width_dependent_items (_pixel_width);
211 fade_in_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
212 if (fade_in_handle) {
213 fade_in_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
216 fade_out_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
218 if (fade_out_handle) {
219 fade_out_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
224 setup_waveform_visibility ();
225 setup_waveform_shape ();
226 setup_waveform_scale ();
228 /* XXX sync mark drag? */
231 AudioRegionView::~AudioRegionView ()
233 in_destructor = true;
235 RegionViewGoingAway (this); /* EMIT_SIGNAL */
237 for (vector<GnomeCanvasWaveViewCache *>::iterator cache = wave_caches.begin(); cache != wave_caches.end() ; ++cache) {
238 gnome_canvas_waveview_cache_destroy (*cache);
241 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
245 for (list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
246 delete ((*i).second);
249 /* all waveviews etc will be destroyed when the group is destroyed */
252 boost::shared_ptr<ARDOUR::AudioRegion>
253 AudioRegionView::audio_region() const
255 // "Guaranteed" to succeed...
256 return boost::dynamic_pointer_cast<AudioRegion>(_region);
260 AudioRegionView::region_changed (const PropertyChange& what_changed)
262 ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed);
263 // cerr << "AudioRegionView::region_changed() called" << endl;
265 RegionView::region_changed (what_changed);
267 if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
268 region_scale_amplitude_changed ();
270 if (what_changed.contains (ARDOUR::Properties::fade_in)) {
273 if (what_changed.contains (ARDOUR::Properties::fade_out)) {
276 if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
277 fade_in_active_changed ();
279 if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
280 fade_out_active_changed ();
282 if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
283 envelope_active_changed ();
285 if (what_changed.contains (ARDOUR::Properties::valid_transients)) {
286 transients_changed ();
291 AudioRegionView::fade_in_changed ()
293 reset_fade_in_shape ();
297 AudioRegionView::fade_out_changed ()
299 reset_fade_out_shape ();
303 AudioRegionView::fade_in_active_changed ()
305 if (audio_region()->fade_in_active()) {
306 fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
307 fade_in_shape->property_width_pixels() = 1;
309 fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
310 fade_in_shape->property_width_pixels() = 1;
315 AudioRegionView::fade_out_active_changed ()
317 if (audio_region()->fade_out_active()) {
318 fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
319 fade_out_shape->property_width_pixels() = 1;
321 fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
322 fade_out_shape->property_width_pixels() = 1;
328 AudioRegionView::region_scale_amplitude_changed ()
330 ENSURE_GUI_THREAD (*this, &AudioRegionView::region_scale_amplitude_changed)
332 for (uint32_t n = 0; n < waves.size(); ++n) {
333 // force a reload of the cache
334 waves[n]->property_data_src() = _region.get();
339 AudioRegionView::region_renamed ()
341 std::string str = RegionView::make_name ();
343 if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
344 str = string ("*") + str;
347 if (_region->muted()) {
348 str = string ("!") + str;
351 set_item_name (str, this);
356 AudioRegionView::region_resized (const PropertyChange& what_changed)
358 AudioGhostRegion* agr;
360 RegionView::region_resized(what_changed);
361 PropertyChange interesting_stuff;
363 interesting_stuff.add (ARDOUR::Properties::start);
364 interesting_stuff.add (ARDOUR::Properties::length);
366 if (what_changed.contains (interesting_stuff)) {
368 for (uint32_t n = 0; n < waves.size(); ++n) {
369 waves[n]->property_region_start() = _region->start();
372 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
373 if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
375 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
376 (*w)->property_region_start() = _region->start();
381 /* hide transient lines that extend beyond the region end */
383 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
385 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
386 if (l->first > _region->length() - 1) {
396 AudioRegionView::reset_width_dependent_items (double pixel_width)
398 RegionView::reset_width_dependent_items(pixel_width);
399 assert(_pixel_width == pixel_width);
401 if (fade_in_handle) {
402 if (pixel_width <= 6.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
403 fade_in_handle->hide();
404 fade_out_handle->hide();
407 fade_in_handle->show();
408 fade_out_handle->show();
412 AnalysisFeatureList analysis_features = _region->transients();
413 AnalysisFeatureList::const_iterator i;
415 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
417 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
419 float x_pos = trackview.editor().frame_to_pixel (*i);
421 ArdourCanvas::Points points;
422 points.push_back(Gnome::Art::Point(x_pos, 2.0)); // first x-coord needs to be a non-normal value
423 points.push_back(Gnome::Art::Point(x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
426 (*l).second->property_points() = points;
429 reset_fade_shapes ();
433 AudioRegionView::region_muted ()
435 RegionView::region_muted();
437 for (uint32_t n=0; n < waves.size(); ++n) {
438 if (_region->muted()) {
439 waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
441 waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
447 AudioRegionView::setup_fade_handle_positions()
449 /* position of fade handle offset from the top of the region view */
450 double const handle_pos = 2;
451 /* height of fade handles */
452 double const handle_height = 5;
454 if (fade_in_handle) {
455 fade_in_handle->property_y1() = handle_pos;
456 fade_in_handle->property_y2() = handle_pos + handle_height;
459 if (fade_out_handle) {
460 fade_out_handle->property_y1() = handle_pos;
461 fade_out_handle->property_y2() = handle_pos + handle_height;
466 AudioRegionView::set_height (gdouble height)
468 RegionView::set_height (height);
470 uint32_t wcnt = waves.size();
472 for (uint32_t n = 0; n < wcnt; ++n) {
475 if (height < NAME_HIGHLIGHT_THRESH) {
476 ht = ((height - 2 * wcnt) / (double) wcnt);
478 ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
481 gdouble yoff = n * (ht + 1);
483 waves[n]->property_height() = ht;
484 waves[n]->property_y() = yoff + 2;
489 if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
492 update_envelope_visibility ();
495 gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2);
498 reset_fade_shapes ();
500 /* Update hights for any active feature lines */
501 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
503 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
505 float pos_x = trackview.editor().frame_to_pixel((*l).first);
507 ArdourCanvas::Points points;
509 points.push_back(Gnome::Art::Point(pos_x, 2.0)); // first x-coord needs to be a non-normal value
510 points.push_back(Gnome::Art::Point(pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
512 (*l).second->property_points() = points;
515 if (fade_position_line) {
517 if (height < NAME_HIGHLIGHT_THRESH) {
518 fade_position_line->property_y2() = _height - 1;
521 fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
526 name_pixbuf->raise_to_top();
531 AudioRegionView::reset_fade_shapes ()
533 reset_fade_in_shape ();
534 reset_fade_out_shape ();
538 AudioRegionView::reset_fade_in_shape ()
540 reset_fade_in_shape_width ((framecnt_t) audio_region()->fade_in()->back()->when);
544 AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
550 if (audio_region()->fade_in_is_xfade()) {
551 if (fade_in_handle) {
552 fade_in_handle->hide ();
553 fade_in_shape->hide ();
555 redraw_start_xfade ();
558 if (start_xfade_in) {
559 start_xfade_in->hide ();
560 start_xfade_out->hide ();
561 start_xfade_rect->hide ();
565 if (fade_in_handle == 0) {
569 fade_in_handle->show ();
571 /* smallest size for a fade is 64 frames */
573 width = std::max ((framecnt_t) 64, width);
577 /* round here to prevent little visual glitches with sub-pixel placement */
578 double const pwidth = rint (width / samples_per_unit);
579 uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
583 fade_in_shape->hide();
584 fade_in_handle->hide();
588 double const handle_center = pwidth;
590 /* Put the fade in handle so that its left side is at the end-of-fade line */
591 fade_in_handle->property_x1() = handle_center;
592 fade_in_handle->property_x2() = handle_center + 6;
595 fade_in_shape->hide();
599 if (trackview.session()->config.get_show_region_fades()) {
600 fade_in_shape->show();
603 float curve[npoints];
604 audio_region()->fade_in()->curve().get_vector (0, audio_region()->fade_in()->back()->when, curve, npoints);
606 points = get_canvas_points ("fade in shape", npoints + 3);
608 if (_height >= NAME_HIGHLIGHT_THRESH) {
609 h = _height - NAME_HIGHLIGHT_SIZE - 2;
614 /* points *MUST* be in anti-clockwise order */
617 double xdelta = pwidth/npoints;
619 for (pi = 0, pc = 0; pc < npoints; ++pc) {
620 (*points)[pi].set_x(1 + (pc * xdelta));
621 (*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
626 (*points)[pi].set_x(pwidth);
627 (*points)[pi++].set_y(2);
629 (*points)[pi].set_x(1);
630 (*points)[pi++].set_y(2);
632 /* connect the dots ... */
634 (*points)[pi] = (*points)[0];
636 fade_in_shape->property_points() = *points;
639 /* ensure trim handle stays on top */
640 if (frame_handle_start) {
641 frame_handle_start->raise_to_top();
646 AudioRegionView::reset_fade_out_shape ()
648 reset_fade_out_shape_width ((framecnt_t) audio_region()->fade_out()->back()->when);
652 AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
654 if (dragging() && audio_region()->fade_out_is_xfade()) {
655 /* we hide xfades while dragging regions */
659 if (audio_region()->fade_out_is_xfade()) {
660 if (fade_out_handle) {
661 fade_out_handle->hide ();
662 fade_out_shape->hide ();
668 end_xfade_in->hide ();
669 end_xfade_out->hide ();
670 end_xfade_rect->hide ();
674 if (fade_out_handle == 0) {
678 fade_out_handle->show ();
680 /* smallest size for a fade is 64 frames */
682 width = std::max ((framecnt_t) 64, width);
686 /* round here to prevent little visual glitches with sub-pixel placement */
687 double const pwidth = rint (width / samples_per_unit);
688 uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
692 fade_out_shape->hide();
693 fade_out_handle->hide();
697 double const handle_center = (_region->length() - width) / samples_per_unit;
699 /* Put the fade out handle so that its right side is at the end-of-fade line;
700 * it's `one out' for precise pixel accuracy.
702 fade_out_handle->property_x1() = handle_center - 5;
703 fade_out_handle->property_x2() = handle_center + 1;
705 /* don't show shape if its too small */
708 fade_out_shape->hide();
712 if (trackview.session()->config.get_show_region_fades()) {
713 fade_out_shape->show();
716 float curve[npoints];
717 audio_region()->fade_out()->curve().get_vector (0, audio_region()->fade_out()->back()->when, curve, npoints);
719 if (_height >= NAME_HIGHLIGHT_THRESH) {
720 h = _height - NAME_HIGHLIGHT_SIZE - 2;
725 /* points *MUST* be in anti-clockwise order */
727 points = get_canvas_points ("fade out shape", npoints + 3);
730 double xdelta = pwidth/npoints;
732 for (pi = 0, pc = 0; pc < npoints; ++pc) {
733 (*points)[pi].set_x(_pixel_width - pwidth + (pc * xdelta));
734 (*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
739 (*points)[pi].set_x(_pixel_width);
740 (*points)[pi++].set_y(h);
742 (*points)[pi].set_x(_pixel_width);
743 (*points)[pi++].set_y(2);
745 /* connect the dots ... */
747 (*points)[pi] = (*points)[0];
749 fade_out_shape->property_points() = *points;
752 /* ensure trim handle stays on top */
753 if (frame_handle_end) {
754 frame_handle_end->raise_to_top();
759 AudioRegionView::set_samples_per_unit (gdouble spu)
761 RegionView::set_samples_per_unit (spu);
763 if (Config->get_show_waveforms ()) {
764 for (uint32_t n = 0; n < waves.size(); ++n) {
765 waves[n]->property_samples_per_unit() = spu;
773 reset_fade_shapes ();
777 AudioRegionView::set_amplitude_above_axis (gdouble spp)
779 for (uint32_t n=0; n < waves.size(); ++n) {
780 waves[n]->property_amplitude_above_axis() = spp;
785 AudioRegionView::compute_colors (Gdk::Color const & basic_color)
787 RegionView::compute_colors (basic_color);
789 /* gain color computed in envelope_active_changed() */
791 fade_color = UINT_RGBA_CHANGE_A (fill_color, 120);
795 AudioRegionView::set_colors ()
797 RegionView::set_colors();
800 gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
803 for (uint32_t n=0; n < waves.size(); ++n) {
804 if (_region->muted()) {
805 waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
807 waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
810 waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
811 waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
816 AudioRegionView::setup_waveform_visibility ()
818 if (Config->get_show_waveforms ()) {
819 for (uint32_t n = 0; n < waves.size(); ++n) {
820 /* make sure the zoom level is correct, since we don't update
821 this when waveforms are hidden.
823 waves[n]->property_samples_per_unit() = samples_per_unit;
827 for (uint32_t n = 0; n < waves.size(); ++n) {
834 AudioRegionView::temporarily_hide_envelope ()
842 AudioRegionView::unhide_envelope ()
844 update_envelope_visibility ();
848 AudioRegionView::update_envelope_visibility ()
854 if (Config->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseGain) {
855 gain_line->add_visibility (AutomationLine::Line);
862 AudioRegionView::create_waves ()
864 // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
865 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
871 ChanCount nchans = atv.track()->n_channels();
873 // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data
874 // << " and channels = " << nchans.n_audio() << endl;
876 /* in tmp_waves, set up null pointers for each channel so the vector is allocated */
877 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
878 tmp_waves.push_back (0);
881 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
885 _data_ready_connections.clear ();
887 for (uint32_t i = 0; i < nchans.n_audio(); ++i) {
888 _data_ready_connections.push_back (0);
891 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
893 if (n >= audio_region()->n_channels()) {
897 wave_caches.push_back (WaveView::create_cache ());
899 // cerr << "\tchannel " << n << endl;
902 if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), &_data_ready_connections[n], gui_context())) {
903 // cerr << "\tData is ready\n";
904 create_one_wave (n, true);
906 // cerr << "\tdata is not ready\n";
907 // we'll get a PeaksReady signal from the source in the future
908 // and will call create_one_wave(n) then.
912 // cerr << "\tdon't delay, display today!\n";
913 create_one_wave (n, true);
920 AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
922 //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
923 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
924 uint32_t nchans = atv.track()->n_channels().n_audio();
926 uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
929 if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) {
930 ht = ((trackview.current_height()) / (double) nchans);
932 ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans);
935 gdouble yoff = which * ht;
937 WaveView *wave = new WaveView(*group);
939 wave->property_data_src() = (gpointer) _region.get();
940 wave->property_cache() = wave_caches[which];
941 wave->property_cache_updater() = true;
942 wave->property_channel() = which;
943 wave->property_length_function() = (gpointer) region_length_from_c;
944 wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
945 wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
946 wave->property_x() = 0.0;
947 wave->property_y() = yoff;
948 wave->property_height() = (double) ht;
949 wave->property_samples_per_unit() = samples_per_unit;
950 wave->property_amplitude_above_axis() = _amplitude_above_axis;
953 wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
954 wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
956 wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get();
957 wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
960 wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
961 wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
962 wave->property_zero_line() = true;
963 wave->property_region_start() = _region->start();
964 wave->property_rectified() = Config->get_waveform_shape() == Rectified;
965 wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
967 if (!Config->get_show_waveforms ()) {
971 /* note: calling this function is serialized by the lock
972 held in the peak building thread that signals that
973 peaks are ready for use *or* by the fact that it is
974 called one by one from the GUI thread.
977 if (which < nchans) {
978 tmp_waves[which] = wave;
980 /* n-channel track, >n-channel source */
983 /* see if we're all ready */
985 for (n = 0; n < nchans; ++n) {
986 if (tmp_waves[n] == 0) {
991 if (n == nwaves && waves.empty()) {
992 /* all waves are ready */
993 tmp_waves.resize(nwaves);
998 /* all waves created, don't hook into peaks ready anymore */
999 delete _data_ready_connections[which];
1000 _data_ready_connections[which] = 0;
1005 AudioRegionView::peaks_ready_handler (uint32_t which)
1007 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AudioRegionView::create_one_wave, this, which, false));
1008 // cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl;
1012 AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev)
1020 /* don't create points that can't be seen */
1022 update_envelope_visibility ();
1029 framepos_t fx = trackview.editor().pixel_to_frame (x);
1031 if (fx > _region->length()) {
1035 /* compute vertical fractional position */
1037 y = 1.0 - (y / (_height - NAME_HIGHLIGHT_SIZE));
1039 /* map using gain line */
1041 gain_line->view_to_model_coord (x, y);
1043 /* XXX STATEFUL: can't convert to stateful diff until we
1044 can represent automation data with it.
1047 trackview.session()->begin_reversible_command (_("add gain control point"));
1048 XMLNode &before = audio_region()->envelope()->get_state();
1050 if (!audio_region()->envelope_active()) {
1051 XMLNode ®ion_before = audio_region()->get_state();
1052 audio_region()->set_envelope_active(true);
1053 XMLNode ®ion_after = audio_region()->get_state();
1054 trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
1057 audio_region()->envelope()->add (fx, y);
1059 XMLNode &after = audio_region()->envelope()->get_state();
1060 trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
1061 trackview.session()->commit_reversible_command ();
1065 AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent */*ev*/)
1067 ControlPoint *cp = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"));
1068 audio_region()->envelope()->erase (cp->model());
1072 AudioRegionView::setup_waveform_shape ()
1074 for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
1075 (*wave)->property_rectified() = Config->get_waveform_shape() == Rectified;
1080 AudioRegionView::setup_waveform_scale ()
1082 for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
1083 (*wave)->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
1089 AudioRegionView::add_ghost (TimeAxisView& tv)
1091 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&trackview);
1094 double unit_position = _region->position () / samples_per_unit;
1095 AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
1098 nchans = rtv->track()->n_channels().n_audio();
1100 for (uint32_t n = 0; n < nchans; ++n) {
1102 if (n >= audio_region()->n_channels()) {
1106 WaveView *wave = new WaveView(*ghost->group);
1108 wave->property_data_src() = _region.get();
1109 wave->property_cache() = wave_caches[n];
1110 wave->property_cache_updater() = false;
1111 wave->property_channel() = n;
1112 wave->property_length_function() = (gpointer)region_length_from_c;
1113 wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
1114 wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
1115 wave->property_x() = 0.0;
1116 wave->property_samples_per_unit() = samples_per_unit;
1117 wave->property_amplitude_above_axis() = _amplitude_above_axis;
1119 wave->property_region_start() = _region->start();
1121 ghost->waves.push_back(wave);
1124 ghost->set_height ();
1125 ghost->set_duration (_region->length() / samples_per_unit);
1126 ghost->set_colors();
1127 ghosts.push_back (ghost);
1133 AudioRegionView::entered (bool internal_editing)
1135 trackview.editor().set_current_trimmable (_region);
1136 trackview.editor().set_current_movable (_region);
1138 if (gain_line && trackview.editor().current_mouse_mode() == Editing::MouseGain) {
1139 gain_line->add_visibility (AutomationLine::ControlPoints);
1142 if (fade_in_handle && !internal_editing) {
1143 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
1144 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
1149 AudioRegionView::exited ()
1151 trackview.editor().set_current_trimmable (boost::shared_ptr<Trimmable>());
1152 trackview.editor().set_current_movable (boost::shared_ptr<Movable>());
1154 if (gain_line && trackview.editor().current_mouse_mode() == Editing::MouseGain) {
1155 gain_line->remove_visibility (AutomationLine::ControlPoints);
1158 if (fade_in_handle) {
1159 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
1160 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
1165 AudioRegionView::envelope_active_changed ()
1168 gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
1173 AudioRegionView::set_waveview_data_src()
1175 AudioGhostRegion* agr;
1176 double unit_length= _region->length() / samples_per_unit;
1178 for (uint32_t n = 0; n < waves.size(); ++n) {
1179 // TODO: something else to let it know the channel
1180 waves[n]->property_data_src() = _region.get();
1183 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
1185 (*i)->set_duration (unit_length);
1187 if((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
1188 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
1189 (*w)->property_data_src() = _region.get();
1197 AudioRegionView::color_handler ()
1199 //case cMutedWaveForm:
1201 //case cWaveFormClip:
1205 //case cGainLineInactive:
1207 envelope_active_changed();
1212 AudioRegionView::set_frame_color ()
1218 if (_region->opaque()) {
1224 TimeAxisViewItem::set_frame_color ();
1230 if (_region->muted()) {
1231 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get(), MUTED_ALPHA);
1233 wc = ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get();
1235 fc = ARDOUR_UI::config()->canvasvar_SelectedWaveFormFill.get();
1238 if (_region->muted()) {
1239 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA);
1241 wc = ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
1243 fc = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
1245 if (_region->muted()) {
1246 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
1248 wc = ARDOUR_UI::config()->canvasvar_WaveForm.get();
1250 fc = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
1254 for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
1255 if (_region->muted()) {
1256 (*w)->property_wave_color() = wc;
1258 (*w)->property_wave_color() = wc;
1259 (*w)->property_fill_color() = fc;
1265 AudioRegionView::set_fade_visibility (bool yn)
1268 if (fade_in_shape) {
1269 fade_in_shape->show();
1271 if (fade_out_shape) {
1272 fade_out_shape->show ();
1274 if (fade_in_handle) {
1275 fade_in_handle->show ();
1277 if (fade_out_handle) {
1278 fade_out_handle->show ();
1281 if (fade_in_shape) {
1282 fade_in_shape->hide();
1284 if (fade_out_shape) {
1285 fade_out_shape->hide ();
1287 if (fade_in_handle) {
1288 fade_in_handle->hide ();
1290 if (fade_out_handle) {
1291 fade_out_handle->hide ();
1297 AudioRegionView::update_coverage_frames (LayerDisplay d)
1299 RegionView::update_coverage_frames (d);
1301 if (fade_in_handle) {
1302 fade_in_handle->raise_to_top ();
1303 fade_out_handle->raise_to_top ();
1308 AudioRegionView::show_region_editor ()
1311 editor = new AudioRegionEditor (trackview.session(), audio_region());
1315 editor->set_position (Gtk::WIN_POS_MOUSE);
1321 AudioRegionView::show_fade_line (framepos_t pos)
1323 fade_position_line->property_x1() = trackview.editor().frame_to_pixel (pos);
1324 fade_position_line->property_x2() = trackview.editor().frame_to_pixel (pos);
1325 fade_position_line->show ();
1326 fade_position_line->raise_to_top ();
1330 AudioRegionView::hide_fade_line ()
1332 fade_position_line->hide ();
1337 AudioRegionView::transients_changed ()
1339 AnalysisFeatureList analysis_features = _region->transients();
1341 while (feature_lines.size() < analysis_features.size()) {
1343 ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(*group);
1345 ArdourCanvas::Points points;
1347 points.push_back(Gnome::Art::Point(-1.0, 2.0)); // first x-coord needs to be a non-normal value
1348 points.push_back(Gnome::Art::Point(1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1350 canvas_item->property_points() = points;
1351 canvas_item->property_width_pixels() = 1;
1352 canvas_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
1353 canvas_item->property_first_arrowhead() = TRUE;
1354 canvas_item->property_last_arrowhead() = TRUE;
1355 canvas_item->property_arrow_shape_a() = 11.0;
1356 canvas_item->property_arrow_shape_b() = 0.0;
1357 canvas_item->property_arrow_shape_c() = 4.0;
1359 canvas_item->raise_to_top ();
1360 canvas_item->show ();
1362 canvas_item->set_data ("regionview", this);
1363 canvas_item->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
1365 feature_lines.push_back (make_pair(0, canvas_item));
1368 while (feature_lines.size() > analysis_features.size()) {
1369 ArdourCanvas::Line* line = feature_lines.back().second;
1370 feature_lines.pop_back ();
1374 AnalysisFeatureList::const_iterator i;
1375 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1377 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
1379 ArdourCanvas::Points points;
1381 float *pos = new float;
1382 *pos = trackview.editor().frame_to_pixel (*i);
1384 points.push_back(Gnome::Art::Point(*pos, 2.0)); // first x-coord needs to be a non-normal value
1385 points.push_back(Gnome::Art::Point(*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1387 (*l).second->property_points() = points;
1388 (*l).second->set_data ("position", pos);
1395 AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
1397 /* Find frame at old pos, calulate new frame then update region transients*/
1398 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1400 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1402 /* Line has been updated in drag so we compare to new_pos */
1404 float* pos = (float*) (*l).second->get_data ("position");
1406 if (rint(new_pos) == rint(*pos)) {
1408 framepos_t old_frame = (*l).first;
1409 framepos_t new_frame = trackview.editor().pixel_to_frame (new_pos);
1411 _region->update_transient (old_frame, new_frame);
1419 AudioRegionView::remove_transient(float pos)
1421 /* Find frame at old pos, calulate new frame then update region transients*/
1422 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1424 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1426 /* Line has been updated in drag so we compare to new_pos */
1427 float *line_pos = (float*) (*l).second->get_data ("position");
1429 if (rint(pos) == rint(*line_pos)) {
1430 _region->remove_transient ((*l).first);
1437 AudioRegionView::thaw_after_trim ()
1439 RegionView::thaw_after_trim ();
1445 AudioRegionView::redraw_start_xfade ()
1447 boost::shared_ptr<AudioRegion> ar (audio_region());
1449 if (!ar->fade_in() || ar->fade_in()->empty()) {
1453 if (!ar->fade_in_is_xfade()) {
1454 if (start_xfade_in) {
1455 start_xfade_in->hide ();
1456 start_xfade_out->hide ();
1457 start_xfade_rect->hide ();
1462 redraw_start_xfade_to (ar, ar->fade_in()->back()->when);
1466 AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
1468 int32_t const npoints = trackview.editor().frame_to_pixel (len);
1474 if (!start_xfade_in) {
1475 start_xfade_in = new ArdourCanvas::Line (*group);
1476 start_xfade_in->property_width_pixels() = 1;
1477 start_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
1480 if (!start_xfade_out) {
1481 start_xfade_out = new ArdourCanvas::Line (*group);
1482 start_xfade_out->property_width_pixels() = 1;
1483 uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
1484 start_xfade_out->property_fill_color_rgba() = col;
1487 if (!start_xfade_rect) {
1488 start_xfade_rect = new ArdourCanvas::SimpleRect (*group);
1489 start_xfade_rect->property_draw() = true;
1490 start_xfade_rect->property_fill() = true;;
1491 start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
1492 start_xfade_rect->property_outline_pixels() = 0;
1493 start_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
1494 start_xfade_rect->set_data ("regionview", this);
1497 Points* points = get_canvas_points ("xfade edit redraw", npoints);
1498 boost::scoped_ptr<float> vec (new float[npoints]);
1499 double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1.0;
1501 ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
1503 for (int i = 0, pci = 0; i < npoints; ++i) {
1504 Gnome::Art::Point &p ((*points)[pci++]);
1506 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1509 start_xfade_rect->property_x1() = ((*points)[0]).get_x();
1510 start_xfade_rect->property_y1() = 1.0;
1511 start_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
1512 start_xfade_rect->property_y2() = effective_height;
1513 start_xfade_rect->show ();
1514 start_xfade_rect->raise_to_top ();
1516 start_xfade_in->property_points() = *points;
1517 start_xfade_in->show ();
1518 start_xfade_in->raise_to_top ();
1522 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in();
1526 for (int i = 0, pci = 0; i < npoints; ++i) {
1527 Gnome::Art::Point &p ((*points)[pci++]);
1529 p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
1534 inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints);
1536 for (int i = 0, pci = 0; i < npoints; ++i) {
1537 Gnome::Art::Point &p ((*points)[pci++]);
1539 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1543 start_xfade_out->property_points() = *points;
1544 start_xfade_out->show ();
1545 start_xfade_out->raise_to_top ();
1551 AudioRegionView::redraw_end_xfade ()
1553 boost::shared_ptr<AudioRegion> ar (audio_region());
1555 if (!ar->fade_out() || ar->fade_out()->empty()) {
1559 if (!ar->fade_out_is_xfade()) {
1561 end_xfade_in->hide ();
1562 end_xfade_out->hide ();
1563 end_xfade_rect->hide ();
1568 redraw_end_xfade_to (ar, ar->fade_out()->back()->when);
1572 AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
1574 int32_t const npoints = trackview.editor().frame_to_pixel (len);
1580 if (!end_xfade_in) {
1581 end_xfade_in = new ArdourCanvas::Line (*group);
1582 end_xfade_in->property_width_pixels() = 1;
1583 end_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
1586 if (!end_xfade_out) {
1587 end_xfade_out = new ArdourCanvas::Line (*group);
1588 end_xfade_out->property_width_pixels() = 1;
1589 uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
1590 end_xfade_out->property_fill_color_rgba() = col;
1593 if (!end_xfade_rect) {
1594 end_xfade_rect = new ArdourCanvas::SimpleRect (*group);
1595 end_xfade_rect->property_draw() = true;
1596 end_xfade_rect->property_fill() = true;;
1597 end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
1598 end_xfade_rect->property_outline_pixels() = 0;
1599 end_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
1600 end_xfade_rect->set_data ("regionview", this);
1603 Points* points = get_canvas_points ("xfade edit redraw", npoints);
1604 boost::scoped_ptr<float> vec (new float[npoints]);
1606 ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints);
1608 double rend = trackview.editor().frame_to_pixel (_region->length() - len);
1609 double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1;
1611 for (int i = 0, pci = 0; i < npoints; ++i) {
1612 Gnome::Art::Point &p ((*points)[pci++]);
1614 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1617 end_xfade_rect->property_x1() = ((*points)[0]).get_x();
1618 end_xfade_rect->property_y1() = 1;
1619 end_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
1620 end_xfade_rect->property_y2() = effective_height;
1621 end_xfade_rect->show ();
1622 end_xfade_rect->raise_to_top ();
1624 end_xfade_in->property_points() = *points;
1625 end_xfade_in->show ();
1626 end_xfade_in->raise_to_top ();
1630 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
1634 for (int i = 0, pci = 0; i < npoints; ++i) {
1635 Gnome::Art::Point &p ((*points)[pci++]);
1637 p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
1642 inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
1644 for (int i = 0, pci = 0; i < npoints; ++i) {
1645 Gnome::Art::Point &p ((*points)[pci++]);
1647 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1651 end_xfade_out->property_points() = *points;
1652 end_xfade_out->show ();
1653 end_xfade_out->raise_to_top ();
1660 AudioRegionView::hide_xfades ()
1662 if (start_xfade_in) {
1663 start_xfade_in->hide();
1665 if (start_xfade_out) {
1666 start_xfade_out->hide();
1668 if (start_xfade_rect) {
1669 start_xfade_rect->hide ();
1672 end_xfade_in->hide();
1674 if (end_xfade_out) {
1675 end_xfade_out->hide();
1677 if (end_xfade_rect) {
1678 end_xfade_rect->hide ();
1683 AudioRegionView::show_xfades ()
1685 if (start_xfade_in) {
1686 start_xfade_in->show();
1688 if (start_xfade_out) {
1689 start_xfade_out->show();
1691 if (start_xfade_rect) {
1692 start_xfade_rect->show ();
1695 end_xfade_in->show();
1697 if (end_xfade_out) {
1698 end_xfade_out->show();
1700 if (end_xfade_rect) {
1701 end_xfade_rect->show ();
1706 AudioRegionView::drag_start ()
1708 TimeAxisViewItem::drag_start ();
1709 AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&trackview);
1712 AudioStreamView* av = atav->audio_view();
1714 /* this will hide our xfades too */
1715 _hidden_xfades = av->hide_xfades_with (audio_region());
1721 AudioRegionView::drag_end ()
1723 TimeAxisViewItem::drag_end ();
1725 for (list<AudioRegionView*>::iterator i = _hidden_xfades.begin(); i != _hidden_xfades.end(); ++i) {
1726 (*i)->show_xfades ();
1729 _hidden_xfades.clear ();
1733 AudioRegionView::parameter_changed (string const & p)
1735 if (p == "show-waveforms") {
1736 setup_waveform_visibility ();
1737 } else if (p == "waveform-scale") {
1738 setup_waveform_scale ();
1739 } else if (p == "waveform-shape") {
1740 setup_waveform_shape ();