Skip to content

Commit

Permalink
Merge pull request #1069 from paulfd/lv2-default-bug
Browse files Browse the repository at this point in the history
Add a resync cc flag for the main callback to update the CC state
  • Loading branch information
paulfd authored Jan 15, 2022
2 parents 71345b4 + 9d61fe6 commit 1a793c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/lv2/sfizz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions plugins/lv2/sfizz_lv2_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down

0 comments on commit 1a793c8

Please sign in to comment.