29 using Selection::Selection;
30 bool isToggle()
override {
return true; }
31 void readCurrentValue()
override { this->setValue(soundEditor.currentModControllable->delay.pingPong); }
33 void writeCurrentValue()
override {
34 int32_t current_value = this->getValue();
37 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
39 Kit* kit = getCurrentKit();
41 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
42 if (thisDrum->type == DrumType::SOUND) {
43 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
44 soundDrum->delay.pingPong = current_value;
50 soundEditor.currentModControllable->delay.pingPong = current_value;
54 deluge::vector<std::string_view> getOptions(OptType optType)
override {
56 using enum l10n::String;
58 l10n::getView(STRING_FOR_OFF),
59 l10n::getView(STRING_FOR_ON),
63 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
64 using namespace deluge::hid::display;
65 const auto iconBitmap = this->getValue() ? &OLED::switcherIconOn : &OLED::switcherIconOff;
67 oled_canvas::Canvas& image = OLED::main;
68 constexpr int32_t numBytesTall = 2;
69 constexpr int32_t iconHeight = numBytesTall * 8;
70 const int32_t iconWidth = iconBitmap->
size() / numBytesTall;
71 const int32_t x = startX + (width - iconWidth) / 2 - 1;
72 image.drawGraphicMultiLine(iconBitmap->data(), x, startY, iconWidth, iconHeight, numBytesTall);