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)); }
125 using namespace deluge::hid::display;
128 if (this->getValue<ArpPreset>() == ArpPreset::OFF) {
129 const auto off = l10n::get(l10n::String::STRING_FOR_OFF);
130 return image.drawStringCentered(off, slot.start_x, slot.start_y + kHorizontalMenuSlotYOffset + 5,
131 kTextTitleSpacingX, kTextTitleSizeY, slot.width);
134 const auto arpPreset = getValue<ArpPreset>();
135 const Icon& icon = [&] {
138 case ArpPreset::DOWN:
139 return OLED::arpModeIconUp;
140 case ArpPreset::BOTH:
141 return OLED::arpModeIconUpDown;
142 case ArpPreset::RANDOM:
143 return OLED::diceIcon;
144 case ArpPreset::WALK:
145 return OLED::arpModeIconWalk;
146 case ArpPreset::CUSTOM:
147 return OLED::arpModeIconCustom;
149 return OLED::arpModeIconUp;
153 const bool reversed = arpPreset == ArpPreset::DOWN;
154 image.drawIconCentered(icon, slot.start_x, slot.width, slot.start_y + kHorizontalMenuSlotYOffset + 1, reversed);
Definition model_stack.h:231