diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-19 20:10:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-19 20:10:35 +0000 |
commit | 9c6984dbbb5583147788876dba80e203c2d38d1a (patch) | |
tree | 4db0a08b1049f8ddd8f237c85474568e8a62e099 /libs/ardour | |
parent | 50ee09e80ff91bf0146e89728578d5e31aba23b7 (diff) |
allow for mandatory control protocols, plus some ongoing work on automation control point selection (unfinished)
git-svn-id: svn://localhost/trunk/ardour2@516 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/control_protocol.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/control_protocol_manager.h | 2 | ||||
-rw-r--r-- | libs/ardour/control_protocol.cc | 4 | ||||
-rw-r--r-- | libs/ardour/control_protocol_manager.cc | 23 |
4 files changed, 31 insertions, 7 deletions
diff --git a/libs/ardour/ardour/control_protocol.h b/libs/ardour/ardour/control_protocol.h index 9a9c14021c..38c6261af5 100644 --- a/libs/ardour/ardour/control_protocol.h +++ b/libs/ardour/ardour/control_protocol.h @@ -83,10 +83,11 @@ class ControlProtocol : public sigc::trackable, public BasicUI { extern "C" { struct ControlProtocolDescriptor { - const char* name; /* descriptive */ - const char* id; /* unique and version-specific */ - void* ptr; /* protocol can store a value here */ - void* module; /* not for public access */ + const char* name; /* descriptive */ + const char* id; /* unique and version-specific */ + void* ptr; /* protocol can store a value here */ + void* module; /* not for public access */ + int mandatory; /* if non-zero, always load and do not make optional */ ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*); void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*); diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index c19649e38b..42b5a69a48 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -22,6 +22,7 @@ struct ControlProtocolInfo { std::string name; std::string path; bool requested; + bool mandatory; }; class ControlProtocolManager : public sigc::trackable, public Stateful @@ -35,6 +36,7 @@ struct ControlProtocolInfo { void set_session (Session&); void discover_control_protocols (std::string search_path); void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>); + void load_mandatory_protocols (); ControlProtocol* instantiate (ControlProtocolInfo&); int teardown (ControlProtocolInfo&); diff --git a/libs/ardour/control_protocol.cc b/libs/ardour/control_protocol.cc index 2d906033ad..1c85df72e5 100644 --- a/libs/ardour/control_protocol.cc +++ b/libs/ardour/control_protocol.cc @@ -163,8 +163,10 @@ ControlProtocol::route_get_rec_enable (uint32_t table_index) AudioTrack* at = dynamic_cast<AudioTrack*>(r); if (at) { - at->record_enabled (); + return at->record_enabled (); } + + return false; } diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 6f3cb4e457..123bc5cdb8 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -45,7 +45,7 @@ ControlProtocolManager::set_session (Session& s) _session->going_away.connect (mem_fun (*this, &ControlProtocolManager::drop_session)); for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { - if ((*i)->requested) { + if ((*i)->requested || (*i)->mandatory) { instantiate (**i); (*i)->requested = false; } @@ -102,6 +102,10 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi) return 0; } + if (cpi.mandatory) { + return 0; + } + cpi.descriptor->destroy (cpi.descriptor, cpi.protocol); { @@ -125,6 +129,21 @@ static bool protocol_filter (const string& str, void *arg) } void +ControlProtocolManager::load_mandatory_protocols () +{ + if (_session == 0) { + return; + } + + for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { + if ((*i)->mandatory && ((*i)->protocol == 0)) { + info << string_compose (_("Instantiating mandatory control protocol %1"), (*i)->name) << endmsg; + instantiate (**i); + } + } +} + +void ControlProtocolManager::discover_control_protocols (string path) { vector<string *> *found; @@ -156,13 +175,13 @@ ControlProtocolManager::control_protocol_discover (string path) info->path = path; info->protocol = 0; info->requested = false; + info->mandatory = descriptor->mandatory; control_protocol_info.push_back (info); cerr << "discovered control surface protocol \"" << info->name << '"' << endl; dlclose (descriptor->module); - } return 0; |