|
AwesomeStudioPedal
A programmable, multi-profile foot controller for DAWs, score readers, and studio automation
|
Wraps an action and defers its execution by a configurable delay. More...
#include <delayed_action.h>
Public Member Functions | |
| DelayedAction (std::unique_ptr< Action > action, uint32_t delayMs) | |
| Constructs a DelayedAction that wraps an action with a time delay. | |
| void | execute () override |
| Executes the delayed action. | |
| uint32_t | getDelay () const override |
| bool | isSendAction () const override |
| bool | isInProgress () const override |
| Returns true if the action is currently in progress (e.g. | |
| Action::Type | getType () const override |
| bool | update (uint32_t currentTime) const |
| Polls whether the delay has elapsed. | |
| bool | isStarted () const |
| const Action * | getInnerAction () const |
| void | getJsonProperties (JsonObject &json) const override |
| Serializes the delayed action to JSON. | |
Public Member Functions inherited from Action | |
| void | setName (const std::string &n) |
| const std::string & | getName () const |
| bool | hasName () const |
| virtual | ~Action ()=default |
Static Public Member Functions | |
| static const char * | getTypeName (Action::Type type) |
| Converts an Action::Type enum to its string representation. | |
Additional Inherited Members | |
Public Types inherited from Action | |
| enum class | Type : uint8_t { Unknown , SendString , SendChar , SendKey , SendMediaKey , SerialOutput , Delayed } |
Wraps an action and defers its execution by a configurable delay.
The first call to execute() starts the timer. Subsequent calls before the delay has elapsed are ignored. Once the delay elapses the inner action is executed and the timer resets, allowing the action to be triggered again.
Definition at line 15 of file delayed_action.h.
| DelayedAction::DelayedAction | ( | std::unique_ptr< Action > | action, |
| uint32_t | delayMs | ||
| ) |
Constructs a DelayedAction that wraps an action with a time delay.
| action | The action to be executed after the delay |
| delayMs | The delay duration in milliseconds |
Definition at line 15 of file delayed_action.cpp.
|
overridevirtual |
Executes the delayed action.
If not already started, begins the delay timer. If the delay has elapsed, executes the inner action and resets the timer. Calls before the delay elapses are ignored (debounce behavior).
Implements Action.
Definition at line 27 of file delayed_action.cpp.
|
inlineoverridevirtual |
Reimplemented from Action.
Definition at line 22 of file delayed_action.h.
|
inline |
Definition at line 36 of file delayed_action.h.
|
overridevirtual |
Serializes the delayed action to JSON.
| json | The JSON object to populate with action properties |
Reimplemented from Action.
Definition at line 61 of file delayed_action.cpp.
|
inlineoverridevirtual |
Reimplemented from Action.
Definition at line 25 of file delayed_action.h.
|
static |
Converts an Action::Type enum to its string representation.
| type | The action type enum value |
Definition at line 75 of file delayed_action.cpp.
|
inlineoverridevirtual |
Returns true if the action is currently in progress (e.g.
a running delay)
Reimplemented from Action.
Definition at line 24 of file delayed_action.h.
|
inlineoverridevirtual |
Reimplemented from Action.
Definition at line 23 of file delayed_action.h.
|
inline |
Definition at line 35 of file delayed_action.h.
| bool DelayedAction::update | ( | uint32_t | currentTime | ) | const |
Polls whether the delay has elapsed.
Updates the delay timer and checks if ready to execute.
| currentTime | Current time in milliseconds (e.g. millis()) |
Definition at line 47 of file delayed_action.cpp.