Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
action_logger.h
1/*
2 * Copyright © 2017-2023 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include "gui/views/performance_view.h"
22#include "model/action/action.h"
23#include <cstdint>
24
25class ParamCollection;
26class Sound;
27class ModelStack;
28
29enum class ActionAddition {
30 NOT_ALLOWED,
31 ALLOWED,
32 ALLOWED_ONLY_IF_NO_TIME_PASSED,
33};
34
35class ActionLogger {
36public:
37 ActionLogger();
38
39 // warning - super not thread safe
40 Action* getNewAction(ActionType newActionType,
41 ActionAddition addToExistingIfPossible = ActionAddition::NOT_ALLOWED);
42 void recordUnautomatedParamChange(ModelStackWithAutoParam const* modelStack,
43 ActionType actionType = ActionType::PARAM_UNAUTOMATED_VALUE_CHANGE);
44 void recordSwingChange(int8_t swingBefore, int8_t swingAfter);
45 void recordTempoChange(uint64_t timePerBigBefore, uint64_t timePerBigAfter);
46 Action* recordPerformanceViewPress(FXColumnPress fxPressBefore[kDisplayWidth],
47 FXColumnPress fxPressAfter[kDisplayWidth], int32_t xDisplay);
48 void closeAction(ActionType actionType);
49 void closeActionUnlessCreatedJustNow(ActionType actionType);
50 void deleteAllLogs();
54 void invalidateLogs();
55 void deleteLog(int32_t time);
56 bool revert(TimeType time, bool updateVisually = true, bool doNavigation = true);
57 void updateAction(Action* newAction);
58 void undo();
59 void redo();
60 bool undoJustOneConsequencePerNoteRow(ModelStack* modelStack);
61 bool allowedToDoReversion();
62 void notifyClipRecordingAborted(Clip* clip);
63
64 Action* firstAction[2];
65
66private:
67 ActionType getParameterChangeActionType() const;
68 void revertAction(Action* action, bool updateVisually, bool doNavigation, TimeType time);
69 void deleteLastActionIfEmpty();
70 void deleteLastAction();
71 bool deleteLogIfStale(TimeType time);
72};
73
74extern ActionLogger actionLogger;
Definition action_logger.h:35
bool deleteLogIfStale(TimeType time)
Definition action_logger.cpp:810
Action * recordPerformanceViewPress(FXColumnPress fxPressBefore[kDisplayWidth], FXColumnPress fxPressAfter[kDisplayWidth], int32_t xDisplay)
Record Performance View Hold Press.
Definition action_logger.cpp:317
void invalidateLogs()
Definition action_logger.cpp:798
Definition action.h:78
Definition clip.h:46
Definition model_stack.h:264
Definition model_stack.h:123
Definition param_collection.h:39
Definition sound.h:78
Definition performance_view.h:41