Add switch labels to the midnam
This commit is contained in:
parent
aa4af91131
commit
4b55f955d6
2 changed files with 10 additions and 0 deletions
|
|
@ -396,6 +396,10 @@ bool sfz::Synth::loadSfzFile(const fs::path& file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (region->keyswitchLabel && region->keyswitch)
|
||||||
|
keyswitchLabels.push_back({ *region->keyswitch, *region->keyswitchLabel });
|
||||||
|
|
||||||
|
|
||||||
// Some regions had group number but no "group-level" opcodes handled the polyphony
|
// Some regions had group number but no "group-level" opcodes handled the polyphony
|
||||||
while (groupMaxPolyphony.size() <= region->group)
|
while (groupMaxPolyphony.size() <= region->group)
|
||||||
groupMaxPolyphony.push_back(config::maxVoices);
|
groupMaxPolyphony.push_back(config::maxVoices);
|
||||||
|
|
@ -891,6 +895,11 @@ std::string sfz::Synth::exportMidnam(absl::string_view model) const
|
||||||
{
|
{
|
||||||
pugi::xml_node nnl = device.append_child("NoteNameList");
|
pugi::xml_node nnl = device.append_child("NoteNameList");
|
||||||
nnl.append_attribute("Name").set_value("Notes");
|
nnl.append_attribute("Name").set_value("Notes");
|
||||||
|
for (const auto& pair : keyswitchLabels) {
|
||||||
|
pugi::xml_node nn = nnl.append_child("Note");
|
||||||
|
nn.append_attribute("Number").set_value(std::to_string(pair.first).c_str());
|
||||||
|
nn.append_attribute("Name").set_value(pair.second.c_str());
|
||||||
|
}
|
||||||
for (const auto& pair : keyLabels) {
|
for (const auto& pair : keyLabels) {
|
||||||
pugi::xml_node nn = nnl.append_child("Note");
|
pugi::xml_node nn = nnl.append_child("Note");
|
||||||
nn.append_attribute("Number").set_value(std::to_string(pair.first).c_str());
|
nn.append_attribute("Number").set_value(std::to_string(pair.first).c_str());
|
||||||
|
|
|
||||||
|
|
@ -511,6 +511,7 @@ private:
|
||||||
// Names for the CC and notes as set by label_cc and label_key
|
// Names for the CC and notes as set by label_cc and label_key
|
||||||
std::vector<CCNamePair> ccLabels;
|
std::vector<CCNamePair> ccLabels;
|
||||||
std::vector<NoteNamePair> keyLabels;
|
std::vector<NoteNamePair> keyLabels;
|
||||||
|
std::vector<NoteNamePair> keyswitchLabels;
|
||||||
|
|
||||||
// Default active switch if multiple keyswitchable regions are present
|
// Default active switch if multiple keyswitchable regions are present
|
||||||
absl::optional<uint8_t> defaultSwitch;
|
absl::optional<uint8_t> defaultSwitch;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue