crossfade hack and slash. removed overlap checks, overlap mode, default length, fade_is_xfade, fade_is_short, and other leftovers from previous crossfade models. Draw crossfade drags in realtime so fade_line is no longer needed. remove code for hiding crossfades during a drag. moved crossfade rect to top layer so crossfade lines dont grab mouse focus. drag-trim-with-fixed-fade-anchor is partially implemented and needs discussion

git-svn-id: svn://localhost/ardour2/branches/3.0@13659 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Ben Loftis 2012-12-13 16:42:05 +00:00
parent 1224fc0700
commit 2292e33ee4
16 changed files with 134 additions and 585 deletions

View File

@ -77,7 +77,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
, fade_out_shape(0)
, fade_in_handle(0)
, fade_out_handle(0)
, fade_position_line(0)
, start_xfade_in (0)
, start_xfade_out (0)
, start_xfade_rect (0)
@ -100,7 +99,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
, fade_out_shape(0)
, fade_in_handle(0)
, fade_out_handle(0)
, fade_position_line(0)
, start_xfade_in (0)
, start_xfade_out (0)
, start_xfade_rect (0)
@ -121,7 +119,6 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt
, fade_out_shape(0)
, fade_in_handle(0)
, fade_out_handle(0)
, fade_position_line(0)
, start_xfade_in (0)
, start_xfade_out (0)
, start_xfade_rect (0)
@ -178,13 +175,6 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
fade_out_handle->set_data ("regionview", this);
fade_position_line = new ArdourCanvas::SimpleLine (*group);
fade_position_line->property_color_rgba() = 0xBBBBBBAA;
fade_position_line->property_y1() = 7;
fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
fade_position_line->hide();
}
setup_fade_handle_positions ();
@ -286,12 +276,6 @@ AudioRegionView::region_changed (const PropertyChange& what_changed)
if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
fade_out_active_changed ();
}
if (what_changed.contains (ARDOUR::Properties::fade_in_is_xfade)) {
fade_in_changed ();
}
if (what_changed.contains (ARDOUR::Properties::fade_out_is_xfade)) {
fade_out_changed ();
}
if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
envelope_active_changed ();
}
@ -523,16 +507,6 @@ AudioRegionView::set_height (gdouble height)
(*l).second->property_points() = points;
}
if (fade_position_line) {
if (height < NAME_HIGHLIGHT_THRESH) {
fade_position_line->property_y2() = _height - 1;
}
else {
fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
}
}
if (name_pixbuf) {
name_pixbuf->raise_to_top();
}
@ -554,25 +528,7 @@ AudioRegionView::reset_fade_in_shape ()
void
AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
{
if (dragging()) {
return;
}
if (audio_region()->fade_in_is_xfade()) {
if (fade_in_handle) {
fade_in_handle->hide ();
fade_in_shape->hide ();
}
redraw_start_xfade ();
return;
} else {
if (start_xfade_in) {
start_xfade_in->hide ();
start_xfade_out->hide ();
start_xfade_rect->hide ();
_start_xfade_visible = false;
}
}
redraw_start_xfade ();
if (fade_in_handle == 0) {
return;
@ -591,12 +547,6 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
double h;
if (_height < 5) {
fade_in_shape->hide();
fade_in_handle->hide();
return;
}
double const handle_center = pwidth;
/* Put the fade in handle so that its left side is at the end-of-fade line */
@ -620,7 +570,7 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
if (_height >= NAME_HIGHLIGHT_THRESH) {
h = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
h = _height;
h = _height - 2;
}
/* points *MUST* be in anti-clockwise order */
@ -663,26 +613,7 @@ AudioRegionView::reset_fade_out_shape ()
void
AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
{
if (dragging() && audio_region()->fade_out_is_xfade()) {
/* we hide xfades while dragging regions */
return;
}
if (audio_region()->fade_out_is_xfade()) {
if (fade_out_handle) {
fade_out_handle->hide ();
fade_out_shape->hide ();
}
redraw_end_xfade ();
return;
} else {
if (end_xfade_in) {
end_xfade_in->hide ();
end_xfade_out->hide ();
end_xfade_rect->hide ();
_end_xfade_visible = false;
}
}
redraw_end_xfade ();
if (fade_out_handle == 0) {
return;
@ -701,12 +632,6 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
double h;
if (_height < 5) {
fade_out_shape->hide();
fade_out_handle->hide();
return;
}
double const handle_center = (_region->length() - width) / samples_per_unit;
/* Put the fade out handle so that its right side is at the end-of-fade line;
@ -732,7 +657,7 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
if (_height >= NAME_HIGHLIGHT_THRESH) {
h = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
h = _height;
h = _height - 2;
}
/* points *MUST* be in anti-clockwise order */
@ -1346,23 +1271,6 @@ AudioRegionView::show_region_editor ()
editor->show_all();
}
void
AudioRegionView::show_fade_line (framepos_t pos)
{
fade_position_line->property_x1() = trackview.editor().frame_to_pixel (pos);
fade_position_line->property_x2() = trackview.editor().frame_to_pixel (pos);
fade_position_line->show ();
fade_position_line->raise_to_top ();
}
void
AudioRegionView::hide_fade_line ()
{
fade_position_line->hide ();
}
void
AudioRegionView::transients_changed ()
{
@ -1480,15 +1388,7 @@ AudioRegionView::redraw_start_xfade ()
return;
}
if (!ar->fade_in_is_xfade()) {
if (start_xfade_in) {
start_xfade_in->hide ();
start_xfade_out->hide ();
start_xfade_rect->hide ();
_start_xfade_visible = false;
}
return;
}
show_start_xfade();
redraw_start_xfade_to (ar, ar->fade_in()->back()->when);
}
@ -1511,7 +1411,7 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
if (!start_xfade_out) {
start_xfade_out = new ArdourCanvas::Line (*group);
start_xfade_out->property_width_pixels() = 1;
uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 255);
start_xfade_out->property_fill_color_rgba() = col;
}
@ -1527,7 +1427,13 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
Points* points = get_canvas_points ("xfade edit redraw", npoints);
boost::scoped_array<float> vec (new float[npoints]);
double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1.0;
double effective_height;
if (_height >= NAME_HIGHLIGHT_THRESH) {
effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
effective_height = _height - 2;
}
ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
@ -1542,7 +1448,6 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
start_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
start_xfade_rect->property_y2() = effective_height;
start_xfade_rect->show ();
start_xfade_rect->raise_to_top ();
start_xfade_in->property_points() = *points;
start_xfade_in->show ();
@ -1575,7 +1480,9 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
start_xfade_out->show ();
start_xfade_out->raise_to_top ();
_start_xfade_visible = true;
start_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
show_start_xfade();
delete points;
}
@ -1589,15 +1496,7 @@ AudioRegionView::redraw_end_xfade ()
return;
}
if (!ar->fade_out_is_xfade()) {
if (end_xfade_in) {
end_xfade_in->hide ();
end_xfade_out->hide ();
end_xfade_rect->hide ();
_end_xfade_visible = false;
}
return;
}
show_end_xfade();
redraw_end_xfade_to (ar, ar->fade_out()->back()->when);
}
@ -1620,7 +1519,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
if (!end_xfade_out) {
end_xfade_out = new ArdourCanvas::Line (*group);
end_xfade_out->property_width_pixels() = 1;
uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 255);
end_xfade_out->property_fill_color_rgba() = col;
}
@ -1640,7 +1539,13 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints);
double rend = trackview.editor().frame_to_pixel (_region->length() - len);
double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1;
double effective_height;
if (_height >= NAME_HIGHLIGHT_THRESH) {
effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
effective_height = _height - 2;
}
for (int i = 0, pci = 0; i < npoints; ++i) {
Gnome::Art::Point &p ((*points)[pci++]);
@ -1653,7 +1558,6 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
end_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
end_xfade_rect->property_y2() = effective_height;
end_xfade_rect->show ();
end_xfade_rect->raise_to_top ();
end_xfade_in->property_points() = *points;
end_xfade_in->show ();
@ -1686,7 +1590,9 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
end_xfade_out->show ();
end_xfade_out->raise_to_top ();
_end_xfade_visible = true;
end_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
show_end_xfade();
delete points;
}
@ -1773,15 +1679,8 @@ void
AudioRegionView::drag_start ()
{
TimeAxisViewItem::drag_start ();
AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&trackview);
if (atav) {
AudioStreamView* av = atav->audio_view();
if (av) {
/* this will hide our xfades too */
_hidden_xfades = av->hide_xfades_with (audio_region());
}
}
//we used to hide xfades here. I don't see the point with the new model, but we can re-implement if needed
}
void
@ -1789,16 +1688,7 @@ AudioRegionView::drag_end ()
{
TimeAxisViewItem::drag_end ();
for (list<AudioRegionView*>::iterator i = _hidden_xfades.first.begin(); i != _hidden_xfades.first.end(); ++i) {
(*i)->show_start_xfade ();
}
for (list<AudioRegionView*>::iterator i = _hidden_xfades.second.begin(); i != _hidden_xfades.second.end(); ++i) {
(*i)->show_end_xfade ();
}
_hidden_xfades.first.clear ();
_hidden_xfades.second.clear ();
//see comment for drag_start
}
void

