| 133 | } |
| 134 | |
| 135 | UIControlConnection* 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 | |
| 176 | void MidiController::AddControlConnection(const ofxJSONElement& connection) |
| 177 | { |
nothing calls this directly
no test coverage detected