@@ -324,8 +324,7 @@ View::View(mpc::Mpc &mpcToUse,
324324 mpc::performance::ProgramPadEventUiCallback (
325325 [&](const mpc::ProgramPadIndex programPadIndex,
326326 const mpc::VelocityOrPressure velocityOrPressure,
327- const mpc::performance::PerformanceEventSource source,
328- const mpc::performance::ProgramPadEventType eventType)
327+ const mpc::performance::UiCallbackPadEventType eventType)
329328 {
330329 const std::function isActiveBank = [&]
331330 {
@@ -338,28 +337,55 @@ View::View(mpc::Mpc &mpcToUse,
338337 return bank == activeBank;
339338 };
340339
341- const auto pressType =
342- source == mpc::performance::PerformanceEventSource::
343- VirtualMpcHardware
344- ? Pad::PressType::Primary
345- : isActiveBank () ? Pad::PressType::Secondary
346- : Pad::PressType::Tertiary;
340+ const auto pressType = isActiveBank ()
341+ ? Pad::PressType::Secondary
342+ : Pad::PressType::Tertiary;
347343
348344 const auto pad = pads[static_cast <size_t >(
349345 padMap.at (static_cast <uint8_t >(programPadIndex % 16 )))];
350346
351- if (eventType == mpc::performance::ProgramPadEventType::Press)
347+ if (eventType ==
348+ mpc::performance::UiCallbackPadEventType::Press)
352349 {
353350 pad->registerPress (pressType, programPadIndex,
354351 velocityOrPressure);
355352 }
356353 else if (eventType ==
357- mpc::performance::ProgramPadEventType ::Aftertouch)
354+ mpc::performance::UiCallbackPadEventType ::Aftertouch)
358355 {
359356 pad->registerAftertouch (pressType, velocityOrPressure);
360357 }
361358 else if (eventType ==
362- mpc::performance::ProgramPadEventType::Release)
359+ mpc::performance::UiCallbackPadEventType::Release)
360+ {
361+ pad->registerRelease (pressType);
362+ }
363+ });
364+
365+ mpc.getPerformanceManager ().lock ()->physicalPadEventUiCallback =
366+ mpc::performance::PhysicalPadEventUiCallback (
367+ [&](const mpc::PhysicalPadIndex physicalPadIndex,
368+ const mpc::VelocityOrPressure velocityOrPressure,
369+ const mpc::performance::UiCallbackPadEventType eventType)
370+ {
371+ constexpr auto pressType = Pad::PressType::Primary;
372+
373+ const auto pad = pads[static_cast <size_t >(
374+ padMap.at (static_cast <uint8_t >(physicalPadIndex)))];
375+
376+ if (eventType ==
377+ mpc::performance::UiCallbackPadEventType::Press)
378+ {
379+ pad->registerPress (pressType, physicalPadIndex,
380+ velocityOrPressure);
381+ }
382+ else if (eventType ==
383+ mpc::performance::UiCallbackPadEventType::Aftertouch)
384+ {
385+ pad->registerAftertouch (pressType, velocityOrPressure);
386+ }
387+ else if (eventType ==
388+ mpc::performance::UiCallbackPadEventType::Release)
363389 {
364390 pad->registerRelease (pressType);
365391 }
0 commit comments