View File

@ -97,9 +97,6 @@ class AudioRegionView : public RegionView
framepos_t get_fade_in_shape_width ();
framepos_t get_fade_out_shape_width ();
void show_fade_line(framepos_t pos);
void hide_fade_line();
void set_fade_visibility (bool);
void update_coverage_frames (LayerDisplay);
@ -159,7 +156,6 @@ class AudioRegionView : public RegionView
ArdourCanvas::Polygon* fade_out_shape;
ArdourCanvas::SimpleRect* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::SimpleRect* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::SimpleLine* fade_position_line;
ArdourCanvas::Line *start_xfade_in;
ArdourCanvas::Line *start_xfade_out;

View File

@ -383,7 +383,10 @@ Editor::canvas_start_xfade_event (GdkEvent *event, ArdourCanvas::Item* item, Aud
}
return typed_event (item, event, StartCrossFadeItem);
/* In Mixbus, the crossfade area is used to trim the region while leaving the fade anchor intact (see preserve_fade_anchor)*/
/* however in A3 this feature is unfinished, and it might be better to do it with a modifier-trim instead, anyway */
/* if we return RegionItem here then we avoid the issue until it is resolved later */
return typed_event (item, event, RegionItem); // StartCrossFadeItem);
}
bool

View File

@ -1597,10 +1597,11 @@ NoteResizeDrag::aborted (bool)
}
}
TrimDrag::TrimDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v)
TrimDrag::TrimDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool preserve_fade_anchor)
: RegionDrag (e, i, p, v)
{
DEBUG_TRACE (DEBUG::Drags, "New TrimDrag\n");
_preserve_fade_anchor = preserve_fade_anchor;
}
void
@ -1722,13 +1723,43 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
switch (_operation) {
case StartTrim:
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
i->view->trim_front (i->initial_position + dt, non_overlap_trim);
bool changed = i->view->trim_front (i->initial_position + dt, non_overlap_trim);
if (changed && _preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
double distance;
double new_length;
framecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when;
new_length = len - _editor->unit_to_frame (distance);
new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
arv->reset_fade_in_shape_width (new_length); //the grey shape
arv->redraw_start_xfade_to (ar, new_length); //the green lines & blue rect
}
}
}
break;
case EndTrim:
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
i->view->trim_end (i->initial_end + dt, non_overlap_trim);
bool changed = i->view->trim_end (i->initial_end + dt, non_overlap_trim);
if (changed && _preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
double distance;
double new_length;
framecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = grab_x() - _drags->current_pointer_x();
len = ar->fade_out()->back()->when;
new_length = len - _editor->unit_to_frame (distance);
new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
arv->reset_fade_out_shape_width (new_length); //the grey shape
arv->redraw_end_xfade_to (ar, new_length); //the green lines & blue rect (must do this after)
}
}
}
break;
@ -1780,20 +1811,49 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
if (movement_occurred) {
motion (event, false);
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
i->view->drag_end ();
}
/* This must happen before the region's StatefulDiffCommand is created, as it may
`correct' (ahem) the region's _start from being negative to being zero. It
needs to be zero in the undo record.
*/
if (_operation == StartTrim) {
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
i->view->trim_front_ending ();
{
/* This must happen before the region's StatefulDiffCommand is created, as it may
`correct' (ahem) the region's _start from being negative to being zero. It
needs to be zero in the undo record.
*/
i->view->trim_front_ending ();
}
if (_preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
double distance;
double new_length;
framecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when;
new_length = len - _editor->unit_to_frame (distance);
new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
ar->set_fade_in_length(new_length);
}
}
}
} else if (_operation == EndTrim) {
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
if (_preserve_fade_anchor) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (i->view);
if (arv) {
double distance;
double new_length;
framecnt_t len;
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_out()->back()->when;
new_length = len - _editor->unit_to_frame (distance);
new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
ar->set_fade_out_length(new_length);
}
}
}
}
if (_operation == StartTrim) {
_editor->maybe_locate_with_edit_preroll ( _views.begin()->view->region()->position() );
}
@ -2254,8 +2314,6 @@ FadeInDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
boost::shared_ptr<AudioRegion> const r = arv->audio_region ();
show_verbose_cursor_duration (r->position(), r->position() + r->fade_in()->back()->when, 32);
arv->show_fade_line((framepos_t) r->fade_in()->back()->when);
}
void
@ -2292,7 +2350,8 @@ FadeInDrag::motion (GdkEvent* event, bool)
}
tmp->reset_fade_in_shape_width (fade_length);
tmp->show_fade_line((framecnt_t) fade_length);
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
tmp->redraw_start_xfade_to (ar, fade_length);
}
show_verbose_cursor_duration (region->position(), region->position() + fade_length, 32);
@ -2334,7 +2393,6 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
tmp->audio_region()->set_fade_in_length (fade_length);
tmp->audio_region()->set_fade_in_active (true);
tmp->hide_fade_line();
XMLNode &after = alist->get_state();
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
@ -2354,7 +2412,6 @@ FadeInDrag::aborted (bool)
}
tmp->reset_fade_in_shape_width (tmp->audio_region()->fade_in()->back()->when);
tmp->hide_fade_line();
}
}
@ -2373,8 +2430,6 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
boost::shared_ptr<AudioRegion> r = arv->audio_region ();
show_verbose_cursor_duration (r->last_frame() - r->fade_out()->back()->when, r->last_frame());
arv->show_fade_line(r->length() - r->fade_out()->back()->when);
}
void
@ -2413,7 +2468,8 @@ FadeOutDrag::motion (GdkEvent* event, bool)
}
tmp->reset_fade_out_shape_width (fade_length);
tmp->show_fade_line(region->length() - fade_length);
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
tmp->redraw_end_xfade_to (ar, fade_length);
}
show_verbose_cursor_duration (region->last_frame() - fade_length, region->last_frame());
@ -2457,7 +2513,6 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
tmp->audio_region()->set_fade_out_length (fade_length);
tmp->audio_region()->set_fade_out_active (true);
tmp->hide_fade_line();
XMLNode &after = alist->get_state();
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
@ -2477,7 +2532,6 @@ FadeOutDrag::aborted (bool)
}
tmp->reset_fade_out_shape_width (tmp->audio_region()->fade_out()->back()->when);
tmp->hide_fade_line();
}
}
@ -4583,6 +4637,7 @@ CrossfadeEdgeDrag::CrossfadeEdgeDrag (Editor* e, AudioRegionView* rv, ArdourCanv
, arv (rv)
, start (start_yn)
{
std::cout << ("CrossfadeEdgeDrag is DEPRECATED. See TrimDrag::preserve_fade_anchor") << endl;
}
void

View File

@ -515,7 +515,7 @@ public:
ContentsTrim,
};
TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &);
TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
@ -531,6 +531,8 @@ public:
private:
Operation _operation;
bool _preserve_fade_anchor;
};
/** Meter marker drag */

