Handle message /cc/changed

This commit is contained in:
Jean Pierre Cimalando 2021-04-03 03:07:13 +02:00
parent c39cae79f9
commit d03495d568
3 changed files with 15 additions and 0 deletions

View file

@ -258,6 +258,7 @@ void Synth::Impl::clear()
clearCCLabels();
currentUsedCCs_.clear();
changedCCsThisCycle_.clear();
changedCCsLastCycle_.clear();
clearKeyLabels();
keySlots_.clear();
swLastSlots_.clear();
@ -1025,6 +1026,7 @@ void Synth::renderBlock(AudioSpan<float> buffer) noexcept
sfizz_blob_t blob { changedCCs.data(), static_cast<uint32_t>(changedCCs.byte_size()) };
broadcaster.receive<'b'>(finalFrameNumber, "/cc/changed", &blob);
}
impl.changedCCsLastCycle_ = impl.changedCCsThisCycle_;
impl.changedCCsThisCycle_.clear();
// Send the changed keyswitch
if (impl.currentSwitchChanged_) {

View file

@ -134,6 +134,18 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
client.receive<'s'>(delay, path, label ? label->c_str() : "");
} break;
MATCH("/cc/changed", "") {
const BitArray<config::numCCs>& changedCCs = impl.changedCCsThisCycle_;
sfizz_blob_t blob { changedCCs.data(), static_cast<uint32_t>(changedCCs.byte_size()) };
client.receive<'b'>(delay, path, &blob);
} break;
MATCH("/cc/changed~", "") {
const BitArray<config::numCCs>& changedCCs = impl.changedCCsLastCycle_;
sfizz_blob_t blob { changedCCs.data(), static_cast<uint32_t>(changedCCs.byte_size()) };
client.receive<'b'>(delay, path, &blob);
} break;
//----------------------------------------------------------------------
MATCH("/mem/buffers", "") {

View file

@ -315,6 +315,7 @@ struct Synth::Impl final: public Parser::Listener {
std::array<float, config::numCCs> defaultCCValues_;
BitArray<config::numCCs> currentUsedCCs_;
BitArray<config::numCCs> changedCCsThisCycle_;
BitArray<config::numCCs> changedCCsLastCycle_;
// Messaging
sfizz_receive_t* broadcastReceiver = nullptr;