Deluge Firmware 1.3.0
Build date: 2025.09.12
Loading...
Searching...
No Matches
sample_browser.h
1/*
2 * Copyright © 2015-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/ui/browser/browser.h"
22#include "hid/button.h"
23
24extern "C" {
25
26#include "fatfs/ff.h"
27
28FRESULT f_readdir_get_filepointer(DIR* dp, /* Pointer to the open directory object */
29 FILINFO* fno, /* Pointer to file information to return */
30 FilePointer* filePointer);
31}
32
33class SoundDrum;
35class Source;
36class Sample;
37class MenuItem;
38
39namespace deluge::gui::menu_item {
40class HorizontalMenu;
41}
42
43class SampleBrowser final : public Browser {
44public:
45 SampleBrowser();
46 bool getGreyoutColsAndRows(uint32_t* cols, uint32_t* rows) override;
47 bool opened() override;
48 void focusRegained() override;
49 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
50 ActionResult verticalEncoderAction(int32_t offset, bool inCardRoutine) override;
51 ActionResult horizontalEncoderAction(int32_t offset) override;
52 ActionResult padAction(int32_t x, int32_t y, int32_t velocity) override;
53 bool canSeeViewUnderneath() override;
54 Error claimAudioFileForInstrument(bool makeWaveTableWorkAtAllCosts = false);
55 Error claimAudioFileForAudioClip();
56 void scrollFinished() override;
57 bool importFolderAsKit();
58 bool importFolderAsMultisamples();
59 ActionResult timerCallback() override;
60 bool claimCurrentFile(int32_t mayDoPitchDetection = 1, int32_t mayDoSingleCycle = 1, int32_t mayDoWaveTable = 1,
61 bool loadWithoutExiting = false); // 0 means no. 1 means auto. 2 means yes definitely
62 bool renderMainPads(uint32_t whichRows, RGB image[][kDisplayWidth + kSideBarWidth],
63 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], bool drawUndefinedArea = true) override;
64 void exitAndNeverDeleteDrum();
65
66 String lastFilePathLoaded;
67
68 // menus to open when a sample file is selected
69 deluge::gui::menu_item::HorizontalMenu* parentMenuHeadingTo{nullptr};
70 MenuItem* menuItemHeadingTo{nullptr};
71
72 // ui
73 UIType getUIType() override { return UIType::SAMPLE_BROWSER; }
74
75protected:
76 void enterKeyPress() override;
77 void exitAction() override;
78 ActionResult backButtonAction() override;
79 void folderContentsReady(int32_t entryDirection) override;
80 void currentFileChanged(int32_t movementDirection) override;
81
82private:
83 void displayCurrentFilename();
84 void previewIfPossible(int32_t movementDirection = 1);
85 void audioFileIsNowSet();
86 bool canImportWholeKit();
87 bool loadAllSamplesInFolder(bool detectPitch, int32_t* getNumSamples, Sample*** getSortArea,
88 bool* getDoingSingleCycle = nullptr, int32_t* getNumCharsInPrefix = nullptr);
89 Error getCurrentFilePath(String* path) override;
90 void drawKeysOverWaveform();
91 void autoDetectSideChainSending(SoundDrum* drum, Source* source, char const* fileName);
92 void possiblySetUpBlinking();
93
94 bool autoLoadEnabled;
95
96 bool currentlyShowingSamplePreview;
97
98 bool qwertyCurrentlyDrawnOnscreen; // This will linger as true even when qwertyVisible has been set to false
99};
100
101extern SampleBrowser sampleBrowser;
Base class for all menu items.
Definition menu_item.h:43
Definition numeric_layer_scrolling_text.h:22
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
Definition sample_browser.h:43
UIType getUIType() override
What type of UI is this? e.g. UIType::ARRANGER.
Definition sample_browser.h:73
Definition sample.h:50
Definition sound_drum.h:28
Definition source.h:31
Definition d_string.h:41
Definition horizontal_menu.h:28