View File

@ -922,11 +922,13 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
}
case StartCrossFadeItem:
_drags->set (new CrossfadeEdgeDrag (this, reinterpret_cast<AudioRegionView*>(item->get_data("regionview")), item, true), event, 0);
break;
case EndCrossFadeItem:
_drags->set (new CrossfadeEdgeDrag (this, reinterpret_cast<AudioRegionView*>(item->get_data("regionview")), item, false), event, 0);
/* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor. for not this is not fully implemented */
// if (!clicked_regionview->region()->locked()) {
// RegionSelection s = get_equivalent_regions (selection->regions, Properties::edit.property_id);
// _drags->set (new TrimDrag (this, item, clicked_regionview, s.by_layer(), true), event);
// return true;
// }
break;
case FeatureLineItem:

View File

@ -834,11 +834,11 @@ RegionView::update_coverage_frames (LayerDisplay d)
}
}
void
bool
RegionView::trim_front (framepos_t new_bound, bool no_overlap)
{
if (_region->locked()) {
return;
return false;
}
RouteTimeAxisView& rtv = dynamic_cast<RouteTimeAxisView&> (trackview);
@ -866,13 +866,15 @@ RegionView::trim_front (framepos_t new_bound, bool no_overlap)
}
region_changed (ARDOUR::bounds_change);
return (pre_trim_first_frame != _region->first_frame()); //return true if we actually changed something
}
void
bool
RegionView::trim_end (framepos_t new_bound, bool no_overlap)
{
if (_region->locked()) {
return;
return false;
}
RouteTimeAxisView& rtv = dynamic_cast<RouteTimeAxisView&> (trackview);
@ -903,6 +905,8 @@ RegionView::trim_end (framepos_t new_bound, bool no_overlap)
} else {
region_changed (PropertyChange (ARDOUR::Properties::length));
}
return (pre_trim_last_frame != _region->last_frame()); //return true if we actually changed something
}

