diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-16 08:44:03 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-16 08:44:03 -0400 |
commit | 90220998af4f9683d696b511a09b34034e799093 (patch) | |
tree | e974251993f9bf8b33c26bdeb117a8759b476d77 /libs/ardour/track.cc | |
parent | d65f03d07455c4ea38084af71a38c383bd2b3e19 (diff) |
add Record-Safe feature to libardour (from Nikolay Polyanovskii)
Diffstat (limited to 'libs/ardour/track.cc')
-rw-r--r-- | libs/ardour/track.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 1426c3926c..92ea993470 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -232,6 +232,10 @@ Track::can_record() void Track::prep_record_enabled (bool yn, void *src) { + if (yn && record_safe ()) { + return; + } + if (!_session.writable()) { return; } @@ -272,6 +276,10 @@ Track::prep_record_enabled (bool yn, void *src) void Track::set_record_enabled (bool yn, void *src) { + if (_diskstream->record_safe ()) { + return; + } + if (!_session.writable()) { return; } @@ -290,6 +298,31 @@ Track::set_record_enabled (bool yn, void *src) _rec_enable_control->Changed (); } +bool +Track::record_safe () const +{ + return _diskstream && _diskstream->record_safe (); +} + +void +Track::set_record_safe (bool yn, void *src) +{ + if (!_session.writable()) { /* REQUIRES REVIEW */ + return; + } + + if (_freeze_record.state == Frozen) { /* REQUIRES REVIEW */ + return; + } + + if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) { + _route_group->apply (&Track::set_record_safe, yn, _route_group); + return; + } + + _diskstream->set_record_safe (yn); +} + void Track::parameter_changed (string const & p) { @@ -558,6 +591,7 @@ Track::set_diskstream (boost::shared_ptr<Diskstream> ds) ds->PlaylistChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_playlist_changed, this)); diskstream_playlist_changed (); ds->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_record_enable_changed, this)); + ds->RecordSafeChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_record_safe_changed, this)); ds->SpeedChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_speed_changed, this)); ds->AlignmentStyleChanged.connect_same_thread (*this, boost::bind (&Track::diskstream_alignment_style_changed, this)); } @@ -575,6 +609,12 @@ Track::diskstream_record_enable_changed () } void +Track::diskstream_record_safe_changed () +{ + RecordSafeChanged (); /* EMIT SIGNAL */ +} + +void Track::diskstream_speed_changed () { SpeedChanged (); /* EMIT SIGNAL */ |