33 using IntegerWithOff::IntegerWithOff;
35 uint8_t voiceCount = soundEditor.currentSound->maxVoiceCount;
36 if (voiceCount > getMaxValue()) {
39 this->setValue(voiceCount);
42 void writeCurrentValue()
override {
43 int32_t current_value = this->getValue();
44 current_value = current_value == 0 ? 127 : current_value;
47 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
49 Kit* kit = getCurrentKit();
51 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
52 if (thisDrum->type == DrumType::SOUND) {
53 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
55 if (soundDrum->polyphonic == PolyphonyMode::POLY) {
56 soundDrum->maxVoiceCount = current_value;
63 soundEditor.currentSound->maxVoiceCount = current_value;
66 [[nodiscard]] int32_t getMinValue()
const override {
return 0; }
67 [[nodiscard]] int32_t getMaxValue()
const override {
return 16; }
68 [[nodiscard]] NumberStyle getNumberStyle()
const override {
return NUMBER; }
71 Sound* sound =
static_cast<Sound*
>(modControllable);
72 return (sound->polyphonic == PolyphonyMode::POLY);
75 void getColumnLabel(
StringBuf& label)
override {
76 label.append(deluge::l10n::get(l10n::String::STRING_FOR_MAX_VOICES_SHORT));
80 if (
const auto value = getValue(); value == 0) {
81 valueBuf.append(l10n::get(l10n::String::STRING_FOR_OFF));
84 valueBuf.appendInt(value);
88 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
89 if (getValue() == 0) {
90 const auto& icon = OLED::infinityIcon;
91 const int32_t y = startY + (height - 8) / 2;
92 const int32_t x = startX + (width - icon.size()) / 2;
93 return OLED::main.drawGraphicMultiLine(icon.data(), x, y, icon.size());
95 IntegerWithOff::renderInHorizontalMenu(startX, width, startY, height);
103 using Selection::Selection;
106 void writeCurrentValue()
override {
107 auto current_value = this->getValue<PolyphonyMode>();
110 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
112 Kit* kit = getCurrentKit();
114 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
115 if (thisDrum->type == DrumType::SOUND) {
116 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
117 soundDrum->polyphonic = current_value;
123 soundEditor.currentSound->polyphonic = current_value;
127 deluge::vector<std::string_view> getOptions(OptType optType)
override {
129 deluge::vector<std::string_view> options = {
130 l10n::getView(l10n::String::STRING_FOR_AUTO),
131 l10n::getView(l10n::String::STRING_FOR_POLYPHONIC),
132 l10n::getView(l10n::String::STRING_FOR_MONOPHONIC),
133 l10n::getView(l10n::String::STRING_FOR_LEGATO),
136 if (soundEditor.editingKit()) {
137 options.push_back(l10n::getView(l10n::String::STRING_FOR_CHOKE));
142 if (this->getValue<PolyphonyMode>() == PolyphonyMode::POLY) {
143 return &polyphonicVoiceCountMenu;
148 void getColumnLabel(
StringBuf& label)
override {
149 label.append(deluge::l10n::get(l10n::String::STRING_FOR_POLYPHONY_SHORT));