Merge pull request #646 from jpcima/send-key-ranges
Send key ranges to editor
This commit is contained in:
commit
eab7d6e2da
4 changed files with 29 additions and 4 deletions
|
|
@ -219,7 +219,8 @@ void Editor::open(CFrame& frame)
|
||||||
impl.frame_ = &frame;
|
impl.frame_ = &frame;
|
||||||
frame.addView(impl.mainView_.get());
|
frame.addView(impl.mainView_.get());
|
||||||
|
|
||||||
// request the whole CC information
|
// request the whole Key and CC information
|
||||||
|
impl.sendQueuedOSC("/key/slots", "", nullptr);
|
||||||
impl.sendQueuedOSC("/cc/slots", "", nullptr);
|
impl.sendQueuedOSC("/cc/slots", "", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,7 +245,8 @@ void Editor::Impl::uiReceiveValue(EditId id, const EditValue& v)
|
||||||
currentSfzFile_ = value;
|
currentSfzFile_ = value;
|
||||||
updateSfzFileLabel(value);
|
updateSfzFileLabel(value);
|
||||||
|
|
||||||
// request the whole CC information
|
// request the whole Key and CC information
|
||||||
|
sendQueuedOSC("/key/slots", "", nullptr);
|
||||||
sendQueuedOSC("/cc/slots", "", nullptr);
|
sendQueuedOSC("/cc/slots", "", nullptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -390,7 +392,10 @@ void Editor::Impl::uiReceiveMessage(const char* path, const char* sig, const sfi
|
||||||
{
|
{
|
||||||
unsigned indices[8];
|
unsigned indices[8];
|
||||||
|
|
||||||
if (Messages::matchOSC("/cc/slots", path, indices) && !strcmp(sig, "b")) {
|
if (Messages::matchOSC("/key/slots", path, indices) && !strcmp(sig, "b")) {
|
||||||
|
// TODO(jpc) key ranges
|
||||||
|
}
|
||||||
|
else if (Messages::matchOSC("/cc/slots", path, indices) && !strcmp(sig, "b")) {
|
||||||
const uint8_t* bitChunks = args[0].b->data;
|
const uint8_t* bitChunks = args[0].b->data;
|
||||||
uint32_t byteSize = args[0].b->size;
|
uint32_t byteSize = args[0].b->size;
|
||||||
|
|
||||||
|
|
@ -962,7 +967,8 @@ void Editor::Impl::changeSfzFile(const std::string& filePath)
|
||||||
currentSfzFile_ = filePath;
|
currentSfzFile_ = filePath;
|
||||||
updateSfzFileLabel(filePath);
|
updateSfzFileLabel(filePath);
|
||||||
|
|
||||||
// request the whole CC information
|
// request the whole Key and CC information
|
||||||
|
sendQueuedOSC("/key/slots", "", nullptr);
|
||||||
sendQueuedOSC("/cc/slots", "", nullptr);
|
sendQueuedOSC("/cc/slots", "", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ void Synth::Impl::clear()
|
||||||
currentUsedCCs_.clear();
|
currentUsedCCs_.clear();
|
||||||
changedCCsThisCycle_.clear();
|
changedCCsThisCycle_.clear();
|
||||||
keyLabels_.clear();
|
keyLabels_.clear();
|
||||||
|
keySlots_.clear();
|
||||||
keyswitchLabels_.clear();
|
keyswitchLabels_.clear();
|
||||||
globalOpcodes_.clear();
|
globalOpcodes_.clear();
|
||||||
masterOpcodes_.clear();
|
masterOpcodes_.clear();
|
||||||
|
|
@ -735,6 +736,15 @@ void Synth::Impl::finalizeSfzLoad()
|
||||||
|
|
||||||
// cache the set of used CCs for future access
|
// cache the set of used CCs for future access
|
||||||
currentUsedCCs_ = collectAllUsedCCs();
|
currentUsedCCs_ = collectAllUsedCCs();
|
||||||
|
|
||||||
|
// cache the set of keys assigned
|
||||||
|
for (const RegionPtr& regionPtr : regions_) {
|
||||||
|
Range<uint8_t> keyRange = regionPtr->keyRange;
|
||||||
|
unsigned loKey = keyRange.getStart();
|
||||||
|
unsigned hiKey = keyRange.getEnd();
|
||||||
|
for (unsigned key = loKey; key <= hiKey; ++key)
|
||||||
|
keySlots_.set(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Synth::loadScalaFile(const fs::path& path)
|
bool Synth::loadScalaFile(const fs::path& path)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,14 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
MATCH("/key/slots", "") {
|
||||||
|
const BitArray<128>& keys = impl.keySlots_;
|
||||||
|
sfizz_blob_t blob { keys.data(), static_cast<uint32_t>(keys.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()) };
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,7 @@ struct Synth::Impl final: public Parser::Listener {
|
||||||
std::vector<CCNamePair> ccLabels_;
|
std::vector<CCNamePair> ccLabels_;
|
||||||
std::map<int, size_t> ccLabelsMap_;
|
std::map<int, size_t> ccLabelsMap_;
|
||||||
std::vector<NoteNamePair> keyLabels_;
|
std::vector<NoteNamePair> keyLabels_;
|
||||||
|
BitArray<128> keySlots_;
|
||||||
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