26class IteranceStepToggle :
public Toggle {
30 IteranceStepToggle(l10n::String newName, l10n::String
title, uint8_t newIndex) :
Toggle(newName,
title) {
31 this->index = newIndex;
35 auto* clip =
static_cast<InstrumentClip*
>(modelStack->getTimelineCounter());
37 clip->getNoteRowOnScreen(instrumentClipView.lastAuditionedYDisplay,
40 bool isKit = clip->output->type == OutputType::KIT;
43 if (!modelStackWithNoteRow->getNoteRowAllowNull()) {
44 modelStackWithNoteRow =
45 instrumentClipView.createNoteRowForYDisplay(modelStack, instrumentClipView.lastAuditionedYDisplay);
49 return modelStackWithNoteRow;
52 void updateDisplay() {
53 if (display->haveOLED()) {
62 char modelStackMemory[MODEL_STACK_MAX_SIZE];
66 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
67 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
68 Iterance iterance = noteRow->iteranceValue;
69 if (iterance == kDefaultIteranceValue) {
72 iterance = kCustomIteranceValue;
74 this->setValue(iterance.iteranceStep[index]);
78 void writeCurrentValue()
override {
79 bool value = this->getValue();
80 char modelStackMemory[MODEL_STACK_MAX_SIZE];
84 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
85 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
86 Iterance iterance = noteRow->iteranceValue;
87 if (iterance == kDefaultIteranceValue) {
90 iterance = kCustomIteranceValue;
92 int32_t newIteranceSteps = iterance.toInt() & 0xFF;
94 newIteranceSteps |= (1 << index);
97 newIteranceSteps &= ~(1 << index);
99 instrumentClipView.setNoteRowIteranceWithFinalValue(
Iterance{iterance.divisor, newIteranceSteps});
106 char modelStackMemory[MODEL_STACK_MAX_SIZE];
110 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
111 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
112 Iterance iterance = noteRow->iteranceValue;
114 return (iterance == kDefaultIteranceValue && index == 0) || iterance.divisor > index;