Deluge Firmware 1.3.0
Build date: 2026.07.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 bool canDisplayFavourites() override { return true; }
75
76protected:
77 void enterKeyPress() override;
78 void exitAction() override;
79 ActionResult backButtonAction() override;
80 void folderContentsReady(int32_t entryDirection) override;
81 void currentFileChanged(int32_t movementDirection) override;
82
83private:
84 void displayCurrentFilename();
85 void previewIfPossible(int32_t movementDirection = 1);
86 void audioFileIsNowSet();
87 bool canImportWholeKit();
88 bool loadAllSamplesInFolder(bool detectPitch, int32_t* getNumSamples, Sample*** getSortArea,
89 bool* getDoingSingleCycle = nullptr, int32_t* getNumCharsInPrefix = nullptr);
90 Error getCurrentFilePath(String* path) override;
91 void drawKeysOverWaveform();
92 void autoDetectSideChainSending(SoundDrum* drum, Source* source, char const* fileName);
93 void possiblySetUpBlinking();
94
95 bool autoLoadEnabled;
96
97 bool currentlyShowingSamplePreview;
98
99 bool qwertyCurrentlyDrawnOnscreen; // This will linger as true even when qwertyVisible has been set to false
100};
101
102extern SampleBrowser sampleBrowser;
Base class for all menu items.
Definition menu_item.h:50
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