diff --git a/plugins/lv2/sfizz.cpp b/plugins/lv2/sfizz.cpp index 3df3dea4d..8fc65ba90 100644 --- a/plugins/lv2/sfizz.cpp +++ b/plugins/lv2/sfizz.cpp @@ -1266,6 +1266,13 @@ run(LV2_Handle instance, uint32_t sample_count) self->midnam->update(self->midnam->handle); } + if (self->resync_cc) { + for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) + sfizz_lv2_send_controller(self, self->patch_set_uri, cc, self->cc_current[cc]); + + self->resync_cc = false; + } + spin_mutex_unlock(self->synth_mutex); #if defined(SFIZZ_LV2_UI) @@ -1418,6 +1425,8 @@ sfizz_lv2_update_sfz_info(sfizz_plugin_t *self) if (desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc)) { // Update the current CCs self->cc_current[cc] = desc.ccValue[cc]; + self->resync_cc = true; + if (desc.ccLabel[cc].empty()) cursor += snprintf(cursor, end - cursor, "- %d\n", cc); else diff --git a/plugins/lv2/sfizz_lv2_plugin.h b/plugins/lv2/sfizz_lv2_plugin.h index 4361ff7a3..e6722397f 100644 --- a/plugins/lv2/sfizz_lv2_plugin.h +++ b/plugins/lv2/sfizz_lv2_plugin.h @@ -139,6 +139,7 @@ struct sfizz_plugin_t // Current CC values in the synth (synchronized by `synth_mutex`) // updated by hdcc or file load float *cc_current {}; + volatile bool resync_cc { false }; // Timing data int bar {};