29class Rhythm final :
public UnpatchedParam {
31 using UnpatchedParam::UnpatchedParam;
33 [[nodiscard]] int32_t getMinValue()
const override {
return 0; }
34 [[nodiscard]] int32_t getMaxValue()
const override {
return kMaxPresetArpRhythm; }
36 void drawValue()
override { display->setScrollingText(arpRhythmPatternNames[this->getValue()]); }
38 void drawInteger(int32_t textWidth, int32_t textHeight, int32_t yPixel)
override {
41 snprintf(name,
sizeof(name),
"%d: %s", this->getValue(), arpRhythmPatternNames[this->getValue()]);
42 OLED::main.drawStringCentred(name, yPixel + OLED_MAIN_TOPMOST_PIXEL, textWidth, textHeight);
45 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
48 const auto value = this->getValue();
49 const auto pattern = std::string_view(arpRhythmPatternNames[value]);
51 return image.drawStringCentered(pattern.data(), startX, startY + 3, kTextSpacingX, kTextSpacingY, width);
54 constexpr int32_t paddingBetween = 2;
55 const int32_t rhythmWidth = pattern.size() * kTextSpacingX + pattern.size() * paddingBetween;
57 int32_t x = startX + (width - rhythmWidth) / 2 + 2;
58 for (
const char character : pattern) {
59 image.drawChar(character ==
'0' ?
'X' : character, x, startY + 3, kTextSpacingX, kTextSpacingY);
60 x += kTextSpacingX + paddingBetween;
65 return !soundEditor.editingCVOrMIDIClip() && !soundEditor.editingNonAudioDrumRow();