View File

@ -107,12 +107,12 @@ class RegionView : public TimeAxisViewItem
/** Called when a front trim is about to begin */
virtual void trim_front_starting () {}
void trim_front (framepos_t, bool);
bool trim_front (framepos_t, bool);
/** Called when a start trim has finished */
virtual void trim_front_ending () {}
void trim_end (framepos_t, bool);
bool trim_end (framepos_t, bool);
void trim_contents (framepos_t, bool, bool);
virtual void thaw_after_trim ();

View File

@ -131,21 +131,9 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
/* FADES */
ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
"xfade-model",
_("Crossfades are created"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
);
cfm->add (FullCrossfade, _("to span entire overlap"));
cfm->add (ShortCrossfade, _("short"));
add_option (_("Fades"), cfm);
ComboOption<CrossfadeChoice>* cfc = new ComboOption<CrossfadeChoice> (
"xfade-choice",
_("Crossfade type"),
_("Default crossfade type"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_choice),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice)
);
@ -156,15 +144,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
add_option (_("Fades"), cfc);
add_option (_("Fades"), new SpinOption<float> (
_("short-xfade-seconds"),
_("Short crossfade length"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
0, 1000, 1, 10,
_("ms"), 0.001
));
add_option (_("Fades"), new SpinOption<float> (
_("destructive-xfade-seconds"),
_("Destructive crossfade length"),
@ -174,13 +153,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
_("ms")
));
add_option (_("Fades"), new BoolOption (
"auto-xfade",
_("Create crossfades automatically"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
));
add_option (_("Fades"), new BoolOption (
"use-region-fades",
_("Region fades active"),
@ -243,7 +215,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
add_option (_("Monitoring"), new BoolOption (
"auto-input",
_("Monitoring automatically follows transport state (\"auto-input\")"),
_("Track Input Monitoring automatically follows transport state (\"auto-input\")"),
sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
));

View File

@ -49,8 +49,6 @@ public:
protected:
void check_crossfades (Evoral::Range<framepos_t>);
void pre_combine (std::vector<boost::shared_ptr<Region> >&);
void post_combine (std::vector<boost::shared_ptr<Region> >&, boost::shared_ptr<Region>);
void pre_uncombine (std::vector<boost::shared_ptr<Region> >&, boost::shared_ptr<Region>);

View File

@ -46,10 +46,6 @@ namespace Properties {
extern PBD::PropertyDescriptor<bool> fade_in_active;
extern PBD::PropertyDescriptor<bool> fade_out_active;
extern PBD::PropertyDescriptor<float> scale_amplitude;
extern PBD::PropertyDescriptor<bool> fade_out_is_xfade;
extern PBD::PropertyDescriptor<bool> fade_out_is_short;
extern PBD::PropertyDescriptor<bool> fade_in_is_xfade;
extern PBD::PropertyDescriptor<bool> fade_in_is_short;
extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_in;
extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_in;
extern PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_out;
@ -88,16 +84,6 @@ class AudioRegion : public Region
bool fade_in_active () const { return _fade_in_active; }
bool fade_out_active () const { return _fade_out_active; }
bool fade_in_is_xfade() const { return _fade_in_is_xfade; }
void set_fade_in_is_xfade (bool yn);
bool fade_out_is_xfade() const { return _fade_out_is_xfade; }
void set_fade_out_is_xfade (bool yn);
bool fade_in_is_short() const { return _fade_in_is_short; }
void set_fade_in_is_short (bool yn);
bool fade_out_is_short() const { return _fade_out_is_short; }
void set_fade_out_is_short (bool yn);
boost::shared_ptr<AutomationList> fade_in() { return _fade_in.val (); }
boost::shared_ptr<AutomationList> inverse_fade_in() { return _inverse_fade_in.val (); }
boost::shared_ptr<AutomationList> fade_out() { return _fade_out.val (); }
@ -203,10 +189,6 @@ class AudioRegion : public Region
PBD::Property<bool> _fade_out_active;
/** linear gain to apply to the whole region */
PBD::Property<gain_t> _scale_amplitude;
PBD::Property<bool> _fade_in_is_xfade;
PBD::Property<bool> _fade_out_is_xfade;
PBD::Property<bool> _fade_in_is_short;
PBD::Property<bool> _fade_out_is_short;
void register_properties ();
void post_set (const PBD::PropertyChange&);

View File

@ -336,7 +336,6 @@ public:
void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
virtual void check_crossfades (Evoral::Range<framepos_t>) {}
virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {}
virtual XMLNode& state (bool);

View File

@ -25,10 +25,7 @@
the value of the variable.
*****************************************************/
CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", FullCrossfade)
CONFIG_VARIABLE (CrossfadeChoice, xfade_choice, "xfade-choice", ConstantPowerMinus3dB)
CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true)
CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015)
CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
CONFIG_VARIABLE (bool, use_region_fades, "use-region-fades", true)
CONFIG_VARIABLE (bool, show_region_fades, "show-region-fades", true)

View File

@ -256,198 +256,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
return cnt;
}
void
AudioPlaylist::check_crossfades (Evoral::Range<framepos_t> range)
{
if (in_set_state || in_partition || !_session.config.get_auto_xfade ()) {
return;
}
boost::shared_ptr<RegionList> starts = regions_with_start_within (range);
boost::shared_ptr<RegionList> ends = regions_with_end_within (range);
RegionList all = *starts;
std::copy (ends->begin(), ends->end(), back_inserter (all));
all.sort (RegionSortByLayer ());
set<boost::shared_ptr<Region> > done_start;
set<boost::shared_ptr<Region> > done_end;
for (RegionList::reverse_iterator i = all.rbegin(); i != all.rend(); ++i) {
for (RegionList::reverse_iterator j = all.rbegin(); j != all.rend(); ++j) {
if (i == j) {
continue;
}
if ((*i)->muted() || (*j)->muted()) {
continue;
}
if ((*i)->position() == (*j)->position() && ((*i)->length() == (*j)->length())) {
/* precise overlay: no xfade */
continue;
}
if ((*i)->position() == (*j)->position() || ((*i)->last_frame() == (*j)->last_frame())) {
/* starts or ends match: no xfade */
continue;
}
boost::shared_ptr<AudioRegion> top;
boost::shared_ptr<AudioRegion> bottom;
if ((*i)->layer() < (*j)->layer()) {
top = boost::dynamic_pointer_cast<AudioRegion> (*j);
bottom = boost::dynamic_pointer_cast<AudioRegion> (*i);
} else {
top = boost::dynamic_pointer_cast<AudioRegion> (*i);
bottom = boost::dynamic_pointer_cast<AudioRegion> (*j);
}
if (!top->opaque ()) {
continue;
}
Evoral::OverlapType const c = top->coverage (bottom->position(), bottom->last_frame());
if (c == Evoral::OverlapStart) {
/* top starts within bottom but covers bottom's end */
/* { ==== top ============ }
* [---- bottom -------------------]
*/
if (done_start.find (top) == done_start.end() && done_end.find (bottom) == done_end.end ()) {
/* Top's fade-in will cause an implicit fade-out of bottom */
if (top->fade_in_is_xfade() && top->fade_in_is_short()) {
/* its already an xfade. if its
* really short, leave it
* alone.
*/
} else {
framecnt_t len = 0;
if (_capture_insertion_underway) {
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
} else {
switch (_session.config.get_xfade_model()) {
case FullCrossfade:
len = bottom->last_frame () - top->first_frame () + 1;
top->set_fade_in_is_short (false);
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
top->set_fade_in_is_short (true);
break;
}
}
top->set_fade_in_active (true);
top->set_fade_in_is_xfade (true);
/* XXX may 2012: -3dB and -6dB curves
* are the same right now
*/
switch (_session.config.get_xfade_choice ()) {
case ConstantPowerMinus3dB:
top->set_fade_in (FadeConstantPower, len);
break;
case ConstantPowerMinus6dB:
top->set_fade_in (FadeConstantPower, len);
break;
case RegionFades:
top->set_fade_in_length (len);
break;
}
}
done_start.insert (top);
}
} else if (c == Evoral::OverlapEnd) {
/* top covers start of bottom but ends within it */
/* [---- top ------------------------]
* { ==== bottom ============ }
*/
if (done_end.find (top) == done_end.end() && done_start.find (bottom) == done_start.end ()) {
/* Top's fade-out will cause an implicit fade-in of bottom */
if (top->fade_out_is_xfade() && top->fade_out_is_short()) {
/* its already an xfade. if its
* really short, leave it
* alone.
*/
} else {
framecnt_t len = 0;
if (_capture_insertion_underway) {
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
} else {
switch (_session.config.get_xfade_model()) {
case FullCrossfade:
len = top->last_frame () - bottom->first_frame () + 1;
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
break;
}
}
top->set_fade_out_active (true);
top->set_fade_out_is_xfade (true);
switch (_session.config.get_xfade_choice ()) {
case ConstantPowerMinus3dB:
top->set_fade_out (FadeConstantPower, len);
break;
case ConstantPowerMinus6dB:
top->set_fade_out (FadeConstantPower, len);
break;
case RegionFades:
top->set_fade_out_length (len);
break;
}
}
done_end.insert (top);
}
}
}
}
for (RegionList::iterator i = starts->begin(); i != starts->end(); ++i) {
if (done_start.find (*i) == done_start.end()) {
boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (*i);
if (r->fade_in_is_xfade()) {
r->set_default_fade_in ();
}
}
}
for (RegionList::iterator i = ends->begin(); i != ends->end(); ++i) {
if (done_end.find (*i) == done_end.end()) {
boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (*i);
if (r->fade_out_is_xfade()) {
r->set_default_fade_out ();
}
}
}
}
void
AudioPlaylist::dump () const
{
@ -738,13 +546,6 @@ AudioPlaylist::load_legacy_crossfades (const XMLNode& node, int version)
}
}
if ((p = (*i)->property ("follow-overlap")) != 0) {
out_a->set_fade_out_is_short (!string_is_affirmative (p->value()));
} else {
out_a->set_fade_out_is_short (false);
}
out_a->set_fade_out_is_xfade (true);
out_a->set_fade_out_active (true);
} else {
@ -763,13 +564,6 @@ AudioPlaylist::load_legacy_crossfades (const XMLNode& node, int version)
}
}
if ((p = (*i)->property ("follow-overlap")) != 0) {
in_a->set_fade_in_is_short (!string_is_affirmative (p->value()));
} else {
in_a->set_fade_in_is_short (false);
}
in_a->set_fade_in_is_xfade (true);
in_a->set_fade_in_active (true);
}
}

