MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / addPresetRule

Method addPresetRule

src/utils/CliRemoteController.cpp:297–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297bool CliRemoteController::addPresetRule(const QString &keyValue) const
298{
299#ifdef USE_PULSEAUDIO
300 Log::error("This feature is only supported in the PipeWire version of JamesDSP");
301 return false;
302#endif
303
304 QStringList split = keyValue.split("=", Qt::SkipEmptyParts);
305 if(split.count() < 2) {
306 Log::error("Invalid format. Expected input format: deviceId=presetName or deviceId:routeId=presetName");
307 return false;
308 }
309
310 QString deviceIdWithRoute = split.at(0);
311 QString preset = keyValue.mid(keyValue.indexOf('=') + 1);
312
313 QString deviceId;
314 QString routeId;
315
316 if(!parseDeviceAndRoute(deviceIdWithRoute, deviceId, routeId))
317 return false;
318
319 if(checkConnectionAndLog()) {
320 auto reply = service->setPresetRule(deviceId, deviceId, routeId, routeId, preset);
321 return handleVoidReply(reply);
322 }
323
324 PresetManager::instance().addRule(PresetRule(deviceId, routeId, preset));
325 return true;
326}
327
328bool CliRemoteController::deletePresetRule(const QString &deviceIdWithRoute) const
329{

Callers

nothing calls this directly

Calls 9

parseDeviceAndRouteFunction · 0.85
handleVoidReplyFunction · 0.85
PresetRuleClass · 0.85
countMethod · 0.80
indexOfMethod · 0.80
addRuleMethod · 0.80
splitMethod · 0.45
atMethod · 0.45
setPresetRuleMethod · 0.45

Tested by

no test coverage detected