mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
add ::usable() method to TransportMaster objects to allow GUI to show their usability after backend/engine changes
This commit is contained in:
parent
fb4cbb9f9e
commit
37d9ec34c8
4 changed files with 34 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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*);
|
||||
|
|
|
|||
|
|
@ -231,6 +231,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; }
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue