Input Mapping for Batch of Sources

Session contains a set of 'Batch' that are created in the Player (renamed from PlayGroups). Session InputCallback can now target either a Source or a Batch, using std::variant (new type Target). Input Mapping reacts to input to create callbacks to a target, either a single source (as before) or to a Batch (multiple sources).
This commit is contained in:
Bruno Herbelin
2023-02-05 17:05:29 +01:00
parent 1e9f8d707e
commit c5cb635b4e
9 changed files with 297 additions and 166 deletions

View File

@@ -234,10 +234,24 @@ void SessionCreator::loadInputCallbacks(tinyxml2::XMLElement *inputsNode)
uint input = 0;
xmlCurrent_->QueryUnsignedAttribute("input", &input);
if (input > 0) {
// what id is the source ?
uint64_t id = 0;
xmlCurrent_->QueryUnsigned64Attribute("id", &id);
if (id > 0) {
Target target;
uint64_t sid = 0;
size_t bid = 0;
if ( xmlCurrent_->QueryUnsigned64Attribute("id", &sid) != XML_NO_ATTRIBUTE ) {
// find the source with the given id
SourceList::iterator sit = session_->find(sid);
if (sit != session_->end()) {
// assign variant
target = *sit;
}
}
else if ( xmlCurrent_->QueryUnsigned64Attribute("batch", &bid) != XML_NO_ATTRIBUTE ) {
// assign variant
target = bid;
}
// if could identify the target
if (target.index() > 0) {
// what type is the callback ?
uint type = 0;
xmlCurrent_->QueryUnsignedAttribute("type", &type);
@@ -247,12 +261,8 @@ void SessionCreator::loadInputCallbacks(tinyxml2::XMLElement *inputsNode)
if (loadedcallback) {
// apply specific parameters
loadedcallback->accept(*this);
// find the source with the given id
SourceList::iterator sit = session_->find(id);
if (sit != session_->end()) {
// assign to source in session
session_->assignSourceCallback(input, *sit, loadedcallback);
}
// assign to target
session_->assignInputCallback(input, target, loadedcallback);
}
}
}
@@ -321,7 +331,7 @@ void SessionCreator::loadPlayGroups(tinyxml2::XMLElement *playgroupNode)
playgroup_sources.push_back( id__ );
}
session_->addPlayGroup( playgroup_sources );
session_->addBatch( playgroup_sources );
}
}
}