Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
Loading...
Searching...
No Matches
randomizer_unpatched_param.h
1
/*
2
* Copyright (c) 2014-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
#pragma once
18
#include "gui/menu_item/unpatched_param.h"
19
#include "gui/ui/sound_editor.h"
20
21
#include <util/comparison.h>
22
23
namespace
deluge::gui::menu_item::randomizer {
24
class
RandomizerUnpatchedParam :
public
UnpatchedParam {
25
public
:
26
using
UnpatchedParam::UnpatchedParam;
27
28
RandomizerUnpatchedParam(l10n::String newName, l10n::String
title
, int32_t newP, RenderingStyle style)
29
: UnpatchedParam(newName,
title
, newP), style_(style) {}
30
31
bool
isRelevant
(
ModControllableAudio
* modControllable, int32_t whichThing)
override
{
32
if
(soundEditor.editingCVOrMIDIClip() || soundEditor.editingNonAudioDrumRow()) {
33
return
false
;
34
}
35
36
using namespace
modulation::params
;
37
const
auto
p =
static_cast<
UnpatchedShared
>
(getP());
38
const
bool
isGlobal =
39
util::one_of(p, {UNPATCHED_SPREAD_VELOCITY, UNPATCHED_NOTE_PROBABILITY, UNPATCHED_REVERSE_PROBABILITY});
40
41
return
isGlobal || soundEditor.currentArpSettings->mode != ArpMode::OFF;
42
}
43
44
void
getColumnLabel(
StringBuf
& label)
override
{
45
label.append(deluge::l10n::get(deluge::l10n::built_in::seven_segment, this->name));
46
}
47
48
[[nodiscard]] RenderingStyle getRenderingStyle()
const override
{
return
style_; }
49
50
private
:
51
RenderingStyle style_ = KNOB;
52
};
53
54
class
RandomizerSoundOnlyUnpatchedParam
final :
public
UnpatchedParam {
55
public
:
56
using
UnpatchedParam::UnpatchedParam;
57
bool
isRelevant
(
ModControllableAudio
* modControllable, int32_t whichThing)
override
{
58
return
!soundEditor.editingCVOrMIDIClip() && !soundEditor.editingKitAffectEntire()
59
&& !soundEditor.editingNonAudioDrumRow() && soundEditor.currentArpSettings->mode != ArpMode::OFF;
60
}
61
void
getColumnLabel(
StringBuf
& label)
override
{
62
label.append(deluge::l10n::getView(deluge::l10n::built_in::seven_segment, this->name).data());
63
}
64
};
65
66
class
RandomizerNonKitSoundUnpatchedParam final :
public
UnpatchedParam {
67
public
:
68
using
UnpatchedParam::UnpatchedParam;
69
70
RandomizerNonKitSoundUnpatchedParam(l10n::String newName, l10n::String
title
, int32_t newP, RenderingStyle style)
71
: UnpatchedParam(newName,
title
, newP), style_(style) {}
72
73
bool
isRelevant
(
ModControllableAudio
* modControllable, int32_t whichThing)
override
{
74
return
!soundEditor.editingCVOrMIDIClip() && !soundEditor.editingKit()
75
&& soundEditor.currentArpSettings->mode != ArpMode::OFF;
76
}
77
void
getColumnLabel(
StringBuf
& label)
override
{
78
label.append(deluge::l10n::get(deluge::l10n::built_in::seven_segment, this->name));
79
}
80
[[nodiscard]] RenderingStyle getRenderingStyle()
const override
{
return
style_; }
81
82
private
:
83
RenderingStyle style_ = KNOB;
84
};
85
86
}
// namespace deluge::gui::menu_item::randomizer
MenuItem::title
deluge::l10n::String title
Can get overridden by getTitle(). Actual max num chars for OLED display is 14.
Definition
menu_item.h:222
ModControllableAudio
Definition
mod_controllable_audio.h:47
StringBuf
Definition
d_stringbuf.h:16
deluge::gui::menu_item::randomizer::RandomizerNonKitSoundUnpatchedParam::isRelevant
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition
randomizer_unpatched_param.h:73
deluge::gui::menu_item::randomizer::RandomizerSoundOnlyUnpatchedParam
Definition
randomizer_unpatched_param.h:54
deluge::gui::menu_item::randomizer::RandomizerSoundOnlyUnpatchedParam::isRelevant
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition
randomizer_unpatched_param.h:57
deluge::gui::menu_item::randomizer::RandomizerUnpatchedParam::isRelevant
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition
randomizer_unpatched_param.h:31
deluge::modulation::params
Definition
param.cpp:28