MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / LoadControllerLayout

Method LoadControllerLayout

Source/MidiController.cpp:1680–1937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1678}
1679
1680void MidiController::LoadControllerLayout(std::string filename)
1681{
1682 if (filename != kDefaultLayout)
1683 mLastLoadedLayoutFile = ofToDataPath("controllers/" + filename);
1684 else
1685 mLastLoadedLayoutFile = "";
1686
1687 for (int i = 0; i < mLayoutFileDropdown->GetNumValues(); ++i)
1688 {
1689 if (filename == mLayoutFileDropdown->GetLabel(i))
1690 mLayoutFileIndex = i;
1691 }
1692
1693 for (int i = 0; i < NUM_LAYOUT_CONTROLS; ++i)
1694 {
1695 mLayoutControls[i].mActive = false;
1696 RemovePatchCableSource(mLayoutControls[i].mControlCable);
1697 mLayoutControls[i].mControlCable = nullptr;
1698 }
1699 for (auto grid : mGrids)
1700 {
1701 RemovePatchCableSource(grid->mGridCable);
1702 delete grid;
1703 }
1704 mGrids.clear();
1705
1706 bool useDefaultLayout = true;
1707 bool loaded = mLastLoadedLayoutFile != "" &&
1708 mLayoutData.open(mLastLoadedLayoutFile);
1709 try
1710 {
1711 if (loaded)
1712 {
1713 if (mNonstandardController != nullptr)
1714 mNonstandardController->SetLayoutData(mLayoutData);
1715
1716 if (!mLayoutData["outchannel"].isNull())
1717 {
1718 mOutChannel = mLayoutData["outchannel"].asInt();
1719 mModuleSaveData.SetInt("outchannel", mOutChannel);
1720 }
1721 if (!mLayoutData["outdevice"].isNull())
1722 {
1723 mDeviceOut = mLayoutData["outdevice"].asString();
1724 mModuleSaveData.SetString("deviceout", mDeviceOut);
1725 mTwoWay = true;
1726 mDevice.ConnectOutput(mDeviceOut.c_str(), mOutChannel);
1727 }
1728 if (!mLayoutData["usechannelasvoice"].isNull())
1729 {
1730 SetUseChannelAsVoice(mLayoutData["usechannelasvoice"].asBool());
1731 mModuleSaveData.SetBool("usechannelasvoice", mUseChannelAsVoice);
1732 }
1733 if (!mLayoutData["pitchbendrange"].isNull())
1734 {
1735 SetPitchBendRange(mLayoutData["pitchbendrange"].asInt());
1736 mModuleSaveData.SetFloat("pitchbendrange", mPitchBendRange);
1737 }

Callers

nothing calls this directly

Calls 15

ofToDataPathFunction · 0.85
openMethod · 0.80
SetIntMethod · 0.80
SetStringMethod · 0.80
SetBoolMethod · 0.80
SetFloatMethod · 0.80
sizeMethod · 0.80
SetManualPositionMethod · 0.80
AddTypeFilterMethod · 0.80
LogEventMethod · 0.80
GetNumValuesMethod · 0.45
GetLabelMethod · 0.45

Tested by

no test coverage detected