Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
audio_clip_view.h
1/*
2 * Copyright © 2019-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 "gui/views/clip_view.h"
21#include "hid/button.h"
22#include "model/clip/clip_minder.h"
23#include <cstdint>
24
25class AudioClip;
26
27class AudioClipView final : public ClipView, public ClipMinder {
28public:
29 AudioClipView() = default;
30
31 bool opened() override;
32 void focusRegained() override;
33 bool renderMainPads(uint32_t whichRows, RGB image[][kDisplayWidth + kSideBarWidth],
34 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], bool drawUndefinedArea = true) override;
35 bool renderSidebar(uint32_t whichRows, RGB image[][kDisplayWidth + kSideBarWidth],
36 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth]) override;
37 bool setupScroll(uint32_t oldScroll) override;
38 void tellMatrixDriverWhichRowsContainSomethingZoomable() override;
39 [[nodiscard]] bool supportsTriplets() const override { return false; }
40 ClipMinder* toClipMinder() override { return this; }
41
42 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
43 ActionResult padAction(int32_t x, int32_t y, int32_t velocity) override;
44
45 void graphicsRoutine() override;
46 void playbackEnded() override;
47
48 void clipNeedsReRendering(Clip* clip) override;
49 void sampleNeedsReRendering(Sample* sample) override;
50 void selectEncoderAction(int8_t offset) override;
51 void setClipLengthEqualToSampleLength();
52 void adjustLoopLength(int32_t newLength);
53 ActionResult horizontalEncoderAction(int32_t offset) override;
54 ActionResult editClipLengthWithoutTimestretching(int32_t offset);
55 ActionResult verticalEncoderAction(int32_t offset, bool inCardRoutine) override;
56 ActionResult timerCallback() override;
57 uint32_t getMaxLength() override;
58 uint32_t getMaxZoom() override;
59
60 void renderOLED(deluge::hid::display::oled_canvas::Canvas& canvas) override;
61
62 // ui
63 UIType getUIType() override { return UIType::AUDIO_CLIP; }
64
65private:
66 uint32_t timeSongButtonPressed;
67 void needsRenderingDependingOnSubMode();
68 int32_t lastTickSquare;
69 bool mustRedrawTickSquares;
70
71 bool endMarkerVisible; // True if user is currently adjusting the clip's end
72 bool startMarkerVisible; // True if user is currently adjusting the clip's start
73 bool blinkOn;
74
75 void changeUnderlyingSampleLength(AudioClip& clip, const Sample* sample, int32_t newLength, int32_t oldLength,
76 uint64_t oldLengthSamples) const;
77 void changeUnderlyingSampleStart(AudioClip& clip, const Sample* sample, int32_t newStartTicks, int32_t oldLength,
78 uint64_t oldLengthSamples) const;
79};
80
81extern AudioClipView audioClipView;
Definition audio_clip_view.h:27
ClipMinder * toClipMinder() override
Definition audio_clip_view.h:40
Definition audio_clip.h:35
Definition clip_minder.h:23
Definition clip.h:46
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
Definition sample.h:50