always create short xfades when adding a region based on capture

git-svn-id: svn://localhost/ardour2/branches/3.0@12443 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-24 22:03:19 +00:00
parent f94e66e095
commit 9dae320b12
4 changed files with 37 additions and 15 deletions

View file

@ -222,6 +222,8 @@ public:
uint32_t combine_ops() const { return _combine_ops; } uint32_t combine_ops() const { return _combine_ops; }
void set_layer (boost::shared_ptr<Region>, double); void set_layer (boost::shared_ptr<Region>, double);
void set_capture_insertion_in_progress (bool yn);
protected: protected:
friend class Session; friend class Session;
@ -286,6 +288,7 @@ public:
bool in_flush; bool in_flush;
bool in_partition; bool in_partition;
bool _frozen; bool _frozen;
bool _capture_insertion_underway;
uint32_t subcnt; uint32_t subcnt;
PBD::ID _orig_track_id; PBD::ID _orig_track_id;
uint32_t _combine_ops; uint32_t _combine_ops;

View file

@ -1476,6 +1476,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
// cerr << _name << ": there are " << capture_info.size() << " capture_info records\n"; // cerr << _name << ": there are " << capture_info.size() << " capture_info records\n";
_playlist->clear_changes (); _playlist->clear_changes ();
_playlist->set_capture_insertion_in_progress (true);
_playlist->freeze (); _playlist->freeze ();
for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) { for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
@ -1514,6 +1515,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
} }
_playlist->thaw (); _playlist->thaw ();
_playlist->set_capture_insertion_in_progress (false);
_session.add_command (new StatefulDiffCommand (_playlist)); _session.add_command (new StatefulDiffCommand (_playlist));
} }

View file

@ -314,13 +314,18 @@ AudioPlaylist::check_crossfades (Evoral::Range<framepos_t> range)
/* Top's fade-in will cause an implicit fade-out of bottom */ /* Top's fade-in will cause an implicit fade-out of bottom */
framecnt_t len = 0; framecnt_t len = 0;
switch (_session.config.get_xfade_model()) {
case FullCrossfade: if (_capture_insertion_underway) {
len = bottom->last_frame () - top->first_frame ();
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate(); len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
break; } else {
switch (_session.config.get_xfade_model()) {
case FullCrossfade:
len = bottom->last_frame () - top->first_frame ();
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
break;
}
} }
top->set_fade_in_active (true); top->set_fade_in_active (true);
@ -357,13 +362,18 @@ AudioPlaylist::check_crossfades (Evoral::Range<framepos_t> range)
/* Top's fade-out will cause an implicit fade-in of bottom */ /* Top's fade-out will cause an implicit fade-in of bottom */
framecnt_t len = 0; framecnt_t len = 0;
switch (_session.config.get_xfade_model()) {
case FullCrossfade: if (_capture_insertion_underway) {
len = top->last_frame () - bottom->first_frame ();
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate(); len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
break; } else {
switch (_session.config.get_xfade_model()) {
case FullCrossfade:
len = top->last_frame () - bottom->first_frame ();
break;
case ShortCrossfade:
len = _session.config.get_short_xfade_seconds() * _session.frame_rate();
break;
}
} }
top->set_fade_out_active (true); top->set_fade_out_active (true);

View file

@ -47,9 +47,9 @@ using namespace ARDOUR;
using namespace PBD; using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
namespace Properties { namespace Properties {
PBD::PropertyDescriptor<bool> regions; PBD::PropertyDescriptor<bool> regions;
} }
} }
struct ShowMeTheList { struct ShowMeTheList {
@ -311,6 +311,7 @@ Playlist::init (bool hide)
in_partition = false; in_partition = false;
subcnt = 0; subcnt = 0;
_frozen = false; _frozen = false;
_capture_insertion_underway = false;
_combine_ops = 0; _combine_ops = 0;
_session.history().BeginUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::begin_undo, this)); _session.history().BeginUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::begin_undo, this));
@ -3108,3 +3109,9 @@ restart:
check_crossfades (*i); check_crossfades (*i);
} }
} }
void
Playlist::set_capture_insertion_in_progress (bool yn)
{
_capture_insertion_underway = yn;
}