summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-09-16 13:46:06 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-09-17 16:54:10 -0600
commit37d9ec34c86bb18f95e35987b8b62bd4d275787c (patch)
treee64be0ba9299f2e8546870c73b8514d647674612
parentfb4cbb9f9ee61a5c0fec9fa43eff5a0e59d7f9ed (diff)
add ::usable() method to TransportMaster objects to allow GUI to show their usability after backend/engine changes
-rw-r--r--gtk2_ardour/transport_masters_dialog.cc15
-rw-r--r--gtk2_ardour/transport_masters_dialog.h2
-rw-r--r--libs/ardour/ardour/transport_master.h11
-rw-r--r--libs/ardour/engine_slave.cc6
4 files changed, 34 insertions, 0 deletions
diff --git a/gtk2_ardour/transport_masters_dialog.cc b/gtk2_ardour/transport_masters_dialog.cc
index bbf846e688..dcc97e6201 100644
--- a/gtk2_ardour/transport_masters_dialog.cc
+++ b/gtk2_ardour/transport_masters_dialog.cc
@@ -86,6 +86,8 @@ TransportMastersWidget::TransportMastersWidget ()
TransportMasterManager::instance().Added.connect (add_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
TransportMasterManager::instance().Removed.connect (remove_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
+ AudioEngine::instance()->Running.connect (engine_running_connection, invalidator (*this), boost::bind (&TransportMastersWidget::update_usability, this), gui_context());
+
rebuild ();
}
@@ -244,6 +246,19 @@ TransportMastersWidget::rebuild ()
r->prop_change (all_change);
}
+
+ update_usability ();
+}
+
+void
+TransportMastersWidget::update_usability ()
+{
+ for (vector<Row*>::iterator r= rows.begin(); r != rows.end(); ++r) {
+ const bool usable = (*r)->tm->usable();
+ (*r)->use_button.set_sensitive (usable);
+ (*r)->collect_button.set_sensitive (usable);
+ (*r)->request_options.set_sensitive (usable);
+ }
}
TransportMastersWidget::Row::Row (TransportMastersWidget& p)
diff --git a/gtk2_ardour/transport_masters_dialog.h b/gtk2_ardour/transport_masters_dialog.h
index eb9689490a..695bfc9a9f 100644
--- a/gtk2_ardour/transport_masters_dialog.h
+++ b/gtk2_ardour/transport_masters_dialog.h
@@ -143,11 +143,13 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
PBD::ScopedConnection current_connection;
PBD::ScopedConnection add_connection;
PBD::ScopedConnection remove_connection;
+ PBD::ScopedConnection engine_running_connection;
void rebuild ();
void clear ();
void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);
void add_master ();
+ void update_usability ();
public:
bool idle_remove (Row*);
diff --git a/libs/ardour/ardour/transport_master.h b/libs/ardour/ardour/transport_master.h
index ee986f7a9e..3dcfe4cd8f 100644
--- a/libs/ardour/ardour/transport_master.h
+++ b/libs/ardour/ardour/transport_master.h
@@ -232,6 +232,16 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
virtual bool ok() const = 0;
/**
+ * reports to ARDOUR whether it is possible to use this slave
+ *
+ * @return - true if the slave can be used.
+ *
+ * Only the JACK ("Engine") slave is ever likely to return false,
+ * if JACK is not being used for the Audio/MIDI backend.
+ */
+ virtual bool usable() const { return true; }
+
+ /**
* reports to ARDOUR whether the slave is in the process of starting
* to roll
*
@@ -626,6 +636,7 @@ class LIBARDOUR_API Engine_TransportMaster : public TransportMaster
void reset (bool with_position);
bool locked() const;
bool ok() const;
+ bool usable() const;
samplecnt_t update_interval () const;
samplecnt_t resolution () const { return 1; }
bool requires_seekahead () const { return false; }
diff --git a/libs/ardour/engine_slave.cc b/libs/ardour/engine_slave.cc
index d00a2a1bfe..8fdd78a1e8 100644
--- a/libs/ardour/engine_slave.cc
+++ b/libs/ardour/engine_slave.cc
@@ -47,6 +47,12 @@ Engine_TransportMaster::init ()
{
}
+bool
+Engine_TransportMaster::usable () const
+{
+ return AudioEngine::instance()->current_backend_name() == X_("JACK");
+}
+
void
Engine_TransportMaster::check_backend()
{