summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-04-29 17:30:35 +0000
committerCarl Hetherington <carl@carlh.net>2009-04-29 17:30:35 +0000
commite41527d5bac8a9369ddbd4f4f48c66f5b662bfc8 (patch)
treef650457b382ef8921e122dc81ee48aeba6aaf9d9 /libs/ardour/session.cc
parent9e776feac62e7a9609a29fa233f21d5278475a9d (diff)
Only make record button solid red (and big clock red) when things are actually being recorded (ie when record is in progress and one or more tracks are armed). As per mantis #2604.
git-svn-id: svn://localhost/ardour2/branches/3.0@5012 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index fdb396d902..c5904de869 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -140,7 +140,8 @@ Session::Session (AudioEngine &eng,
click_data (0),
click_emphasis_data (0),
main_outs (0),
- _metadata (new SessionMetadata())
+ _metadata (new SessionMetadata()),
+ _have_rec_enabled_diskstream (false)
{
bool new_session;
@@ -223,7 +224,8 @@ Session::Session (AudioEngine &eng,
click_data (0),
click_emphasis_data (0),
main_outs (0),
- _metadata (new SessionMetadata())
+ _metadata (new SessionMetadata()),
+ _have_rec_enabled_diskstream (false)
{
bool new_session;
@@ -2141,6 +2143,8 @@ Session::add_diskstream (boost::shared_ptr<Diskstream> dstream)
/* this will connect to future changes, and check the current length */
diskstream_playlist_changed (dstream);
+ dstream->RecordEnableChanged.connect (mem_fun (*this, &Session::update_have_rec_enabled_diskstream));
+
dstream->prepare ();
}
@@ -4325,3 +4329,28 @@ Session::sync_order_keys (const char* base)
}
+/** @return true if there is at least one record-enabled diskstream, otherwise false */
+bool
+Session::have_rec_enabled_diskstream () const
+{
+ return g_atomic_int_get (&_have_rec_enabled_diskstream) == 1;
+}
+
+/** Update the state of our rec-enabled diskstreams flag */
+void
+Session::update_have_rec_enabled_diskstream ()
+{
+ boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader ();
+ DiskstreamList::iterator i = dsl->begin ();
+ while (i != dsl->end () && (*i)->record_enabled () == false) {
+ ++i;
+ }
+
+ int const old = g_atomic_int_get (&_have_rec_enabled_diskstream);
+
+ g_atomic_int_set (&_have_rec_enabled_diskstream, i != dsl->end () ? 1 : 0);
+
+ if (g_atomic_int_get (&_have_rec_enabled_diskstream) != old) {
+ RecordStateChanged (); /* EMIT SIGNAL */
+ }
+}