Merge pull request #1069 from paulfd/lv2-default-bug

Add a resync cc flag for the main callback to update the CC state
This commit is contained in:
Paul Ferrand 2022-01-15 22:54:07 +01:00 committed by GitHub
commit 1a793c8c7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -1266,6 +1266,13 @@ run(LV2_Handle instance, uint32_t sample_count)
self->midnam->update(self->midnam->handle); 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); spin_mutex_unlock(self->synth_mutex);
#if defined(SFIZZ_LV2_UI) #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)) { if (desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc)) {
// Update the current CCs // Update the current CCs
self->cc_current[cc] = desc.ccValue[cc]; self->cc_current[cc] = desc.ccValue[cc];
self->resync_cc = true;
if (desc.ccLabel[cc].empty()) if (desc.ccLabel[cc].empty())
cursor += snprintf(cursor, end - cursor, "- %d\n", cc); cursor += snprintf(cursor, end - cursor, "- %d\n", cc);
else else

View file

@ -139,6 +139,7 @@ struct sfizz_plugin_t
// Current CC values in the synth (synchronized by `synth_mutex`) // Current CC values in the synth (synchronized by `synth_mutex`)
// updated by hdcc or file load // updated by hdcc or file load
float *cc_current {}; float *cc_current {};
volatile bool resync_cc { false };
// Timing data // Timing data
int bar {}; int bar {};