| 506 | } |
| 507 | |
| 508 | void step() override |
| 509 | { |
| 510 | if (module == nullptr) |
| 511 | return; |
| 512 | |
| 513 | // Set bgColor and selected state |
| 514 | if (module->learningId == id) |
| 515 | { |
| 516 | bgColor = color; |
| 517 | bgColor.a = 0.125f; |
| 518 | |
| 519 | if (ParamWidget* const touchedParam = APP->scene->rack->touchedParam) |
| 520 | { |
| 521 | if (module->nextLearningId == id) |
| 522 | { |
| 523 | module->nextLearningId = -1; |
| 524 | lastTouchedParam = touchedParam; |
| 525 | } |
| 526 | else if (lastTouchedParam != touchedParam) |
| 527 | { |
| 528 | const int64_t moduleId = touchedParam->module->id; |
| 529 | const int paramId = touchedParam->paramId; |
| 530 | module->learnParam(id, moduleId, paramId); |
| 531 | lastTouchedParam = touchedParam; |
| 532 | } |
| 533 | } |
| 534 | else |
| 535 | { |
| 536 | lastTouchedParam = nullptr; |
| 537 | } |
| 538 | } |
| 539 | else |
| 540 | { |
| 541 | bgColor = nvgRGB(0, 0, 0); |
| 542 | } |
| 543 | |
| 544 | // Set text |
| 545 | text.clear(); |
| 546 | |
| 547 | // mapped |
| 548 | if (module->ccs[id] >= 0) |
| 549 | text += string::f("CC%02d: ", module->ccs[id]); |
| 550 | if (module->paramHandles[id].moduleId >= 0) |
| 551 | text += getParamName(); |
| 552 | |
| 553 | // Set text color |
| 554 | if (text.empty() && module->learningId != id) |
| 555 | color.a = 0.75f; |
| 556 | else |
| 557 | color.a = 1.0f; |
| 558 | |
| 559 | // unmapped |
| 560 | if (text.empty()) |
| 561 | { |
| 562 | if (module->learningId == id) |
| 563 | text = "Mapping..."; |
| 564 | else |
| 565 | text = module->mapLen == 1 ? "Click here to map" : "Unmapped"; |
nothing calls this directly
no test coverage detected