36 using Selection::Selection;
37 void readCurrentValue()
override { this->setValue(soundEditor.currentArpSettings->preset); }
40 void writeCurrentValue()
override {
41 auto current_value = this->getValue<ArpPreset>();
44 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
46 Kit* kit = getCurrentKit();
49 if (soundEditor.currentArpSettings->mode == ArpMode::OFF || current_value == ArpPreset::OFF) {
50 if (getCurrentClip()->isActiveOnOutput() && !soundEditor.editingKitAffectEntire()) {
55 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
56 thisDrum->arpSettings.preset = current_value;
57 thisDrum->arpSettings.updateSettingsFromCurrentPreset();
58 thisDrum->arpSettings.flagForceArpRestart =
true;
64 if (soundEditor.currentArpSettings->mode == ArpMode::OFF || current_value == ArpPreset::OFF) {
65 if (getCurrentClip()->isActiveOnOutput() && !soundEditor.editingKitAffectEntire()) {
66 char modelStackMemory[MODEL_STACK_MAX_SIZE];
69 if (soundEditor.editingKit()) {
71 Drum* currentDrum = ((
Kit*)getCurrentClip()->output)->selectedDrum;
72 if (currentDrum !=
nullptr) {
73 currentDrum->killAllVoices();
76 else if (soundEditor.editingCVOrMIDIClip()) {
77 getCurrentInstrumentClip()->stopAllNotesForMIDIOrCV(modelStack->toWithTimelineCounter());
80 ModelStackWithSoundFlags* modelStackWithSoundFlags = modelStack->addSoundFlags();
81 soundEditor.currentSound->allNotesOff(
82 modelStackWithSoundFlags,
83 soundEditor.currentSound
85 soundEditor.currentSound->reassessRenderSkippingStatus(modelStackWithSoundFlags);
90 soundEditor.currentArpSettings->preset = current_value;
91 soundEditor.currentArpSettings->updateSettingsFromCurrentPreset();
92 soundEditor.currentArpSettings->flagForceArpRestart =
true;
96 deluge::vector<std::string_view> getOptions(OptType optType)
override {
98 using enum l10n::String;
100 l10n::getView(STRING_FOR_OFF),
101 l10n::getView(STRING_FOR_UP),
102 l10n::getView(STRING_FOR_DOWN),
103 l10n::getView(STRING_FOR_BOTH),
104 l10n::getView(STRING_FOR_RANDOM),
105 l10n::getView(STRING_FOR_WALK),
106 l10n::getView(STRING_FOR_CUSTOM),
111 auto current_value = this->getValue<ArpPreset>();
112 if (current_value == ArpPreset::CUSTOM) {
113 if (soundEditor.editingKitRow()) {
114 return &arpOctaveModeToNoteModeMenuForDrums;
116 return &arpOctaveModeToNoteModeMenu;
123 void getColumnLabel(
StringBuf& label)
override { label.append(l10n::get(l10n::String::STRING_FOR_MODE)); }
125 void renderInHorizontalMenu(
const SlotPosition& slot)
override {
126 using namespace deluge::hid::display;
129 if (this->getValue<ArpPreset>() == ArpPreset::OFF) {
130 const auto off = l10n::get(l10n::String::STRING_FOR_OFF);
131 return image.drawStringCentered(off, slot.start_x, slot.start_y + kHorizontalMenuSlotYOffset + 5,
132 kTextTitleSpacingX, kTextTitleSizeY, slot.width);
135 const auto arpPreset = getValue<ArpPreset>();
136 const Icon& icon = [&] {
139 case ArpPreset::DOWN:
140 return OLED::arpModeIconUp;
141 case ArpPreset::BOTH:
142 return OLED::arpModeIconUpDown;
143 case ArpPreset::RANDOM:
144 return OLED::diceIcon;
145 case ArpPreset::WALK:
146 return OLED::arpModeIconWalk;
147 case ArpPreset::CUSTOM:
148 return OLED::arpModeIconCustom;
150 return OLED::arpModeIconUp;
154 const bool reversed = arpPreset == ArpPreset::DOWN;
155 image.drawIconCentered(icon, slot.start_x, slot.width, slot.start_y + kHorizontalMenuSlotYOffset + 1, reversed);
Definition model_stack.h:231