diff options
author | David Robillard <d@drobilla.net> | 2015-02-19 04:31:49 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-20 00:31:50 -0500 |
commit | 9b87166d9e9f66804e8a34cfa6feeb9877df4ca3 (patch) | |
tree | 93b93c43fafb982df6881495136f4b910c7b27cb /plugins | |
parent | 8adeb93d8d326732ffaa445fba7654e4b84721f2 (diff) | |
download | lv2-9b87166d9e9f66804e8a34cfa6feeb9877df4ca3.tar.xz |
Update UI when state changes.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 3be9730..06a2e80 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -68,6 +68,7 @@ typedef struct { // Sample Sample* sample; + bool sample_changed; // Ports const LV2_Atom_Sequence* control_port; @@ -332,6 +333,15 @@ run(LV2_Handle instance, // Start a sequence in the notify output port. lv2_atom_forge_sequence_head(&self->forge, &self->notify_frame, 0); + // 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; + } + // Read incoming events LV2_ATOM_SEQUENCE_FOREACH(self->control_port, ev) { self->frame_offset = ev->time.frames; @@ -478,6 +488,7 @@ restore(LV2_Handle instance, lv2_log_trace(&self->logger, "Restoring file %s\n", path); free_sample(self, self->sample); self->sample = load_sample(self, path); + self->sample_changed = true; } return LV2_STATE_SUCCESS; |