diff --git a/source/backend/native/audiofile.c b/source/backend/native/audiofile.c index 99145f1dc..7d45fa1a0 100644 --- a/source/backend/native/audiofile.c +++ b/source/backend/native/audiofile.c @@ -292,6 +292,9 @@ static void audiofile_ui_show(PluginHandle handle, bool show) { AudioFileInstance* const handlePtr = (AudioFileInstance*)handle; + if (! show) + return; + const char* const filename = handlePtr->host->ui_open_file(handlePtr->host->handle, false, "Open Audio File", ""); if (filename != NULL) diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 6e5860fe8..b2673a900 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -494,25 +494,33 @@ public: if (fDescriptor != nullptr && fHandle != nullptr && fDescriptor->ui_show != nullptr) { + fIsUiVisible = yesNo; + fDescriptor->ui_show(fHandle, yesNo); if (yesNo) { - // Update UI values, FIXME - if (kData->midiprog.current >= 0) + // Update UI values + if (fDescriptor->ui_set_custom_data != nullptr) + { + // TODO + } + + if (fDescriptor->ui_set_midi_program != nullptr && kData->midiprog.current >= 0) { const MidiProgramData& mpData = kData->midiprog.getCurrent(); fDescriptor->ui_set_midi_program(fHandle, mpData.bank, mpData.program); } - for (uint32_t i=0; i < kData->param.count; i++) + if (fDescriptor->ui_set_parameter_value != nullptr) { - fDescriptor->ui_set_parameter_value(fHandle, i, fDescriptor->get_parameter_value(fHandle, i)); + for (uint32_t i=0; i < kData->param.count; i++) + { + fDescriptor->ui_set_parameter_value(fHandle, i, fDescriptor->get_parameter_value(fHandle, i)); + } } } } - - fIsUiVisible = yesNo; } void idleGui()