diff --git a/plugin/plugin.c b/plugin/plugin.c index 83ce61d7f485767e3619a29eccfe2ebdb01ad9e9..caf9c7c0d0870b531d7b75c809edef96d0b38cde 100644 --- a/plugin/plugin.c +++ b/plugin/plugin.c @@ -218,8 +218,8 @@ static void handle_event(struct sampler_plugin *plugin, LV2_Atom_Event *ev) { // Sample change, send it to the worker. lv2_log_trace(&plugin->logger, "Scheduling sample change\n"); plugin->schedule->schedule_work(plugin->schedule->handle, - lv2_atom_total_size(&ev->body), - &ev->body); + lv2_atom_total_size(&ev->body), + &ev->body); /* } else if (key == uris->param_gain) { */ /* // Gain change */ /* if (value->type == uris->atom_Float) { */ @@ -324,8 +324,18 @@ static LV2_State_Status restore(LV2_Handle instance, path = paths->absolute_path(paths->handle, (const char *)value); if (!plugin->activated || !schedule) { + struct drumkit *new_kit; + lv2_log_trace(&plugin->logger, "Synchronous restore\n"); + // Do sync restore. + new_kit = drumkit_new(path, plugin->samplerate); + if (!new_kit) { + lv2_log_error(&plugin->logger, "Error loading the drumkit %s\n", path); + return LV2_WORKER_ERR_UNKNOWN; + } + sampler_set_drumkit(plugin->sampler, new_kit); + } else { LV2_Atom_Forge forge; LV2_Atom *buf = (LV2_Atom *)calloc(1, strlen(path) + 128);