MCPcopy Create free account
hub / github.com/DISTRHO/DPF / appendCC

Method appendCC

distrho/src/DistrhoPluginVST3.cpp:460–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

processFunction · 0.80

Calls 1

d_roundToIntPositiveFunction · 0.85

Tested by

no test coverage detected