MCPcopy Create free account
hub / github.com/benkuper/Chataigne / processMessage

Method processMessage

Source/Module/modules/osc/OSCModule.cpp:147–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void OSCModule::processMessage(const OSCMessage& msg)
148{
149 if (logIncomingData->boolValue())
150 {
151 String s = "";
152 for (auto& a : msg) s += String(" ") + OSCHelpers::getStringArg(a);
153 NLOG(niceName, msg.getAddressPattern().toString() << " :" << s);
154 }
155
156 inActivityTrigger->trigger();
157
158 if (thruManager != nullptr)
159 {
160 for (auto& c : thruManager->controllables)
161 {
162 if (TargetParameter* mt = (TargetParameter*)c)
163 {
164 if (!mt->enabled) continue;
165 if (OSCModule* m = (OSCModule*)(mt->targetContainer.get()))
166 {
167 m->sendOSC(msg);
168 }
169 }
170 }
171 }
172
173
174 processMessageInternal(msg);
175
176 if (scriptManager->items.size() > 0)
177 {
178 Array<var> params;
179 params.add(msg.getAddressPattern().toString());
180 var args = var(Array<var>()); //initialize force array
181 for (auto& a : msg) {
182 if (a.isBlob()) {
183 var arr = var();
184 auto blob = a.getBlob();
185 for (int i = 0; i < blob.getSize(); i++) {
186 arr.append(blob[i]);
187 }
188 args.append(arr);
189 }
190 else {
191 args.append(OSCHelpers::argumentToVar(a));
192 }
193 }
194 params.add(args);
195 params.add(msg.getSenderIPAddress());
196 scriptManager->callFunctionOnAllItems(oscEventId, params);
197
198 for (auto& entry : scriptCallbacks)
199 if (std::get<0>(entry).matches(msg.getAddressPattern().toString()))
200 scriptManager->callFunctionOnAllItems(std::get<1>(entry), params);
201 }
202
203}
204

Callers

nothing calls this directly

Calls 5

triggerMethod · 0.80
getMethod · 0.45
sendOSCMethod · 0.45
sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected