Deluge Firmware 1.3.0
Build date: 2025.08.14
Loading...
Searching...
No Matches
mod_controllable.h
1/*
2 * Copyright (c) 2023 Sean Ditny
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 "gui/views/automation/editor_layout.h"
21
22// namespace deluge::gui::views::automation::editor_layout {
23
24class AutomationEditorLayoutModControllable : public AutomationEditorLayout {
25public:
26 AutomationEditorLayoutModControllable() = default;
27
28public:
29 // LED indicators
30 void setAutomationKnobIndicatorLevels(ModelStackWithAutoParam* modelStack, int32_t knobPosLeft,
31 int32_t knobPosRight);
32
33 // edit pad action
35 bool toggleAutomationPadSelectionMode(ModelStackWithAutoParam* modelStackWithParam, int32_t effectiveLength,
36 int32_t xScroll, int32_t xZoom);
37 void automationEditPadAction(ModelStackWithAutoParam* modelStackWithParam, Clip* clip, int32_t xDisplay,
38 int32_t yDisplay, int32_t velocity, int32_t effectiveLength, int32_t xScroll,
39 int32_t xZoom);
40
41private:
42 bool recordAutomationSinglePadPress(int32_t xDisplay, int32_t yDisplay);
43
44public:
45 // Automation View Render Grid Functions
46 void renderAutomationEditor(ModelStackWithAutoParam* modelStackWithParam, Clip* clip,
47 RGB image[][kDisplayWidth + kSideBarWidth],
48 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], int32_t renderWidth,
49 int32_t xScroll, uint32_t xZoom, int32_t effectiveLength, int32_t xDisplay,
50 bool drawUndefinedArea, deluge::modulation::params::Kind kind, bool isBipolar);
51
52private:
53 void renderAutomationColumn(ModelStackWithAutoParam* modelStackWithParam,
54 RGB image[][kDisplayWidth + kSideBarWidth],
55 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], int32_t lengthToDisplay,
56 int32_t xDisplay, bool isAutomated, int32_t xScroll, int32_t xZoom,
57 deluge::modulation::params::Kind kind, bool isBipolar);
58 void renderAutomationBipolarSquare(RGB image[][kDisplayWidth + kSideBarWidth],
59 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], int32_t xDisplay,
60 int32_t yDisplay, bool isAutomated, deluge::modulation::params::Kind kind,
61 int32_t knobPos);
62 void renderAutomationUnipolarSquare(RGB image[][kDisplayWidth + kSideBarWidth],
63 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], int32_t xDisplay,
64 int32_t yDisplay, bool isAutomated, int32_t knobPos);
65
66public:
67 // OLED/7Seg Display
68 void renderAutomationEditorDisplayOLED(deluge::hid::display::oled_canvas::Canvas& canvas, Clip* clip,
69 OutputType outputType, int32_t knobPosLeft, int32_t knobPosRight);
70 void renderAutomationEditorDisplay7SEG(Clip* clip, OutputType outputType, int32_t knobPosLeft,
71 bool modEncoderAction);
72 void renderAutomationDisplayForMultiPadPress(ModelStackWithAutoParam* modelStackWithParam, Clip* clip,
73 int32_t effectiveLength, int32_t xScroll, int32_t xZoom,
74 int32_t xDisplay = kNoSelection, bool modEncoderAction = false);
75
76private:
77 void getAutomationParameterName(Clip* clip, OutputType outputType, StringBuf& parameterName);
78
79public:
80 // Mod Encoder Action
81 bool automationModEncoderActionForSelectedPad(ModelStackWithAutoParam* modelStackWithParam, int32_t whichModEncoder,
82 int32_t offset, int32_t effectiveLength);
83 void automationModEncoderActionForUnselectedPad(ModelStackWithAutoParam* modelStackWithParam,
84 int32_t whichModEncoder, int32_t offset, int32_t effectiveLength);
85
86 // Mod Encoder Button Action
87 void copyAutomation(ModelStackWithAutoParam* modelStackWithParam, Clip* clip, int32_t xScroll, int32_t xZoom);
88 void pasteAutomation(ModelStackWithAutoParam* modelStackWithParam, Clip* clip, int32_t effectiveLength,
89 int32_t xScroll, int32_t xZoom);
90
91 // Automation Lanes Functions
92 int32_t getAutomationParameterKnobPos(ModelStackWithAutoParam* modelStack, uint32_t pos);
93
94private:
95 uint32_t getSquareWidth(int32_t square, int32_t effectiveLength, int32_t xScroll, int32_t xZoom);
96 uint32_t getMiddlePosFromSquare(int32_t xDisplay, int32_t effectiveLength, int32_t xScroll, int32_t xZoom);
97 bool getAutomationNodeInterpolation(ModelStackWithAutoParam* modelStack, int32_t pos, bool reversed);
98 void setAutomationParameterValue(ModelStackWithAutoParam* modelStack, int32_t knobPos, int32_t squareStart,
99 int32_t xDisplay, int32_t effectiveLength, int32_t xScroll, int32_t xZoom,
100 bool modEncoderAction = false);
101 void updateAutomationModPosition(ModelStackWithAutoParam* modelStack, uint32_t squareStart,
102 bool updateDisplay = true, bool updateIndicatorLevels = true);
103
104 void handleAutomationSinglePadPress(ModelStackWithAutoParam* modelStackWithParam, Clip* clip, int32_t xDisplay,
105 int32_t yDisplay, int32_t effectiveLength, int32_t xScroll, int32_t xZoom);
106 void handleAutomationParameterChange(ModelStackWithAutoParam* modelStackWithParam, Clip* clip,
107 OutputType outputType, int32_t xDisplay, int32_t yDisplay,
108 int32_t effectiveLength, int32_t xScroll, int32_t xZoom);
109 int32_t calculateAutomationKnobPosForPadPress(ModelStackWithAutoParam* modelStackWithParam, OutputType outputType,
110 int32_t yDisplay);
111 int32_t calculateAutomationKnobPosForMiddlePadPress(deluge::modulation::params::Kind kind, int32_t yDisplay);
112 int32_t calculateAutomationKnobPosForSinglePadPress(deluge::modulation::params::Kind kind, int32_t yDisplay);
113
114 void handleAutomationMultiPadPress(ModelStackWithAutoParam* modelStackWithParam, Clip* clip, int32_t firstPadX,
115 int32_t firstPadY, int32_t secondPadX, int32_t secondPadY,
116 int32_t effectiveLength, int32_t xScroll, int32_t xZoom,
117 bool modEncoderAction = false);
118 int32_t calculateAutomationKnobPosForModEncoderTurn(ModelStackWithAutoParam* modelStackWithParam, int32_t knobPos,
119 int32_t offset);
120};
121//}; // namespace deluge::gui::views::automation::editor_layout
122
123// extern deluge::gui::views::automation::editor_layout::AutomationEditorLayoutModControllable
124// automationEditorLayoutModControllable;
125
126extern AutomationEditorLayoutModControllable automationEditorLayoutModControllable;
Definition mod_controllable.h:24
bool toggleAutomationInterpolation()
toggle automation interpolation on / off
Definition mod_controllable.cpp:492
void renderAutomationBipolarSquare(RGB image[][kDisplayWidth+kSideBarWidth], uint8_t occupancyMask[][kDisplayWidth+kSideBarWidth], int32_t xDisplay, int32_t yDisplay, bool isAutomated, deluge::modulation::params::Kind kind, int32_t knobPos)
render column for bipolar params - e.g. pan, pitch, patch cable
Definition mod_controllable.cpp:128
void renderAutomationUnipolarSquare(RGB image[][kDisplayWidth+kSideBarWidth], uint8_t occupancyMask[][kDisplayWidth+kSideBarWidth], int32_t xDisplay, int32_t yDisplay, bool isAutomated, int32_t knobPos)
render column for unipolar params (e.g. not pan, pitch, or patch cables)
Definition mod_controllable.cpp:214
bool toggleAutomationPadSelectionMode(ModelStackWithAutoParam *modelStackWithParam, int32_t effectiveLength, int32_t xScroll, int32_t xZoom)
toggle automation pad selection mode on / off
Definition mod_controllable.cpp:510
void renderAutomationColumn(ModelStackWithAutoParam *modelStackWithParam, RGB image[][kDisplayWidth+kSideBarWidth], uint8_t occupancyMask[][kDisplayWidth+kSideBarWidth], int32_t lengthToDisplay, int32_t xDisplay, bool isAutomated, int32_t xScroll, int32_t xZoom, deluge::modulation::params::Kind kind, bool isBipolar)
render each square in each column of the automation editor grid
Definition mod_controllable.cpp:108
Definition clip.h:46
Definition model_stack.h:269
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
Definition d_stringbuf.h:16
Kind
Definition param.h:42