| 570 | // ---------------------------------------------------------------------------------------------------------------- |
| 571 | |
| 572 | void createUI() |
| 573 | { |
| 574 | DISTRHO_SAFE_ASSERT_RETURN(fUI == nullptr,); |
| 575 | |
| 576 | fUI = new UIExporter(this, |
| 577 | fParentWindow, |
| 578 | fPlugin.getSampleRate(), |
| 579 | editParameterCallback, |
| 580 | setParameterCallback, |
| 581 | setStateCallback, |
| 582 | sendNoteCallback, |
| 583 | setSizeCallback, |
| 584 | nullptr, // TODO fileRequestCallback, |
| 585 | d_nextBundlePath, |
| 586 | fPlugin.getInstancePointer(), |
| 587 | fScaleFactor, |
| 588 | DGL_NAMESPACE::Application::kTypeClassic); |
| 589 | |
| 590 | #if DISTRHO_PLUGIN_WANT_PROGRAMS |
| 591 | fUI->programLoaded(fCurrentProgram); |
| 592 | #endif |
| 593 | |
| 594 | #if DISTRHO_PLUGIN_WANT_FULL_STATE |
| 595 | // Update current state from plugin side |
| 596 | for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit) |
| 597 | { |
| 598 | const String& key = cit->first; |
| 599 | fStateMap[key] = fPlugin.getStateValue(key); |
| 600 | } |
| 601 | #endif |
| 602 | |
| 603 | #if DISTRHO_PLUGIN_WANT_STATE |
| 604 | // Set state |
| 605 | for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit) |
| 606 | { |
| 607 | const String& key(cit->first); |
| 608 | const String& value(cit->second); |
| 609 | |
| 610 | // TODO skip DSP only states |
| 611 | |
| 612 | fUI->stateChanged(key, value); |
| 613 | } |
| 614 | #endif |
| 615 | |
| 616 | for (uint32_t i=0; i<fCachedParameters.numParams; ++i) |
| 617 | { |
| 618 | const float value = fCachedParameters.values[i] = fPlugin.getParameterValue(i); |
| 619 | fCachedParameters.changed[i] = false; |
| 620 | fUI->parameterChanged(i, value); |
| 621 | } |
| 622 | |
| 623 | if (fIsFloating) |
| 624 | { |
| 625 | if (fWindowTitle.isNotEmpty()) |
| 626 | fUI->setWindowTitle(fWindowTitle); |
| 627 | |
| 628 | if (fTransientWindow != 0) |
| 629 | fUI->setWindowTransientWinId(fTransientWindow); |
no test coverage detected