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)
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)
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)
126 , _flags (other._flags)
132 UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
133 c.set_rgb_p (r/255.0, g/255.0, b/255.0);
139 AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
141 // FIXME: Some redundancy here with RegionView::init. Need to figure out
142 // where order is important and where it isn't...
144 RegionView::init (basic_color, wfd);
148 _amplitude_above_axis = 1.0;
151 if ((node = _region->extra_xml ("GUI")) != 0) {
154 _flags = WaveformVisible;
158 compute_colors (basic_color);
162 fade_in_shape = new ArdourCanvas::Polygon (*group);
163 fade_in_shape->property_fill_color_rgba() = fade_color;
164 fade_in_shape->set_data ("regionview", this);
166 fade_out_shape = new ArdourCanvas::Polygon (*group);
167 fade_out_shape->property_fill_color_rgba() = fade_color;
168 fade_out_shape->set_data ("regionview", this);
171 fade_in_handle = new ArdourCanvas::SimpleRect (*group);
172 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
173 fade_in_handle->property_outline_pixels() = 0;
175 fade_in_handle->set_data ("regionview", this);
177 fade_out_handle = new ArdourCanvas::SimpleRect (*group);
178 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
179 fade_out_handle->property_outline_pixels() = 0;
181 fade_out_handle->set_data ("regionview", this);
183 fade_position_line = new ArdourCanvas::SimpleLine (*group);
184 fade_position_line->property_color_rgba() = 0xBBBBBBAA;
185 fade_position_line->property_y1() = 7;
186 fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
188 fade_position_line->hide();
191 setup_fade_handle_positions ();
193 if (!trackview.session()->config.get_show_region_fades()) {
194 set_fade_visibility (false);
197 const string line_name = _region->name() + ":gain";
199 if (!Profile->get_sae()) {
200 gain_line.reset (new AudioRegionGainLine (line_name, *this, *group, audio_region()->envelope()));
203 if (Config->get_show_region_gain()) {
211 set_height (trackview.current_height());
214 region_sync_changed ();
216 region_resized (ARDOUR::bounds_change);
217 set_waveview_data_src();
219 envelope_active_changed ();
220 fade_in_active_changed ();
221 fade_out_active_changed ();
223 reset_width_dependent_items (_pixel_width);
225 fade_in_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
226 if (fade_in_handle) {
227 fade_in_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
230 fade_out_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
232 if (fade_out_handle) {
233 fade_out_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
238 /* XXX sync mark drag? */
241 AudioRegionView::~AudioRegionView ()
243 in_destructor = true;
245 RegionViewGoingAway (this); /* EMIT_SIGNAL */
247 for (vector<GnomeCanvasWaveViewCache *>::iterator cache = wave_caches.begin(); cache != wave_caches.end() ; ++cache) {
248 gnome_canvas_waveview_cache_destroy (*cache);
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);
273 // cerr << "AudioRegionView::region_changed() called" << endl;
275 RegionView::region_changed (what_changed);
277 if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
278 region_scale_amplitude_changed ();
280 if (what_changed.contains (ARDOUR::Properties::fade_in)) {
283 if (what_changed.contains (ARDOUR::Properties::fade_out)) {
286 if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
287 fade_in_active_changed ();
289 if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
290 fade_out_active_changed ();
292 if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
293 envelope_active_changed ();
295 if (what_changed.contains (ARDOUR::Properties::valid_transients)) {
296 transients_changed ();
301 AudioRegionView::fade_in_changed ()
303 reset_fade_in_shape ();
307 AudioRegionView::fade_out_changed ()
309 reset_fade_out_shape ();
313 AudioRegionView::fade_in_active_changed ()
315 if (audio_region()->fade_in_active()) {
316 fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
317 fade_in_shape->property_width_pixels() = 1;
319 fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
320 fade_in_shape->property_width_pixels() = 1;
325 AudioRegionView::fade_out_active_changed ()
327 if (audio_region()->fade_out_active()) {
328 fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
329 fade_out_shape->property_width_pixels() = 1;
331 fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
332 fade_out_shape->property_width_pixels() = 1;
338 AudioRegionView::region_scale_amplitude_changed ()
340 ENSURE_GUI_THREAD (*this, &AudioRegionView::region_scale_amplitude_changed)
342 for (uint32_t n = 0; n < waves.size(); ++n) {
343 // force a reload of the cache
344 waves[n]->property_data_src() = _region.get();
349 AudioRegionView::region_renamed ()
351 std::string str = RegionView::make_name ();
353 if (audio_region()->speed_mismatch (trackview.session()->frame_rate())) {
354 str = string ("*") + str;
357 if (_region->muted()) {
358 str = string ("!") + str;
361 set_item_name (str, this);
366 AudioRegionView::region_resized (const PropertyChange& what_changed)
368 AudioGhostRegion* agr;
370 RegionView::region_resized(what_changed);
371 PropertyChange interesting_stuff;
373 interesting_stuff.add (ARDOUR::Properties::start);
374 interesting_stuff.add (ARDOUR::Properties::length);
376 if (what_changed.contains (interesting_stuff)) {
378 for (uint32_t n = 0; n < waves.size(); ++n) {
379 waves[n]->property_region_start() = _region->start();
382 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
383 if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
385 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
386 (*w)->property_region_start() = _region->start();
391 /* hide transient lines that extend beyond the region end */
393 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
395 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
396 if (l->first > _region->length() - 1) {
406 AudioRegionView::reset_width_dependent_items (double pixel_width)
408 RegionView::reset_width_dependent_items(pixel_width);
409 assert(_pixel_width == pixel_width);
411 if (fade_in_handle) {
412 if (pixel_width <= 6.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
413 fade_in_handle->hide();
414 fade_out_handle->hide();
417 fade_in_handle->show();
418 fade_out_handle->show();
422 AnalysisFeatureList analysis_features = _region->transients();
423 AnalysisFeatureList::const_iterator i;
425 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
427 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
429 float x_pos = trackview.editor().frame_to_pixel (*i);
431 ArdourCanvas::Points points;
432 points.push_back(Gnome::Art::Point(x_pos, 2.0)); // first x-coord needs to be a non-normal value
433 points.push_back(Gnome::Art::Point(x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
436 (*l).second->property_points() = points;
439 reset_fade_shapes ();
443 AudioRegionView::region_muted ()
445 RegionView::region_muted();
447 for (uint32_t n=0; n < waves.size(); ++n) {
448 if (_region->muted()) {
449 waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
451 waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
457 AudioRegionView::setup_fade_handle_positions()
459 /* position of fade handle offset from the top of the region view */
460 double const handle_pos = 2;
461 /* height of fade handles */
462 double const handle_height = 5;
464 if (fade_in_handle) {
465 fade_in_handle->property_y1() = handle_pos;
466 fade_in_handle->property_y2() = handle_pos + handle_height;
469 if (fade_out_handle) {
470 fade_out_handle->property_y1() = handle_pos;
471 fade_out_handle->property_y2() = handle_pos + handle_height;
476 AudioRegionView::set_height (gdouble height)
478 RegionView::set_height (height);
480 uint32_t wcnt = waves.size();
482 for (uint32_t n = 0; n < wcnt; ++n) {
485 if (height < NAME_HIGHLIGHT_THRESH) {
486 ht = ((height - 2 * wcnt) / (double) wcnt);
488 ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
491 gdouble yoff = n * (ht + 1);
493 waves[n]->property_height() = ht;
494 waves[n]->property_y() = yoff + 2;
499 if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
502 if (Config->get_show_region_gain ()) {
507 gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2);
510 reset_fade_shapes ();
512 /* Update hights for any active feature lines */
513 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
515 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
517 float pos_x = trackview.editor().frame_to_pixel((*l).first);
519 ArdourCanvas::Points points;
521 points.push_back(Gnome::Art::Point(pos_x, 2.0)); // first x-coord needs to be a non-normal value
522 points.push_back(Gnome::Art::Point(pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
524 (*l).second->property_points() = points;
527 if (fade_position_line) {
529 if (height < NAME_HIGHLIGHT_THRESH) {
530 fade_position_line->property_y2() = _height - 1;
533 fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
538 name_pixbuf->raise_to_top();
543 AudioRegionView::reset_fade_shapes ()
545 reset_fade_in_shape ();
546 reset_fade_out_shape ();
550 AudioRegionView::reset_fade_in_shape ()
552 reset_fade_in_shape_width ((framecnt_t) audio_region()->fade_in()->back()->when);
556 AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
562 if (audio_region()->fade_in_is_xfade()) {
563 if (fade_in_handle) {
564 fade_in_handle->hide ();
565 fade_in_shape->hide ();
567 redraw_start_xfade ();
570 if (start_xfade_in) {
571 start_xfade_in->hide ();
572 start_xfade_out->hide ();
573 start_xfade_rect->hide ();
577 if (fade_in_handle == 0) {
581 fade_in_handle->show ();
583 /* smallest size for a fade is 64 frames */
585 width = std::max ((framecnt_t) 64, width);
589 /* round here to prevent little visual glitches with sub-pixel placement */
590 double const pwidth = rint (width / samples_per_unit);
591 uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
595 fade_in_shape->hide();
596 fade_in_handle->hide();
600 double const handle_center = pwidth;
602 /* Put the fade in handle so that its left side is at the end-of-fade line */
603 fade_in_handle->property_x1() = handle_center;
604 fade_in_handle->property_x2() = handle_center + 6;
607 fade_in_shape->hide();
611 if (trackview.session()->config.get_show_region_fades()) {
612 fade_in_shape->show();
615 float curve[npoints];
616 audio_region()->fade_in()->curve().get_vector (0, audio_region()->fade_in()->back()->when, curve, npoints);
618 points = get_canvas_points ("fade in shape", npoints + 3);
620 if (_height >= NAME_HIGHLIGHT_THRESH) {
621 h = _height - NAME_HIGHLIGHT_SIZE - 2;
626 /* points *MUST* be in anti-clockwise order */
629 double xdelta = pwidth/npoints;
631 for (pi = 0, pc = 0; pc < npoints; ++pc) {
632 (*points)[pi].set_x(1 + (pc * xdelta));
633 (*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
638 (*points)[pi].set_x(pwidth);
639 (*points)[pi++].set_y(2);
641 (*points)[pi].set_x(1);
642 (*points)[pi++].set_y(2);
644 /* connect the dots ... */
646 (*points)[pi] = (*points)[0];
648 fade_in_shape->property_points() = *points;
651 /* ensure trim handle stays on top */
652 if (frame_handle_start) {
653 frame_handle_start->raise_to_top();
658 AudioRegionView::reset_fade_out_shape ()
660 reset_fade_out_shape_width ((framecnt_t) audio_region()->fade_out()->back()->when);
664 AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
670 if (audio_region()->fade_out_is_xfade()) {
671 if (fade_out_handle) {
672 fade_out_handle->hide ();
673 fade_out_shape->hide ();
679 end_xfade_in->hide ();
680 end_xfade_out->hide ();
681 end_xfade_rect->hide ();
685 if (fade_out_handle == 0) {
689 fade_out_handle->show ();
691 /* smallest size for a fade is 64 frames */
693 width = std::max ((framecnt_t) 64, width);
697 /* round here to prevent little visual glitches with sub-pixel placement */
698 double const pwidth = rint (width / samples_per_unit);
699 uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
703 fade_out_shape->hide();
704 fade_out_handle->hide();
708 double const handle_center = (_region->length() - width) / samples_per_unit;
710 /* Put the fade out handle so that its right side is at the end-of-fade line;
711 * it's `one out' for precise pixel accuracy.
713 fade_out_handle->property_x1() = handle_center - 5;
714 fade_out_handle->property_x2() = handle_center + 1;
716 /* don't show shape if its too small */
719 fade_out_shape->hide();
723 if (trackview.session()->config.get_show_region_fades()) {
724 fade_out_shape->show();
727 float curve[npoints];
728 audio_region()->fade_out()->curve().get_vector (0, audio_region()->fade_out()->back()->when, curve, npoints);
730 if (_height >= NAME_HIGHLIGHT_THRESH) {
731 h = _height - NAME_HIGHLIGHT_SIZE - 2;
736 /* points *MUST* be in anti-clockwise order */
738 points = get_canvas_points ("fade out shape", npoints + 3);
741 double xdelta = pwidth/npoints;
743 for (pi = 0, pc = 0; pc < npoints; ++pc) {
744 (*points)[pi].set_x(_pixel_width - pwidth + (pc * xdelta));
745 (*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
750 (*points)[pi].set_x(_pixel_width);
751 (*points)[pi++].set_y(h);
753 (*points)[pi].set_x(_pixel_width);
754 (*points)[pi++].set_y(2);
756 /* connect the dots ... */
758 (*points)[pi] = (*points)[0];
760 fade_out_shape->property_points() = *points;
763 /* ensure trim handle stays on top */
764 if (frame_handle_end) {
765 frame_handle_end->raise_to_top();
770 AudioRegionView::set_samples_per_unit (gdouble spu)
772 RegionView::set_samples_per_unit (spu);
774 if (_flags & WaveformVisible) {
775 for (uint32_t n=0; n < waves.size(); ++n) {
776 waves[n]->property_samples_per_unit() = spu;
784 reset_fade_shapes ();
788 AudioRegionView::set_amplitude_above_axis (gdouble spp)
790 for (uint32_t n=0; n < waves.size(); ++n) {
791 waves[n]->property_amplitude_above_axis() = spp;
796 AudioRegionView::compute_colors (Gdk::Color const & basic_color)
798 RegionView::compute_colors (basic_color);
800 /* gain color computed in envelope_active_changed() */
802 fade_color = UINT_RGBA_CHANGE_A (fill_color, 120);
806 AudioRegionView::set_colors ()
808 RegionView::set_colors();
811 gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
814 for (uint32_t n=0; n < waves.size(); ++n) {
815 if (_region->muted()) {
816 waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
818 waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
821 waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
822 waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
827 AudioRegionView::set_waveform_visible (bool yn)
829 if (((_flags & WaveformVisible) != yn)) {
831 for (uint32_t n=0; n < waves.size(); ++n) {
832 /* make sure the zoom level is correct, since we don't update
833 this when waveforms are hidden.
835 waves[n]->property_samples_per_unit() = samples_per_unit;
838 _flags |= WaveformVisible;
840 for (uint32_t n=0; n < waves.size(); ++n) {
843 _flags &= ~WaveformVisible;
850 AudioRegionView::temporarily_hide_envelope ()
858 AudioRegionView::unhide_envelope ()
866 AudioRegionView::set_envelope_visible (bool yn)
878 AudioRegionView::create_waves ()
880 // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
881 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
887 ChanCount nchans = atv.track()->n_channels();
889 // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data
890 // << " and channels = " << nchans.n_audio() << endl;
892 /* in tmp_waves, set up null pointers for each channel so the vector is allocated */
893 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
894 tmp_waves.push_back (0);
897 for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
901 _data_ready_connections.clear ();
903 for (uint32_t i = 0; i < nchans.n_audio(); ++i) {
904 _data_ready_connections.push_back (0);
907 for (uint32_t n = 0; n < nchans.n_audio(); ++n) {
909 if (n >= audio_region()->n_channels()) {
913 wave_caches.push_back (WaveView::create_cache ());
915 // cerr << "\tchannel " << n << endl;
918 if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), &_data_ready_connections[n], gui_context())) {
919 // cerr << "\tData is ready\n";
920 create_one_wave (n, true);
922 // cerr << "\tdata is not ready\n";
923 // we'll get a PeaksReady signal from the source in the future
924 // and will call create_one_wave(n) then.
928 // cerr << "\tdon't delay, display today!\n";
929 create_one_wave (n, true);
936 AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
938 //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
939 RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
940 uint32_t nchans = atv.track()->n_channels().n_audio();
942 uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
945 if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) {
946 ht = ((trackview.current_height()) / (double) nchans);
948 ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans);
951 gdouble yoff = which * ht;
953 WaveView *wave = new WaveView(*group);
955 wave->property_data_src() = (gpointer) _region.get();
956 wave->property_cache() = wave_caches[which];
957 wave->property_cache_updater() = true;
958 wave->property_channel() = which;
959 wave->property_length_function() = (gpointer) region_length_from_c;
960 wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
961 wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
962 wave->property_x() = 0.0;
963 wave->property_y() = yoff;
964 wave->property_height() = (double) ht;
965 wave->property_samples_per_unit() = samples_per_unit;
966 wave->property_amplitude_above_axis() = _amplitude_above_axis;
969 wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
970 wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
972 wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get();
973 wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
976 wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
977 wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
978 wave->property_zero_line() = true;
979 wave->property_region_start() = _region->start();
980 wave->property_rectified() = (bool) (_flags & WaveformRectified);
981 wave->property_logscaled() = (bool) (_flags & WaveformLogScaled);
983 if (!(_flags & WaveformVisible)) {
987 /* note: calling this function is serialized by the lock
988 held in the peak building thread that signals that
989 peaks are ready for use *or* by the fact that it is
990 called one by one from the GUI thread.
993 if (which < nchans) {
994 tmp_waves[which] = wave;
996 /* n-channel track, >n-channel source */
999 /* see if we're all ready */
1001 for (n = 0; n < nchans; ++n) {
1002 if (tmp_waves[n] == 0) {
1007 if (n == nwaves && waves.empty()) {
1008 /* all waves are ready */
1009 tmp_waves.resize(nwaves);
1014 /* all waves created, don't hook into peaks ready anymore */
1015 delete _data_ready_connections[which];
1016 _data_ready_connections[which] = 0;
1021 AudioRegionView::peaks_ready_handler (uint32_t which)
1023 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AudioRegionView::create_one_wave, this, which, false));
1024 // cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl;
1028 AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev)
1036 /* don't create points that can't be seen */
1038 set_envelope_visible (true);
1045 framepos_t fx = trackview.editor().pixel_to_frame (x);
1047 if (fx > _region->length()) {
1051 /* compute vertical fractional position */
1053 y = 1.0 - (y / (_height - NAME_HIGHLIGHT_SIZE));
1055 /* map using gain line */
1057 gain_line->view_to_model_coord (x, y);
1059 /* XXX STATEFUL: can't convert to stateful diff until we
1060 can represent automation data with it.
1063 trackview.session()->begin_reversible_command (_("add gain control point"));
1064 XMLNode &before = audio_region()->envelope()->get_state();
1066 if (!audio_region()->envelope_active()) {
1067 XMLNode ®ion_before = audio_region()->get_state();
1068 audio_region()->set_envelope_active(true);
1069 XMLNode ®ion_after = audio_region()->get_state();
1070 trackview.session()->add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after));
1073 audio_region()->envelope()->add (fx, y);
1075 XMLNode &after = audio_region()->envelope()->get_state();
1076 trackview.session()->add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after));
1077 trackview.session()->commit_reversible_command ();
1081 AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent */*ev*/)
1083 ControlPoint *cp = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"));
1084 audio_region()->envelope()->erase (cp->model());
1088 AudioRegionView::store_flags()
1090 XMLNode *node = new XMLNode ("GUI");
1092 node->add_property ("waveform-visible", (_flags & WaveformVisible) ? "yes" : "no");
1093 node->add_property ("waveform-rectified", (_flags & WaveformRectified) ? "yes" : "no");
1094 node->add_property ("waveform-logscaled", (_flags & WaveformLogScaled) ? "yes" : "no");
1096 _region->add_extra_xml (*node);
1100 AudioRegionView::set_flags (XMLNode* node)
1104 if ((prop = node->property ("waveform-visible")) != 0) {
1105 if (string_is_affirmative (prop->value())) {
1106 _flags |= WaveformVisible;
1110 if ((prop = node->property ("waveform-rectified")) != 0) {
1111 if (string_is_affirmative (prop->value())) {
1112 _flags |= WaveformRectified;
1116 if ((prop = node->property ("waveform-logscaled")) != 0) {
1117 if (string_is_affirmative (prop->value())) {
1118 _flags |= WaveformLogScaled;
1124 AudioRegionView::set_waveform_shape (WaveformShape shape)
1128 /* this slightly odd approach is to leave the door open to
1129 other "shapes" such as spectral displays, etc.
1142 if (yn != (bool) (_flags & WaveformRectified)) {
1143 for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
1144 (*wave)->property_rectified() = yn;
1148 _flags |= WaveformRectified;
1150 _flags &= ~WaveformRectified;
1157 AudioRegionView::set_waveform_scale (WaveformScale scale)
1159 bool yn = (scale == Logarithmic);
1161 if (yn != (bool) (_flags & WaveformLogScaled)) {
1162 for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
1163 (*wave)->property_logscaled() = yn;
1167 _flags |= WaveformLogScaled;
1169 _flags &= ~WaveformLogScaled;
1177 AudioRegionView::add_ghost (TimeAxisView& tv)
1179 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&trackview);
1182 double unit_position = _region->position () / samples_per_unit;
1183 AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
1186 nchans = rtv->track()->n_channels().n_audio();
1188 for (uint32_t n = 0; n < nchans; ++n) {
1190 if (n >= audio_region()->n_channels()) {
1194 WaveView *wave = new WaveView(*ghost->group);
1196 wave->property_data_src() = _region.get();
1197 wave->property_cache() = wave_caches[n];
1198 wave->property_cache_updater() = false;
1199 wave->property_channel() = n;
1200 wave->property_length_function() = (gpointer)region_length_from_c;
1201 wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
1202 wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
1203 wave->property_x() = 0.0;
1204 wave->property_samples_per_unit() = samples_per_unit;
1205 wave->property_amplitude_above_axis() = _amplitude_above_axis;
1207 wave->property_region_start() = _region->start();
1209 ghost->waves.push_back(wave);
1212 ghost->set_height ();
1213 ghost->set_duration (_region->length() / samples_per_unit);
1214 ghost->set_colors();
1215 ghosts.push_back (ghost);
1221 AudioRegionView::entered (bool internal_editing)
1223 trackview.editor().set_current_trimmable (_region);
1224 trackview.editor().set_current_movable (_region);
1226 if (gain_line && Config->get_show_region_gain ()) {
1227 gain_line->show_all_control_points ();
1230 if (fade_in_handle && !internal_editing) {
1231 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
1232 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
1237 AudioRegionView::exited ()
1239 trackview.editor().set_current_trimmable (boost::shared_ptr<Trimmable>());
1240 trackview.editor().set_current_movable (boost::shared_ptr<Movable>());
1243 gain_line->hide_all_but_selected_control_points ();
1246 if (fade_in_handle) {
1247 fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
1248 fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
1253 AudioRegionView::envelope_active_changed ()
1256 gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
1261 AudioRegionView::set_waveview_data_src()
1263 AudioGhostRegion* agr;
1264 double unit_length= _region->length() / samples_per_unit;
1266 for (uint32_t n = 0; n < waves.size(); ++n) {
1267 // TODO: something else to let it know the channel
1268 waves[n]->property_data_src() = _region.get();
1271 for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
1273 (*i)->set_duration (unit_length);
1275 if((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
1276 for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
1277 (*w)->property_data_src() = _region.get();
1285 AudioRegionView::color_handler ()
1287 //case cMutedWaveForm:
1289 //case cWaveFormClip:
1293 //case cGainLineInactive:
1295 envelope_active_changed();
1300 AudioRegionView::set_frame_color ()
1306 if (_region->opaque()) {
1312 TimeAxisViewItem::set_frame_color ();
1318 if (_region->muted()) {
1319 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get(), MUTED_ALPHA);
1321 wc = ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get();
1323 fc = ARDOUR_UI::config()->canvasvar_SelectedWaveFormFill.get();
1326 if (_region->muted()) {
1327 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA);
1329 wc = ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
1331 fc = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
1333 if (_region->muted()) {
1334 wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
1336 wc = ARDOUR_UI::config()->canvasvar_WaveForm.get();
1338 fc = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
1342 for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
1343 if (_region->muted()) {
1344 (*w)->property_wave_color() = wc;
1346 (*w)->property_wave_color() = wc;
1347 (*w)->property_fill_color() = fc;
1353 AudioRegionView::set_fade_visibility (bool yn)
1356 if (fade_in_shape) {
1357 fade_in_shape->show();
1359 if (fade_out_shape) {
1360 fade_out_shape->show ();
1362 if (fade_in_handle) {
1363 fade_in_handle->show ();
1365 if (fade_out_handle) {
1366 fade_out_handle->show ();
1369 if (fade_in_shape) {
1370 fade_in_shape->hide();
1372 if (fade_out_shape) {
1373 fade_out_shape->hide ();
1375 if (fade_in_handle) {
1376 fade_in_handle->hide ();
1378 if (fade_out_handle) {
1379 fade_out_handle->hide ();
1385 AudioRegionView::update_coverage_frames (LayerDisplay d)
1387 RegionView::update_coverage_frames (d);
1389 if (fade_in_handle) {
1390 fade_in_handle->raise_to_top ();
1391 fade_out_handle->raise_to_top ();
1396 AudioRegionView::show_region_editor ()
1399 editor = new AudioRegionEditor (trackview.session(), audio_region());
1403 editor->set_position (Gtk::WIN_POS_MOUSE);
1409 AudioRegionView::show_fade_line (framepos_t pos)
1411 fade_position_line->property_x1() = trackview.editor().frame_to_pixel (pos);
1412 fade_position_line->property_x2() = trackview.editor().frame_to_pixel (pos);
1413 fade_position_line->show ();
1414 fade_position_line->raise_to_top ();
1418 AudioRegionView::hide_fade_line ()
1420 fade_position_line->hide ();
1425 AudioRegionView::transients_changed ()
1427 AnalysisFeatureList analysis_features = _region->transients();
1429 while (feature_lines.size() < analysis_features.size()) {
1431 ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(*group);
1433 ArdourCanvas::Points points;
1435 points.push_back(Gnome::Art::Point(-1.0, 2.0)); // first x-coord needs to be a non-normal value
1436 points.push_back(Gnome::Art::Point(1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1438 canvas_item->property_points() = points;
1439 canvas_item->property_width_pixels() = 1;
1440 canvas_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
1441 canvas_item->property_first_arrowhead() = TRUE;
1442 canvas_item->property_last_arrowhead() = TRUE;
1443 canvas_item->property_arrow_shape_a() = 11.0;
1444 canvas_item->property_arrow_shape_b() = 0.0;
1445 canvas_item->property_arrow_shape_c() = 4.0;
1447 canvas_item->raise_to_top ();
1448 canvas_item->show ();
1450 canvas_item->set_data ("regionview", this);
1451 canvas_item->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
1453 feature_lines.push_back (make_pair(0, canvas_item));
1456 while (feature_lines.size() > analysis_features.size()) {
1457 ArdourCanvas::Line* line = feature_lines.back().second;
1458 feature_lines.pop_back ();
1462 AnalysisFeatureList::const_iterator i;
1463 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1465 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
1467 ArdourCanvas::Points points;
1469 float *pos = new float;
1470 *pos = trackview.editor().frame_to_pixel (*i);
1472 points.push_back(Gnome::Art::Point(*pos, 2.0)); // first x-coord needs to be a non-normal value
1473 points.push_back(Gnome::Art::Point(*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
1475 (*l).second->property_points() = points;
1476 (*l).second->set_data ("position", pos);
1483 AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
1485 /* Find frame at old pos, calulate new frame then update region transients*/
1486 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1488 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1490 /* Line has been updated in drag so we compare to new_pos */
1492 float* pos = (float*) (*l).second->get_data ("position");
1494 if (rint(new_pos) == rint(*pos)) {
1496 framepos_t old_frame = (*l).first;
1497 framepos_t new_frame = trackview.editor().pixel_to_frame (new_pos);
1499 _region->update_transient (old_frame, new_frame);
1507 AudioRegionView::remove_transient(float pos)
1509 /* Find frame at old pos, calulate new frame then update region transients*/
1510 list<std::pair<framepos_t, ArdourCanvas::Line*> >::iterator l;
1512 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1514 /* Line has been updated in drag so we compare to new_pos */
1515 float *line_pos = (float*) (*l).second->get_data ("position");
1517 if (rint(pos) == rint(*line_pos)) {
1518 _region->remove_transient ((*l).first);
1525 AudioRegionView::thaw_after_trim ()
1527 RegionView::thaw_after_trim ();
1533 AudioRegionView::redraw_start_xfade ()
1535 boost::shared_ptr<AudioRegion> ar (audio_region());
1537 if (!ar->fade_in() || ar->fade_in()->empty()) {
1541 if (!ar->fade_in_is_xfade()) {
1542 if (start_xfade_in) {
1543 start_xfade_in->hide ();
1544 start_xfade_out->hide ();
1545 start_xfade_rect->hide ();
1550 redraw_start_xfade_to (ar, ar->fade_in()->back()->when);
1554 AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
1556 int32_t const npoints = trackview.editor().frame_to_pixel (len);
1562 if (!start_xfade_in) {
1563 start_xfade_in = new ArdourCanvas::Line (*group);
1564 start_xfade_in->property_width_pixels() = 1;
1565 start_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
1568 if (!start_xfade_out) {
1569 start_xfade_out = new ArdourCanvas::Line (*group);
1570 start_xfade_out->property_width_pixels() = 1;
1571 uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
1572 start_xfade_out->property_fill_color_rgba() = col;
1575 if (!start_xfade_rect) {
1576 start_xfade_rect = new ArdourCanvas::SimpleRect (*group);
1577 start_xfade_rect->property_draw() = true;
1578 start_xfade_rect->property_fill() = true;;
1579 start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
1580 start_xfade_rect->property_outline_pixels() = 0;
1581 start_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
1582 start_xfade_rect->set_data ("regionview", this);
1585 Points* points = get_canvas_points ("xfade edit redraw", npoints);
1586 boost::scoped_ptr<float> vec (new float[npoints]);
1587 double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1.0;
1589 ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
1591 for (int i = 0, pci = 0; i < npoints; ++i) {
1592 Gnome::Art::Point &p ((*points)[pci++]);
1594 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1597 start_xfade_rect->property_x1() = ((*points)[0]).get_x();
1598 start_xfade_rect->property_y1() = 1.0;
1599 start_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
1600 start_xfade_rect->property_y2() = effective_height;
1601 start_xfade_rect->show ();
1602 start_xfade_rect->raise_to_top ();
1604 start_xfade_in->property_points() = *points;
1605 start_xfade_in->show ();
1606 start_xfade_in->raise_to_top ();
1610 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in();
1614 for (int i = 0, pci = 0; i < npoints; ++i) {
1615 Gnome::Art::Point &p ((*points)[pci++]);
1617 p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
1622 inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints);
1624 for (int i = 0, pci = 0; i < npoints; ++i) {
1625 Gnome::Art::Point &p ((*points)[pci++]);
1627 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1631 start_xfade_out->property_points() = *points;
1632 start_xfade_out->show ();
1633 start_xfade_out->raise_to_top ();
1639 AudioRegionView::redraw_end_xfade ()
1641 boost::shared_ptr<AudioRegion> ar (audio_region());
1643 if (!ar->fade_out() || ar->fade_out()->empty()) {
1647 if (!ar->fade_out_is_xfade()) {
1649 end_xfade_in->hide ();
1650 end_xfade_out->hide ();
1651 end_xfade_rect->hide ();
1656 redraw_end_xfade_to (ar, ar->fade_out()->back()->when);
1660 AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
1662 int32_t const npoints = trackview.editor().frame_to_pixel (len);
1668 if (!end_xfade_in) {
1669 end_xfade_in = new ArdourCanvas::Line (*group);
1670 end_xfade_in->property_width_pixels() = 1;
1671 end_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
1674 if (!end_xfade_out) {
1675 end_xfade_out = new ArdourCanvas::Line (*group);
1676 end_xfade_out->property_width_pixels() = 1;
1677 uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
1678 end_xfade_out->property_fill_color_rgba() = col;
1681 if (!end_xfade_rect) {
1682 end_xfade_rect = new ArdourCanvas::SimpleRect (*group);
1683 end_xfade_rect->property_draw() = true;
1684 end_xfade_rect->property_fill() = true;;
1685 end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
1686 end_xfade_rect->property_outline_pixels() = 0;
1687 end_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
1688 end_xfade_rect->set_data ("regionview", this);
1691 Points* points = get_canvas_points ("xfade edit redraw", npoints);
1692 boost::scoped_ptr<float> vec (new float[npoints]);
1694 ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints);
1696 double rend = trackview.editor().frame_to_pixel (_region->length() - len);
1697 double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1;
1699 for (int i = 0, pci = 0; i < npoints; ++i) {
1700 Gnome::Art::Point &p ((*points)[pci++]);
1702 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1705 end_xfade_rect->property_x1() = ((*points)[0]).get_x();
1706 end_xfade_rect->property_y1() = 1;
1707 end_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
1708 end_xfade_rect->property_y2() = effective_height;
1709 end_xfade_rect->show ();
1710 end_xfade_rect->raise_to_top ();
1712 end_xfade_in->property_points() = *points;
1713 end_xfade_in->show ();
1714 end_xfade_in->raise_to_top ();
1718 boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
1722 for (int i = 0, pci = 0; i < npoints; ++i) {
1723 Gnome::Art::Point &p ((*points)[pci++]);
1725 p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
1730 inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
1732 for (int i = 0, pci = 0; i < npoints; ++i) {
1733 Gnome::Art::Point &p ((*points)[pci++]);
1735 p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
1739 end_xfade_out->property_points() = *points;
1740 end_xfade_out->show ();
1741 end_xfade_out->raise_to_top ();
1748 AudioRegionView::hide_xfades ()
1750 if (start_xfade_in) {
1751 start_xfade_in->hide();
1753 if (start_xfade_out) {
1754 start_xfade_out->hide();
1756 if (start_xfade_rect) {
1757 start_xfade_rect->hide ();
1760 end_xfade_in->hide();
1762 if (end_xfade_out) {
1763 end_xfade_out->hide();
1765 if (end_xfade_rect) {
1766 end_xfade_rect->hide ();
1771 AudioRegionView::show_xfades ()
1773 if (start_xfade_in) {
1774 start_xfade_in->show();
1776 if (start_xfade_out) {
1777 start_xfade_out->show();
1779 if (start_xfade_rect) {
1780 start_xfade_rect->show ();
1783 end_xfade_in->show();
1785 if (end_xfade_out) {
1786 end_xfade_out->show();
1788 if (end_xfade_rect) {
1789 end_xfade_rect->show ();
1794 AudioRegionView::drag_start ()
1796 TimeAxisViewItem::drag_start ();
1797 AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&trackview);
1800 AudioStreamView* av = atav->audio_view();
1802 /* this will hide our xfades too */
1803 av->hide_xfades_with (audio_region());
1809 AudioRegionView::drag_end ()
1811 TimeAxisViewItem::drag_end ();
1812 /* fades will be redrawn if they changed */