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

Method AddControlConnection

Source/MidiController.cpp:135–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135UIControlConnection* MidiController::AddControlConnection(MidiMessageType messageType, int control, int channel, IUIControl* uicontrol, int page /*= -1*/)
136{
137 if (page == -1)
138 page = mControllerPage;
139 RemoveConnection(control, messageType, channel, page);
140
141 UIControlConnection* connection = new UIControlConnection(this);
142 connection->mMessageType = messageType;
143 connection->mControl = control;
144 connection->SetUIControl(uicontrol);
145 connection->mChannel = channel;
146 connection->mPage = page;
147 if (dynamic_cast<Checkbox*>(uicontrol) != nullptr)
148 connection->mType = kControlType_Toggle;
149 else if (dynamic_cast<TextEntry*>(uicontrol) != nullptr)
150 connection->mType = kControlType_Direct;
151 else
152 connection->mType = kControlType_Slider;
153 if (mSlidersDefaultToIncremental)
154 connection->mIncrementAmount = 1;
155
156 int layoutControl = GetLayoutControlIndexForMidi(messageType, control);
157 if (layoutControl != -1)
158 {
159 connection->mIncrementAmount = mLayoutControls[layoutControl].mIncrementAmount;
160 connection->mMidiOffValue = mLayoutControls[layoutControl].mOffVal;
161 connection->mMidiOnValue = mLayoutControls[layoutControl].mOnVal;
162 connection->mScaleOutput = mLayoutControls[layoutControl].mScaleOutput;
163 connection->m14BitMode = mLayoutControls[layoutControl].m14BitMode;
164 if (mLayoutControls[layoutControl].mConnectionType != kControlType_Default)
165 connection->mType = mLayoutControls[layoutControl].mConnectionType;
166 }
167
168 connection->CreateUIControls((int)mConnections.size());
169 mConnections.push_back(connection);
170 if (uicontrol != nullptr)
171 uicontrol->AddRemoteController();
172
173 return connection;
174}
175
176void MidiController::AddControlConnection(const ofxJSONElement& connection)
177{

Callers

nothing calls this directly

Calls 7

sizeMethod · 0.80
AddRemoteControllerMethod · 0.80
lengthMethod · 0.80
LogEventMethod · 0.80
SetUIControlMethod · 0.45
CreateUIControlsMethod · 0.45
FindUIControlMethod · 0.45

Tested by

no test coverage detected