From b9174903eb6b35892c527ec926127e652aad3c23 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 27 Feb 2013 03:35:04 +0000 Subject: [PATCH] Update NativePlugin UI params on show() --- source/backend/plugin/NativePlugin.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 12817bad2..fc2b81e3c 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -479,6 +479,7 @@ public: if (fDescriptor != nullptr && fHandle != nullptr) { + // FIXME - this be as a host-side call to request files if (fDescriptor->name != nullptr && std::strcmp(fDescriptor->label, "audiofile") == 0) { QString filenameTry = QFileDialog::getOpenFileName(nullptr, "Open Audio File"); @@ -489,7 +490,24 @@ public: kData->engine->callback(CALLBACK_SHOW_GUI, fId, 0, 0, 0.0f, nullptr); } else if (fDescriptor->ui_show != nullptr) + { fDescriptor->ui_show(fHandle, yesNo); + + if (yesNo) + { + // Update UI values + if (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++) + { + fDescriptor->ui_set_parameter_value(fHandle, i, fDescriptor->get_parameter_value(fHandle, i)); + } + } + } } fIsUiVisible = yesNo;