Deluge Firmware 1.3.0
Build date: 2025.04.16
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;
37
38class SampleBrowser final : public Browser {
39public:
40 SampleBrowser();
41 bool getGreyoutColsAndRows(uint32_t* cols, uint32_t* rows) override;
42 bool opened() override;
43 void focusRegained() override;
44 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
45 ActionResult verticalEncoderAction(int32_t offset, bool inCardRoutine) override;
46 ActionResult horizontalEncoderAction(int32_t offset) override;
47 ActionResult padAction(int32_t x, int32_t y, int32_t velocity) override;
48 bool canSeeViewUnderneath() override;
49 Error claimAudioFileForInstrument(bool makeWaveTableWorkAtAllCosts = false);
50 Error claimAudioFileForAudioClip();
51 void scrollFinished() override;
52 bool importFolderAsKit();
53 bool importFolderAsMultisamples();
54 ActionResult timerCallback() override;
55 bool claimCurrentFile(int32_t mayDoPitchDetection = 1, int32_t mayDoSingleCycle = 1, int32_t mayDoWaveTable = 1,
56 bool loadWithoutExiting = false); // 0 means no. 1 means auto. 2 means yes definitely
57 bool renderMainPads(uint32_t whichRows, RGB image[][kDisplayWidth + kSideBarWidth],
58 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth], bool drawUndefinedArea = true) override;
59 void exitAndNeverDeleteDrum();
60
61 String lastFilePathLoaded;
62
63 // ui
64 UIType getUIType() override { return UIType::SAMPLE_BROWSER; }
65
66protected:
67 void enterKeyPress() override;
68 void exitAction() override;
69 ActionResult backButtonAction() override;
70 void folderContentsReady(int32_t entryDirection) override;
71 void currentFileChanged(int32_t movementDirection) override;
72
73private:
74 void displayCurrentFilename();
75 void previewIfPossible(int32_t movementDirection = 1);
76 void audioFileIsNowSet();
77 bool canImportWholeKit();
78 bool loadAllSamplesInFolder(bool detectPitch, int32_t* getNumSamples, Sample*** getSortArea,
79 bool* getDoingSingleCycle = nullptr, int32_t* getNumCharsInPrefix = nullptr);
80 Error getCurrentFilePath(String* path) override;
81 void drawKeysOverWaveform();
82 void autoDetectSideChainSending(SoundDrum* drum, Source* source, char const* fileName);
83 void possiblySetUpBlinking();
84
85 bool autoLoadEnabled;
86
87 bool currentlyShowingSamplePreview;
88
89 bool qwertyCurrentlyDrawnOnscreen; // This will linger as true even when qwertyVisible has been set to false
90};
91
92extern SampleBrowser sampleBrowser;
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:38
Definition sample.h:50
Definition sound_drum.h:28
Definition source.h:31
Definition d_string.h:46