provide Session::have_rec_disabled_track()

This commit is contained in:
Paul Davis 2015-05-08 13:46:42 -04:00
parent 0108f9f18d
commit 9320b51032
2 changed files with 23 additions and 0 deletions

View File

@ -214,6 +214,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
bool have_rec_enabled_track () const;
bool have_rec_disabled_track () const;
bool have_captured() const { return _have_captured; }
@ -1678,6 +1679,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void update_have_rec_enabled_track ();
gint _have_rec_enabled_track;
gint _have_rec_disabled_track;
static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);

View File

@ -269,6 +269,7 @@ Session::Session (AudioEngine &eng,
, first_file_header_format_reset (true)
, have_looped (false)
, _have_rec_enabled_track (false)
, _have_rec_disabled_track (true)
, _step_editors (0)
, _suspend_timecode_transmission (0)
, _speakers (new Speakers)
@ -4977,6 +4978,12 @@ Session::have_rec_enabled_track () const
return g_atomic_int_get (const_cast<gint*>(&_have_rec_enabled_track)) == 1;
}
bool
Session::have_rec_disabled_track () const
{
return g_atomic_int_get (const_cast<gint*>(&_have_rec_disabled_track)) == 1;
}
/** Update the state of our rec-enabled tracks flag */
void
Session::update_have_rec_enabled_track ()
@ -5000,6 +5007,20 @@ Session::update_have_rec_enabled_track ()
if (g_atomic_int_get (&_have_rec_enabled_track) != old) {
RecordStateChanged (); /* EMIT SIGNAL */
}
i = rl->begin();
while (i != rl->end ()) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr && !tr->record_enabled ()) {
break;
}
++i;
}
g_atomic_int_set (&_have_rec_disabled_track, i != rl->end () ? 1 : 0);
}
void