AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
Loading...
Searching...
No Matches
event_dispatcher.cpp
Go to the documentation of this file.
1#include "event_dispatcher.h"
2
8void EventDispatcher::registerHandler(uint8_t button, EventCallback callback)
9{
10 if (button < handlers.size())
11 {
12 handlers[button] = std::move(callback);
13 }
14}
15
21void EventDispatcher::dispatch(uint8_t button)
22{
23 if (button < handlers.size() && handlers[button])
24 {
25 handlers[button]();
26 }
27}
28
35{
36 for (auto& handler : handlers)
37 {
38 handler = nullptr;
39 }
40}
void dispatch(uint8_t button)
Executes the callback for the specified button.
std::function< void()> EventCallback
Callback function type for button events.
void clearHandlers()
Clears all registered event handlers.
void registerHandler(uint8_t button, EventCallback callback)
Registers a callback function for a button.