mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Extend strip import API, include additional information
This commit is contained in:
parent
9089151f68
commit
00af254b04
2 changed files with 56 additions and 15 deletions
|
|
@ -664,17 +664,39 @@ public:
|
||||||
std::vector<std::string> possible_states() const;
|
std::vector<std::string> possible_states() const;
|
||||||
static std::vector<std::string> possible_states (std::string path);
|
static std::vector<std::string> possible_states (std::string path);
|
||||||
|
|
||||||
|
|
||||||
enum RouteGroupImportMode {
|
enum RouteGroupImportMode {
|
||||||
IgnoreRouteGroup,
|
IgnoreRouteGroup,
|
||||||
UseRouteGroup,
|
UseRouteGroup,
|
||||||
CreateRouteGroup
|
CreateRouteGroup
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RouteImportInfo {
|
||||||
|
RouteImportInfo (std::string const& n, PresentationInfo const& p, int mb)
|
||||||
|
: name (n)
|
||||||
|
, pi (p)
|
||||||
|
, mixbus (mb)
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
PresentationInfo pi;
|
||||||
|
int mixbus;
|
||||||
|
|
||||||
|
bool operator< (RouteImportInfo const& o) {
|
||||||
|
if (mixbus != o.mixbus) {
|
||||||
|
return mixbus < o.mixbus;
|
||||||
|
}
|
||||||
|
return name < o.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator== (RouteImportInfo const& o) {
|
||||||
|
return mixbus == o.mixbus && name == o.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool export_route_state (std::shared_ptr<RouteList> rl, const std::string& path, bool with_sources);
|
bool export_route_state (std::shared_ptr<RouteList> rl, const std::string& path, bool with_sources);
|
||||||
int import_route_state (const std::string& path, std::map<PBD::ID, PBD::ID> const&, RouteGroupImportMode rgim = CreateRouteGroup);
|
int import_route_state (const std::string& path, std::map<PBD::ID, PBD::ID> const&, RouteGroupImportMode rgim = CreateRouteGroup);
|
||||||
|
|
||||||
std::map<PBD::ID, std::string> parse_route_state (const std::string& path, bool& match_pbd_id);
|
std::map<PBD::ID, RouteImportInfo> parse_route_state (const std::string& path, bool& match_pbd_id);
|
||||||
|
|
||||||
/// The instant xml file is written to the session directory
|
/// The instant xml file is written to the session directory
|
||||||
void add_instant_xml (XMLNode&, bool write_to_config = true);
|
void add_instant_xml (XMLNode&, bool write_to_config = true);
|
||||||
|
|
|
||||||
|
|
@ -1198,16 +1198,8 @@ Session::export_route_state (std::shared_ptr<RouteList> rl, const string& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
allow_import_route_state (XMLNode const& node, int version)
|
allow_import_route_state (PresentationInfo const& pi)
|
||||||
{
|
{
|
||||||
XMLNode* pnode = node.child (PresentationInfo::state_node_name.c_str ());
|
|
||||||
if (!pnode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PresentationInfo pi (PresentationInfo::Flag (0));
|
|
||||||
pi.set_state (*pnode, version);
|
|
||||||
|
|
||||||
if (pi.special (false)) { // |SurroundMaster|MonitorOut|Auditioner
|
if (pi.special (false)) { // |SurroundMaster|MonitorOut|Auditioner
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1218,10 +1210,24 @@ allow_import_route_state (XMLNode const& node, int version)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<PBD::ID, std::string>
|
static bool
|
||||||
|
allow_import_route_state (XMLNode const& node, int version)
|
||||||
|
{
|
||||||
|
XMLNode* pnode = node.child (PresentationInfo::state_node_name.c_str ());
|
||||||
|
if (!pnode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PresentationInfo pi (PresentationInfo::Flag (0));
|
||||||
|
pi.set_state (*pnode, version);
|
||||||
|
|
||||||
|
return allow_import_route_state (pi);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<PBD::ID, Session::RouteImportInfo>
|
||||||
Session::parse_route_state (const string& path, bool& match_pbd_id)
|
Session::parse_route_state (const string& path, bool& match_pbd_id)
|
||||||
{
|
{
|
||||||
std::map<PBD::ID, std::string> rv;
|
std::map<PBD::ID, RouteImportInfo> rv;
|
||||||
|
|
||||||
XMLTree tree;
|
XMLTree tree;
|
||||||
if (!tree.read (path)) {
|
if (!tree.read (path)) {
|
||||||
|
|
@ -1256,11 +1262,24 @@ Session::parse_route_state (const string& path, bool& match_pbd_id)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allow_import_route_state (*rxml, version)) {
|
XMLNode* pnode = rxml->child (PresentationInfo::state_node_name.c_str ());
|
||||||
|
if (!pnode) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv[id] = name;
|
PresentationInfo pi (PresentationInfo::Flag (0));
|
||||||
|
pi.set_state (*pnode, version);
|
||||||
|
|
||||||
|
if (!allow_import_route_state (pi)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mixbus = 0;
|
||||||
|
#ifdef MIXBUS
|
||||||
|
rxml->get_property (X_("mixbus-num"), mixbus)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
rv.emplace (id, RouteImportInfo (name, pi, mixbus));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue