25class IteranceStepToggle :
public Toggle {
29 IteranceStepToggle(l10n::String newName, l10n::String
title, uint8_t newIndex) :
Toggle(newName,
title) {
30 this->index = newIndex;
34 auto* clip =
static_cast<InstrumentClip*
>(modelStack->getTimelineCounter());
36 clip->getNoteRowOnScreen(instrumentClipView.lastAuditionedYDisplay,
39 bool isKit = clip->output->type == OutputType::KIT;
42 if (!modelStackWithNoteRow->getNoteRowAllowNull()) {
43 modelStackWithNoteRow =
44 instrumentClipView.createNoteRowForYDisplay(modelStack, instrumentClipView.lastAuditionedYDisplay);
48 return modelStackWithNoteRow;
51 void updateDisplay() {
52 if (display->haveOLED()) {
61 char modelStackMemory[MODEL_STACK_MAX_SIZE];
65 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
66 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
67 Iterance iterance = noteRow->iteranceValue;
68 if (iterance == kDefaultIteranceValue) {
71 iterance = kCustomIteranceValue;
73 this->setValue(iterance.iteranceStep[index]);
77 void writeCurrentValue()
override {
78 bool value = this->getValue();
79 char modelStackMemory[MODEL_STACK_MAX_SIZE];
83 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
84 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
85 Iterance iterance = noteRow->iteranceValue;
86 if (iterance == kDefaultIteranceValue) {
89 iterance = kCustomIteranceValue;
91 int32_t newIteranceSteps = iterance.toInt() & 0xFF;
93 newIteranceSteps |= (1 << index);
96 newIteranceSteps &= ~(1 << index);
98 instrumentClipView.setNoteRowIteranceWithFinalValue(
Iterance{iterance.divisor, newIteranceSteps});
105 char modelStackMemory[MODEL_STACK_MAX_SIZE];
109 if (modelStackWithNoteRow->getNoteRowAllowNull() !=
nullptr) {
110 NoteRow* noteRow = modelStackWithNoteRow->getNoteRowAllowNull();
111 Iterance iterance = noteRow->iteranceValue;
113 return (iterance == kDefaultIteranceValue && index == 0) || iterance.divisor > index;