Allow to request the keyswitch ranges
This commit is contained in:
parent
34ca6d69e3
commit
c1e47b0702
3 changed files with 22 additions and 0 deletions
|
|
@ -250,6 +250,7 @@ void Synth::Impl::clear()
|
||||||
changedCCsThisCycle_.clear();
|
changedCCsThisCycle_.clear();
|
||||||
keyLabels_.clear();
|
keyLabels_.clear();
|
||||||
keySlots_.clear();
|
keySlots_.clear();
|
||||||
|
swSlots_.clear();
|
||||||
keyswitchLabels_.clear();
|
keyswitchLabels_.clear();
|
||||||
globalOpcodes_.clear();
|
globalOpcodes_.clear();
|
||||||
masterOpcodes_.clear();
|
masterOpcodes_.clear();
|
||||||
|
|
@ -745,6 +746,18 @@ void Synth::Impl::finalizeSfzLoad()
|
||||||
for (unsigned key = loKey; key <= hiKey; ++key)
|
for (unsigned key = loKey; key <= hiKey; ++key)
|
||||||
keySlots_.set(key);
|
keySlots_.set(key);
|
||||||
}
|
}
|
||||||
|
// cache the set of keyswitches assigned
|
||||||
|
for (const RegionPtr& regionPtr : regions_) {
|
||||||
|
if (absl::optional<uint8_t> sw = regionPtr->lastKeyswitch) {
|
||||||
|
swSlots_.set(*sw);
|
||||||
|
}
|
||||||
|
else if (absl::optional<Range<uint8_t>> swRange = regionPtr->lastKeyswitchRange) {
|
||||||
|
unsigned loKey = swRange->getStart();
|
||||||
|
unsigned hiKey = swRange->getEnd();
|
||||||
|
for (unsigned key = loKey; key <= hiKey; ++key)
|
||||||
|
swSlots_.set(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Synth::loadScalaFile(const fs::path& path)
|
bool Synth::loadScalaFile(const fs::path& path)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,14 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
MATCH("/sw/slots", "") {
|
||||||
|
const BitArray<128>& switches = impl.swSlots_;
|
||||||
|
sfizz_blob_t blob { switches.data(), static_cast<uint32_t>(switches.byte_size()) };
|
||||||
|
client.receive<'b'>(delay, path, &blob);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
MATCH("/cc/slots", "") {
|
MATCH("/cc/slots", "") {
|
||||||
const BitArray<config::numCCs>& ccs = impl.currentUsedCCs_;
|
const BitArray<config::numCCs>& ccs = impl.currentUsedCCs_;
|
||||||
sfizz_blob_t blob { ccs.data(), static_cast<uint32_t>(ccs.byte_size()) };
|
sfizz_blob_t blob { ccs.data(), static_cast<uint32_t>(ccs.byte_size()) };
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ struct Synth::Impl final: public Parser::Listener {
|
||||||
std::map<int, size_t> ccLabelsMap_;
|
std::map<int, size_t> ccLabelsMap_;
|
||||||
std::vector<NoteNamePair> keyLabels_;
|
std::vector<NoteNamePair> keyLabels_;
|
||||||
BitArray<128> keySlots_;
|
BitArray<128> keySlots_;
|
||||||
|
BitArray<128> swSlots_;
|
||||||
std::vector<NoteNamePair> keyswitchLabels_;
|
std::vector<NoteNamePair> keyswitchLabels_;
|
||||||
|
|
||||||
// Set as sw_default if present in the file
|
// Set as sw_default if present in the file
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue