Rename keyswitch things for disambiguation

This commit is contained in:
Jean Pierre Cimalando 2021-02-25 09:22:24 +01:00
parent 22e0aec6b1
commit 291aa3d16b
4 changed files with 10 additions and 10 deletions

View file

@ -237,7 +237,7 @@ void Editor::open(CFrame& frame)
// request the whole Key and CC information // request the whole Key and CC information
impl.sendQueuedOSC("/key/slots", "", nullptr); impl.sendQueuedOSC("/key/slots", "", nullptr);
impl.sendQueuedOSC("/sw/slots", "", nullptr); impl.sendQueuedOSC("/sw/last/slots", "", nullptr);
impl.sendQueuedOSC("/cc/slots", "", nullptr); impl.sendQueuedOSC("/cc/slots", "", nullptr);
} }
@ -268,7 +268,7 @@ void Editor::Impl::uiReceiveValue(EditId id, const EditValue& v)
// request the whole Key and CC information // request the whole Key and CC information
sendQueuedOSC("/key/slots", "", nullptr); sendQueuedOSC("/key/slots", "", nullptr);
sendQueuedOSC("/sw/slots", "", nullptr); sendQueuedOSC("/sw/last/slots", "", nullptr);
sendQueuedOSC("/cc/slots", "", nullptr); sendQueuedOSC("/cc/slots", "", nullptr);
} }
break; break;
@ -430,7 +430,7 @@ void Editor::Impl::uiReceiveMessage(const char* path, const char* sig, const sfi
updateKeyUsed(key, used); updateKeyUsed(key, used);
} }
} }
else if (Messages::matchOSC("/sw/slots", path, indices) && !strcmp(sig, "b")) { else if (Messages::matchOSC("/sw/last/slots", path, indices) && !strcmp(sig, "b")) {
size_t numBits = 8 * args[0].b->size; size_t numBits = 8 * args[0].b->size;
ConstBitSpan bits { args[0].b->data, numBits }; ConstBitSpan bits { args[0].b->data, numBits };
for (unsigned key = 0; key < 128; ++key) { for (unsigned key = 0; key < 128; ++key) {
@ -1033,7 +1033,7 @@ void Editor::Impl::changeSfzFile(const std::string& filePath)
// request the whole Key and CC information // request the whole Key and CC information
sendQueuedOSC("/key/slots", "", nullptr); sendQueuedOSC("/key/slots", "", nullptr);
sendQueuedOSC("/sw/slots", "", nullptr); sendQueuedOSC("/sw/last/slots", "", nullptr);
sendQueuedOSC("/cc/slots", "", nullptr); sendQueuedOSC("/cc/slots", "", nullptr);
} }

View file

@ -250,7 +250,7 @@ void Synth::Impl::clear()
changedCCsThisCycle_.clear(); changedCCsThisCycle_.clear();
keyLabels_.clear(); keyLabels_.clear();
keySlots_.clear(); keySlots_.clear();
swSlots_.clear(); swLastSlots_.clear();
keyswitchLabels_.clear(); keyswitchLabels_.clear();
globalOpcodes_.clear(); globalOpcodes_.clear();
masterOpcodes_.clear(); masterOpcodes_.clear();
@ -749,13 +749,13 @@ void Synth::Impl::finalizeSfzLoad()
// cache the set of keyswitches assigned // cache the set of keyswitches assigned
for (const RegionPtr& regionPtr : regions_) { for (const RegionPtr& regionPtr : regions_) {
if (absl::optional<uint8_t> sw = regionPtr->lastKeyswitch) { if (absl::optional<uint8_t> sw = regionPtr->lastKeyswitch) {
swSlots_.set(*sw); swLastSlots_.set(*sw);
} }
else if (absl::optional<Range<uint8_t>> swRange = regionPtr->lastKeyswitchRange) { else if (absl::optional<Range<uint8_t>> swRange = regionPtr->lastKeyswitchRange) {
unsigned loKey = swRange->getStart(); unsigned loKey = swRange->getStart();
unsigned hiKey = swRange->getEnd(); unsigned hiKey = swRange->getEnd();
for (unsigned key = loKey; key <= hiKey; ++key) for (unsigned key = loKey; key <= hiKey; ++key)
swSlots_.set(key); swLastSlots_.set(key);
} }
} }
} }

View file

@ -46,8 +46,8 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
//---------------------------------------------------------------------- //----------------------------------------------------------------------
MATCH("/sw/slots", "") { MATCH("/sw/last/slots", "") {
const BitArray<128>& switches = impl.swSlots_; const BitArray<128>& switches = impl.swLastSlots_;
sfizz_blob_t blob { switches.data(), static_cast<uint32_t>(switches.byte_size()) }; sfizz_blob_t blob { switches.data(), static_cast<uint32_t>(switches.byte_size()) };
client.receive<'b'>(delay, path, &blob); client.receive<'b'>(delay, path, &blob);
} break; } break;

View file

@ -217,7 +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_; BitArray<128> swLastSlots_;
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