MCPcopy Create free account
hub / github.com/audacity/audacity / UpdateUI

Method UpdateUI

src/effects/lv2/LV2Editor.cpp:641–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641bool LV2Editor::UpdateUI()
642{
643 const auto &mySettings = GetSettings(mAccess.Get());
644 auto pMaster = mInstance.GetMaster();
645
646 if (pMaster && mySettings.mpState) {
647 // Maybe there are other important side effects on the instance besides
648 // changes of port values
649 lilv_state_restore(mySettings.mpState.get(), &pMaster->GetInstance(),
650 nullptr, nullptr, 0, nullptr);
651 // Destroy the short lived carrier of preset state
652 mySettings.mpState.reset();
653 }
654
655 auto &values = mySettings.values;
656 {
657 size_t index = 0; for (auto & state : mPortUIStates.mControlPortStates) {
658 auto &port = state.mpPort;
659 if (port->mIsInput)
660 state.mTmp =
661 values[index] * (port->mSampleRate ? mSampleRate : 1.0);
662 ++index;
663 }
664 }
665
666 if (mUseGUI) {
667 // fancy UI
668 if (mUI.mSuilInstance) {
669 size_t index = 0;
670 for (auto & port : mPorts.mControlPorts) {
671 if (port->mIsInput)
672 suil_instance_port_event(mUI.mSuilInstance.get(),
673 port->mIndex, sizeof(float),
674 /* Means this event sends a float: */ 0,
675 &values[index]);
676 ++index;
677 }
678 }
679 return true;
680 }
681
682 // else plain UI
683 // Visiting controls by groups
684 for (auto & group : mPorts.mGroups) {
685 const auto & params = mPorts.mGroupMap.at(group); /* won't throw */
686 for (auto & param : params) {
687 auto &state = mPortUIStates.mControlPortStates[param];
688 auto &port = state.mpPort;
689 auto &ctrl = mPlainUIControls[param];
690 auto &value = values[param];
691 if (port->mTrigger)
692 continue;
693 else if (port->mToggle)
694 ctrl.checkbox->SetValue(value > 0);
695 else if (port->mEnumeration) // Check before integer
696 ctrl.choice->SetSelection(port->Discretize(value));
697 else if (port->mIsInput) {
698 state.mTmp = value * (port->mSampleRate ? mSampleRate : 1.0f);

Callers 1

PopulateUIMethod · 0.45

Calls 11

GetSettingsFunction · 0.85
lilv_state_restoreFunction · 0.85
suil_instance_port_eventFunction · 0.85
GetInstanceMethod · 0.80
DiscretizeMethod · 0.80
GetMethod · 0.45
getMethod · 0.45
resetMethod · 0.45
SetValueMethod · 0.45
SetSelectionMethod · 0.45
TransferDataToWindowMethod · 0.45

Tested by

no test coverage detected