View File

@ -62,10 +62,6 @@ namespace ARDOUR {
PBD::PropertyDescriptor<bool> fade_in_active;
PBD::PropertyDescriptor<bool> fade_out_active;
PBD::PropertyDescriptor<float> scale_amplitude;
PBD::PropertyDescriptor<bool> fade_out_is_xfade;
PBD::PropertyDescriptor<bool> fade_out_is_short;
PBD::PropertyDescriptor<bool> fade_in_is_xfade;
PBD::PropertyDescriptor<bool> fade_in_is_short;
PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_in;
PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > inverse_fade_in;
PBD::PropertyDescriptor<boost::shared_ptr<AutomationList> > fade_out;
@ -161,14 +157,6 @@ AudioRegion::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-active = %1\n", Properties::fade_out_active.property_id));
Properties::scale_amplitude.property_id = g_quark_from_static_string (X_("scale-amplitude"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for scale-amplitude = %1\n", Properties::scale_amplitude.property_id));
Properties::fade_out_is_xfade.property_id = g_quark_from_static_string (X_("fade-out-is-xfade"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-is-xfade = %1\n", Properties::fade_out_is_xfade.property_id));
Properties::fade_out_is_short.property_id = g_quark_from_static_string (X_("fade-out-is-short"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-is-short = %1\n", Properties::fade_out_is_short.property_id));
Properties::fade_in_is_xfade.property_id = g_quark_from_static_string (X_("fade-in-is-xfade"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-is-xfade = %1\n", Properties::fade_in_is_xfade.property_id));
Properties::fade_in_is_short.property_id = g_quark_from_static_string (X_("fade-in-is-short"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-is-short = %1\n", Properties::fade_in_is_short.property_id));
Properties::fade_in.property_id = g_quark_from_static_string (X_("FadeIn"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for FadeIn = %1\n", Properties::fade_in.property_id));
Properties::inverse_fade_in.property_id = g_quark_from_static_string (X_("InverseFadeIn"));
@ -192,10 +180,6 @@ AudioRegion::register_properties ()
add_property (_fade_in_active);
add_property (_fade_out_active);
add_property (_scale_amplitude);
add_property (_fade_out_is_xfade);
add_property (_fade_out_is_short);
add_property (_fade_in_is_xfade);
add_property (_fade_in_is_short);
add_property (_fade_in);
add_property (_inverse_fade_in);
add_property (_fade_out);
@ -210,10 +194,6 @@ AudioRegion::register_properties ()
, _fade_in_active (Properties::fade_in_active, true) \
, _fade_out_active (Properties::fade_out_active, true) \
, _scale_amplitude (Properties::scale_amplitude, 1.0) \
, _fade_in_is_xfade (Properties::fade_in_is_xfade, false) \
, _fade_out_is_xfade (Properties::fade_out_is_xfade, false) \
, _fade_in_is_short (Properties::fade_in_is_short, false) \
, _fade_out_is_short (Properties::fade_out_is_short, false) \
, _fade_in (Properties::fade_in, boost::shared_ptr<AutomationList> (new AutomationList (Evoral::Parameter (FadeInAutomation)))) \
, _inverse_fade_in (Properties::inverse_fade_in, boost::shared_ptr<AutomationList> (new AutomationList (Evoral::Parameter (FadeInAutomation)))) \
, _fade_out (Properties::fade_out, boost::shared_ptr<AutomationList> (new AutomationList (Evoral::Parameter (FadeOutAutomation)))) \
@ -226,10 +206,6 @@ AudioRegion::register_properties ()
, _fade_in_active (Properties::fade_in_active, other->_fade_in_active) \
, _fade_out_active (Properties::fade_out_active, other->_fade_out_active) \
, _scale_amplitude (Properties::scale_amplitude, other->_scale_amplitude) \
, _fade_in_is_xfade (Properties::fade_in_is_xfade, other->_fade_in_is_xfade) \
, _fade_out_is_xfade (Properties::fade_out_is_xfade, other->_fade_out_is_xfade) \
, _fade_in_is_short (Properties::fade_in_is_short, other->_fade_in_is_short) \
, _fade_out_is_short (Properties::fade_out_is_short, other->_fade_out_is_short) \
, _fade_in (Properties::fade_in, boost::shared_ptr<AutomationList> (new AutomationList (*other->_fade_in.val()))) \
, _inverse_fade_in (Properties::fade_in, boost::shared_ptr<AutomationList> (new AutomationList (*other->_inverse_fade_in.val()))) \
, _fade_out (Properties::fade_in, boost::shared_ptr<AutomationList> (new AutomationList (*other->_fade_out.val()))) \
@ -505,11 +481,6 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
return 0;
}
if (muted()) {
return 0; /* read nothing */
}
/* WORK OUT WHERE TO GET DATA FROM */
framecnt_t to_read;
@ -916,12 +887,6 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
}
}
/* legacy a3 */
if ((prop = child->property ("is-xfade")) != 0) {
_fade_in_is_xfade = string_is_affirmative (prop->value());
}
} else if (child->name() == "FadeOut") {
_fade_out->clear ();
@ -942,13 +907,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
set_fade_out_active (false);
}
}
/* legacy a3 */
if ((prop = child->property ("is-xfade")) != 0) {
_fade_out_is_xfade = string_is_affirmative (prop->value());
}
} else if (child->name() == "InvFadeIn") {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
@ -1170,20 +1129,6 @@ AudioRegion::set_fade_in_length (framecnt_t len)
_inverse_fade_in->extend_to (len);
}
if (_session.config.get_xfade_model() == FullCrossfade &&
_session.config.get_auto_xfade() &&
_fade_in_is_xfade && !_fade_in_is_short) {
/* trim a single other region below us to the new start
of the fade.
*/
boost::shared_ptr<Region> other = get_single_other_xfade_region (true);
if (other) {
other->trim_end (position() + len);
}
}
_default_fade_in = false;
send_change (PropertyChange (Properties::fade_in));
}
@ -1208,20 +1153,6 @@ AudioRegion::set_fade_out_length (framecnt_t len)
_inverse_fade_out->extend_to (len);
}
_default_fade_out = false;
if (_session.config.get_xfade_model() == FullCrossfade &&
_session.config.get_auto_xfade() &&
_fade_out_is_xfade && !_fade_out_is_short) {
/* trim a single other region below us to the new start
of the fade.
*/
boost::shared_ptr<Region> other = get_single_other_xfade_region (false);
if (other) {
other->trim_front (last_frame() - len);
}
}
send_change (PropertyChange (Properties::fade_out));
}
@ -1264,8 +1195,6 @@ void
AudioRegion::set_default_fade_in ()
{
_fade_in_suspended = 0;
_fade_in_is_xfade = false;
_fade_in_is_short = true;
set_fade_in (FadeLinear, 64);
}
@ -1273,8 +1202,6 @@ void
AudioRegion::set_default_fade_out ()
{
_fade_out_suspended = 0;
_fade_out_is_xfade = false;
_fade_out_is_short = true;
set_fade_out (FadeLinear, 64);
}
@ -1843,51 +1770,6 @@ AudioRegion::body_range () const
return Evoral::Range<framepos_t> (first_frame() + _fade_in->back()->when + 1, last_frame() - _fade_out->back()->when);
}
void
AudioRegion::set_fade_in_is_xfade (bool yn)
{
if (yn == _fade_in_is_xfade) {
return;
}
_fade_in_is_xfade = yn;
send_change (PropertyChange (Properties::fade_in_is_xfade));
}
void
AudioRegion::set_fade_out_is_xfade (bool yn)
{
if (yn == _fade_out_is_xfade) {
return;
}
_fade_out_is_xfade = yn;
send_change (PropertyChange (Properties::fade_out_is_xfade));
}
void
AudioRegion::set_fade_in_is_short (bool yn)
{
if (yn == _fade_in_is_short) {
return;
}
_fade_in_is_short = yn;
send_change (PropertyChange (Properties::fade_in_is_short));
}
void
AudioRegion::set_fade_out_is_short (bool yn)
{
if (yn == _fade_out_is_short) {
return;
}
_fade_out_is_short = yn;
send_change (PropertyChange (Properties::fade_out_is_short));
}
boost::shared_ptr<Region>
AudioRegion::get_single_other_xfade_region (bool start) const
{

View File

@ -751,10 +751,6 @@ Playlist::flush_notifications (bool from_undo)
notify_region_added (region);
if (!holding_state ()) {
check_crossfades (region->range ());
}
region->PropertyChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr<Region> (region)));
return true;
@ -1095,8 +1091,6 @@ Playlist::flush_notifications (bool from_undo)
in_partition = false;
}
check_crossfades (Evoral::Range<framepos_t> (start, end));
}
boost::shared_ptr<Playlist>
@ -1553,10 +1547,6 @@ Playlist::flush_notifications (bool from_undo)
save = !(_splicing || _nudging);
}
if (what_changed.contains (our_interests) && !what_changed.contains (pos_and_length)) {
check_crossfades (region->range ());
}
if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) {
notify_region_moved (region);
} else if (!what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) {
@ -2100,15 +2090,6 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
if (seen_region_nodes && regions.empty()) {
ret = -1;
} else {
/* update dependents, which was not done during add_region_internal
due to in_set_state being true
*/
for (RegionList::iterator r = regions.begin(); r != regions.end(); ++r) {
check_crossfades ((*r)->range ());
}
}
thaw ();
@ -2421,7 +2402,6 @@ Playlist::raise_region (boost::shared_ptr<Region> region)
{
set_layer (region, region->layer() + 1.5);
relayer ();
check_crossfades (region->range ());
}
void
@ -2429,7 +2409,6 @@ Playlist::lower_region (boost::shared_ptr<Region> region)
{
set_layer (region, region->layer() - 1.5);
relayer ();
check_crossfades (region->range ());
}
void
@ -2437,7 +2416,6 @@ Playlist::raise_region_to_top (boost::shared_ptr<Region> region)
{
set_layer (region, DBL_MAX);
relayer ();
check_crossfades (region->range ());
}
void
@ -2445,7 +2423,6 @@ Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
{
set_layer (region, -0.5);
relayer ();
check_crossfades (region->range ());
}
void
@ -3115,10 +3092,6 @@ restart:
}
}
}
for (list<Evoral::Range<framepos_t> >::iterator i = ranges.begin(); i != ranges.end(); ++i) {
check_crossfades (*i);
}
}
void