diff options
author | David Robillard <d@drobilla.net> | 2022-08-08 21:45:04 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-08 21:46:07 -0400 |
commit | 1c32082b4679a7a4898a20575c0550c8097f6406 (patch) | |
tree | 706b99efcc6937d70a98406c4fecbfec790d17de | |
parent | d69fdf76163882eaef3f4c00373ecebdfca85deb (diff) | |
download | lv2-1c32082b4679a7a4898a20575c0550c8097f6406.tar.xz |
eg-sampler: Fix potentially corrupt notification events
-rw-r--r-- | lv2/core.lv2/meta.ttl | 2 | ||||
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 23 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lv2/core.lv2/meta.ttl b/lv2/core.lv2/meta.ttl index 9aafd2e..8e4e471 100644 --- a/lv2/core.lv2/meta.ttl +++ b/lv2/core.lv2/meta.ttl @@ -47,6 +47,8 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R rdfs:label "Fix documentation build with Python 3.7." ] , [ rdfs:label "eg-midigate: Fix output timing." + ] , [ + rdfs:label "eg-sampler: Fix potentially corrupt notification events." ] ] ] , [ diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index c141038..779dc05 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -440,20 +440,19 @@ run(LV2_Handle instance, uint32_t sample_count) // Start a sequence in the notify output port. lv2_atom_forge_sequence_head(&self->forge, &self->notify_frame, 0); - // Send update to UI if gain or sample has changed due to state restore - if (self->gain_changed || self->sample_changed) { + // Send update to UI if gain has changed due to state restore + if (self->gain_changed) { lv2_atom_forge_frame_time(&self->forge, 0); + write_set_gain(&self->forge, &self->uris, self->gain_dB); + self->gain_changed = false; + } - if (self->gain_changed) { - write_set_gain(&self->forge, &self->uris, self->gain_dB); - self->gain_changed = false; - } - - if (self->sample_changed) { - write_set_file( - &self->forge, &self->uris, self->sample->path, self->sample->path_len); - self->sample_changed = false; - } + // Send update to UI if sample has changed due to state restore + if (self->sample_changed) { + lv2_atom_forge_frame_time(&self->forge, 0); + write_set_file( + &self->forge, &self->uris, self->sample->path, self->sample->path_len); + self->sample_changed = false; } // Iterate over incoming events, emitting audio along the way |