Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
audio_interpolation.h
1#pragma once
2
3#include "definitions_cxx.hpp"
4#include "gui/menu_item/selection.h"
5#include "gui/ui/sound_editor.h"
6#include "model/instrument/kit.h"
7#include "model/sample/sample_controls.h"
8#include "model/song/song.h"
9#include "processing/sound/sound.h"
10#include "processing/sound/sound_drum.h"
11
12namespace deluge::gui::menu_item {
13
15public:
16 using Selection::Selection;
17
18 void readCurrentValue() override { this->setValue(soundEditor.currentSampleControls->interpolationMode); }
19
20 bool usesAffectEntire() override { return true; }
21 void writeCurrentValue() override {
22 auto current_value = this->getValue<InterpolationMode>();
23
24 // If affect-entire button held, do whole kit
25 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
26
27 Kit* kit = getCurrentKit();
28
29 for (Drum* thisDrum = kit->firstDrum; thisDrum != nullptr; thisDrum = thisDrum->next) {
30 if (thisDrum->type == DrumType::SOUND) {
31 auto* soundDrum = static_cast<SoundDrum*>(thisDrum);
32 // Note: we need to apply the same filtering as stated in the isRelevant() function
33 soundDrum->sources[soundEditor.currentSourceIndex].sampleControls.interpolationMode = current_value;
34 }
35 }
36 }
37 // Or, the normal case of just one sound
38 else {
39 soundEditor.currentSampleControls->interpolationMode = current_value;
40 }
41 }
42
43 deluge::vector<std::string_view> getOptions(OptType optType) override {
44 (void)optType;
45 return {l10n::getView(l10n::String::STRING_FOR_LINEAR), l10n::getView(l10n::String::STRING_FOR_SINC)};
46 }
47};
48
49} // namespace deluge::gui::menu_item
Definition drum.h:44
Definition kit.h:34
Definition sound_drum.h:28
Definition audio_interpolation.h:14
bool usesAffectEntire() override
Claim support for Kit AFFECT_ENTIRE editing.
Definition audio_interpolation.h:20
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition audio_interpolation.h:18
Definition selection.h:26