27class Reverse final :
public Toggle,
public FormattedTitle {
29 Reverse(l10n::String
name, l10n::String title_format_str, uint8_t source_id)
30 :
Toggle(
name), FormattedTitle(title_format_str, source_id + 1), source_id_{source_id} {}
32 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
35 return isSampleModeSample(modControllable, source_id_);
41 const Source& source = soundEditor.currentSound->sources[source_id_];
42 setValue(source.sampleControls.reversed);
45 void writeCurrentValue()
override {
47 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
49 const Kit* kit = getCurrentKit();
51 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
52 if (thisDrum->type == DrumType::SOUND) {
53 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
54 Source* source = &soundDrum->sources[source_id_];
56 soundDrum->killAllVoices();
57 source->setReversed(getValue());
63 soundEditor.currentSound->killAllVoices();
64 Source& source = soundEditor.currentSound->sources[source_id_];
65 source.setReversed(getValue());
69 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
70 const bool reversed = getValue();
71 const Icon& icon = OLED::directionIcon;
72 OLED::main.drawIconCentered(icon, startX, width, startY + 3, reversed);
75 void getColumnLabel(StringBuf& label)
override { label.append(l10n::get(l10n::String::STRING_FOR_PLAY)); }
78 valueBuf.append(l10n::get(getValue() ? l10n::String::STRING_FOR_ON : l10n::String::STRING_FOR_OFF));
82 if (parent !=
nullptr && parent->renderingStyle() == Submenu::RenderingStyle::HORIZONTAL) {