From 2292e33ee418070c4d12971a72e01eb29dfc8de9 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 13 Dec 2012 16:42:05 +0000 Subject: 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 --- libs/ardour/ardour/audioplaylist.h | 2 - libs/ardour/ardour/audioregion.h | 18 --- libs/ardour/ardour/playlist.h | 1 - libs/ardour/ardour/session_configuration_vars.h | 3 - libs/ardour/audio_playlist.cc | 206 ------------------------ libs/ardour/audioregion.cc | 120 +------------- libs/ardour/playlist.cc | 27 ---- 7 files changed, 1 insertion(+), 376 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index a5f6b4ef39..478d4872cd 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -49,8 +49,6 @@ public: protected: - void check_crossfades (Evoral::Range); - void pre_combine (std::vector >&); void post_combine (std::vector >&, boost::shared_ptr); void pre_uncombine (std::vector >&, boost::shared_ptr); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 4213dc1a6c..67946caa6f 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -46,10 +46,6 @@ namespace Properties { extern PBD::PropertyDescriptor fade_in_active; extern PBD::PropertyDescriptor fade_out_active; extern PBD::PropertyDescriptor scale_amplitude; - extern PBD::PropertyDescriptor fade_out_is_xfade; - extern PBD::PropertyDescriptor fade_out_is_short; - extern PBD::PropertyDescriptor fade_in_is_xfade; - extern PBD::PropertyDescriptor fade_in_is_short; extern PBD::PropertyDescriptor > fade_in; extern PBD::PropertyDescriptor > inverse_fade_in; extern PBD::PropertyDescriptor > 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 fade_in() { return _fade_in.val (); } boost::shared_ptr inverse_fade_in() { return _inverse_fade_in.val (); } boost::shared_ptr fade_out() { return _fade_out.val (); } @@ -203,10 +189,6 @@ class AudioRegion : public Region PBD::Property _fade_out_active; /** linear gain to apply to the whole region */ PBD::Property _scale_amplitude; - PBD::Property _fade_in_is_xfade; - PBD::Property _fade_out_is_xfade; - PBD::Property _fade_in_is_short; - PBD::Property _fade_out_is_short; void register_properties (); void post_set (const PBD::PropertyChange&); diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 6de772390e..f3277c6b9c 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -336,7 +336,6 @@ public: void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr exclude); void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr exclude); - virtual void check_crossfades (Evoral::Range) {} virtual void remove_dependents (boost::shared_ptr /*region*/) {} virtual XMLNode& state (bool); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 1a4a17ce5d..3e2d21d107 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -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) diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index fe13fe4e68..b008e4ff98 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -256,198 +256,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr return cnt; } -void -AudioPlaylist::check_crossfades (Evoral::Range range) -{ - if (in_set_state || in_partition || !_session.config.get_auto_xfade ()) { - return; - } - - boost::shared_ptr starts = regions_with_start_within (range); - boost::shared_ptr ends = regions_with_end_within (range); - - RegionList all = *starts; - std::copy (ends->begin(), ends->end(), back_inserter (all)); - - all.sort (RegionSortByLayer ()); - - set > done_start; - set > 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 top; - boost::shared_ptr bottom; - - if ((*i)->layer() < (*j)->layer()) { - top = boost::dynamic_pointer_cast (*j); - bottom = boost::dynamic_pointer_cast (*i); - } else { - top = boost::dynamic_pointer_cast (*i); - bottom = boost::dynamic_pointer_cast (*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 r = boost::dynamic_pointer_cast (*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 r = boost::dynamic_pointer_cast (*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); } } diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index a02eb3720b..9694e2430b 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -62,10 +62,6 @@ namespace ARDOUR { PBD::PropertyDescriptor fade_in_active; PBD::PropertyDescriptor fade_out_active; PBD::PropertyDescriptor scale_amplitude; - PBD::PropertyDescriptor fade_out_is_xfade; - PBD::PropertyDescriptor fade_out_is_short; - PBD::PropertyDescriptor fade_in_is_xfade; - PBD::PropertyDescriptor fade_in_is_short; PBD::PropertyDescriptor > fade_in; PBD::PropertyDescriptor > inverse_fade_in; PBD::PropertyDescriptor > 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 (new AutomationList (Evoral::Parameter (FadeInAutomation)))) \ , _inverse_fade_in (Properties::inverse_fade_in, boost::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation)))) \ , _fade_out (Properties::fade_out, boost::shared_ptr (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 (new AutomationList (*other->_fade_in.val()))) \ , _inverse_fade_in (Properties::fade_in, boost::shared_ptr (new AutomationList (*other->_inverse_fade_in.val()))) \ , _fade_out (Properties::fade_in, boost::shared_ptr (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 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 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 (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 AudioRegion::get_single_other_xfade_region (bool start) const { diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index d6347d1c10..4e731ee06c 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -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))); return true; @@ -1095,8 +1091,6 @@ Playlist::flush_notifications (bool from_undo) in_partition = false; } - - check_crossfades (Evoral::Range (start, end)); } boost::shared_ptr @@ -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) { set_layer (region, region->layer() + 1.5); relayer (); - check_crossfades (region->range ()); } void @@ -2429,7 +2409,6 @@ Playlist::lower_region (boost::shared_ptr 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) { set_layer (region, DBL_MAX); relayer (); - check_crossfades (region->range ()); } void @@ -2445,7 +2423,6 @@ Playlist::lower_region_to_bottom (boost::shared_ptr region) { set_layer (region, -0.5); relayer (); - check_crossfades (region->range ()); } void @@ -3115,10 +3092,6 @@ restart: } } } - - for (list >::iterator i = ranges.begin(); i != ranges.end(); ++i) { - check_crossfades (*i); - } } void -- cgit v1.2.3