| 458 | } |
| 459 | |
| 460 | bool appendCC(const int32_t sampleOffset, v3_param_id paramId, const double normalized) noexcept |
| 461 | { |
| 462 | InputEventStorage& eventStorage(eventListStorage[numUsed]); |
| 463 | |
| 464 | paramId -= kVst3InternalParameterMidiCC_start; |
| 465 | |
| 466 | const uint8_t cc = paramId % 130; |
| 467 | |
| 468 | switch (cc) |
| 469 | { |
| 470 | case 128: |
| 471 | eventStorage.type = CC_ChannelPressure; |
| 472 | eventStorage.midi[1] = std::max(0, std::min(127, d_roundToIntPositive(normalized * 127))); |
| 473 | eventStorage.midi[2] = 0; |
| 474 | break; |
| 475 | case 129: |
| 476 | eventStorage.type = CC_Pitchbend; |
| 477 | eventStorage.midi[1] = std::max(0, std::min(16384, (int)(normalized * 16384))) & 0x7f; |
| 478 | eventStorage.midi[2] = std::max(0, std::min(16384, (int)(normalized * 16384))) >> 7; |
| 479 | break; |
| 480 | default: |
| 481 | eventStorage.type = CC_Normal; |
| 482 | eventStorage.midi[1] = cc; |
| 483 | eventStorage.midi[2] = std::max(0, std::min(127, d_roundToIntPositive(normalized * 127))); |
| 484 | break; |
| 485 | } |
| 486 | |
| 487 | eventStorage.midi[0] = paramId / 130; |
| 488 | |
| 489 | eventList[numUsed].sampleOffset = sampleOffset; |
| 490 | eventList[numUsed].storage = &eventStorage; |
| 491 | |
| 492 | return placeSorted(sampleOffset); |
| 493 | } |
| 494 | |
| 495 | #if DISTRHO_PLUGIN_HAS_UI |
| 496 | // NOTE always runs first |
no test coverage detected