35 using Selection::Selection;
36 void readCurrentValue()
override { this->setValue(soundEditor.currentArpSettings->preset); }
39 void writeCurrentValue()
override {
40 auto current_value = this->getValue<ArpPreset>();
43 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
45 Kit* kit = getCurrentKit();
48 if (soundEditor.currentArpSettings->mode == ArpMode::OFF || current_value == ArpPreset::OFF) {
49 if (getCurrentClip()->isActiveOnOutput() && !soundEditor.editingKitAffectEntire()) {
54 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
55 thisDrum->arpSettings.preset = current_value;
56 thisDrum->arpSettings.updateSettingsFromCurrentPreset();
57 thisDrum->arpSettings.flagForceArpRestart =
true;
63 if (soundEditor.currentArpSettings->mode == ArpMode::OFF || current_value == ArpPreset::OFF) {
64 if (getCurrentClip()->isActiveOnOutput() && !soundEditor.editingKitAffectEntire()) {
65 char modelStackMemory[MODEL_STACK_MAX_SIZE];
68 if (soundEditor.editingKit()) {
70 Drum* currentDrum = ((
Kit*)getCurrentClip()->output)->selectedDrum;
71 if (currentDrum !=
nullptr) {
72 currentDrum->killAllVoices();
75 else if (soundEditor.editingCVOrMIDIClip()) {
76 getCurrentInstrumentClip()->stopAllNotesForMIDIOrCV(modelStack->toWithTimelineCounter());
79 ModelStackWithSoundFlags* modelStackWithSoundFlags = modelStack->addSoundFlags();
80 soundEditor.currentSound->allNotesOff(
81 modelStackWithSoundFlags,
82 soundEditor.currentSound
84 soundEditor.currentSound->reassessRenderSkippingStatus(modelStackWithSoundFlags);
89 soundEditor.currentArpSettings->preset = current_value;
90 soundEditor.currentArpSettings->updateSettingsFromCurrentPreset();
91 soundEditor.currentArpSettings->flagForceArpRestart =
true;
95 deluge::vector<std::string_view> getOptions(OptType optType)
override {
97 using enum l10n::String;
99 l10n::getView(STRING_FOR_OFF),
100 l10n::getView(STRING_FOR_UP),
101 l10n::getView(STRING_FOR_DOWN),
102 l10n::getView(STRING_FOR_BOTH),
103 l10n::getView(STRING_FOR_RANDOM),
104 l10n::getView(STRING_FOR_WALK),
105 l10n::getView(STRING_FOR_CUSTOM),
110 auto current_value = this->getValue<ArpPreset>();
111 if (current_value == ArpPreset::CUSTOM) {
112 if (soundEditor.editingKitRow()) {
113 return &arpOctaveModeToNoteModeMenuForDrums;
115 return &arpOctaveModeToNoteModeMenu;
122 void getColumnLabel(
StringBuf& label)
override { label.append(l10n::get(l10n::String::STRING_FOR_MODE)); }
124 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
125 using namespace deluge::hid::display;
128 if (this->getValue<ArpPreset>() == ArpPreset::OFF) {
129 const auto offString = l10n::get(l10n::String::STRING_FOR_OFF);
130 return image.drawStringCentered(offString, startX, startY + 8, kTextTitleSpacingX, kTextTitleSizeY, width);
133 const auto arpPreset = getValue<ArpPreset>();
134 const Icon& icon = [&] {
137 case ArpPreset::DOWN:
138 return OLED::arpModeIconUp;
139 case ArpPreset::BOTH:
140 return OLED::arpModeIconUpDown;
141 case ArpPreset::RANDOM:
142 return OLED::diceIcon;
143 case ArpPreset::WALK:
144 return OLED::arpModeIconWalk;
145 case ArpPreset::CUSTOM:
146 return OLED::arpModeIconCustom;
148 return OLED::arpModeIconUp;
152 const bool reversed = arpPreset == ArpPreset::DOWN;
153 image.drawIconCentered(icon, startX, width, startY + 4, reversed);
Definition model_stack.h:231