32class Repeat final :
public Selection,
public FormattedTitle {
34 Repeat(l10n::String name, l10n::String title_format_str) :
Selection(name), FormattedTitle(title_format_str) {}
36 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
39 return isSampleModeSample(modControllable, whichThing);
43 void readCurrentValue()
override { this->setValue(soundEditor.currentSource->repeatMode); }
44 void writeCurrentValue()
override {
45 auto current_value = this->getValue<SampleRepeatMode>();
47 Kit* kit = getCurrentKit();
50 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
52 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
53 if (thisDrum->type == DrumType::SOUND) {
54 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
55 Source* source = &soundDrum->sources[soundEditor.currentSourceIndex];
58 if (current_value == SampleRepeatMode::STRETCH) {
59 soundDrum->killAllVoices();
60 source->sampleControls.pitchAndSpeedAreIndependent =
true;
62 else if (source->repeatMode == SampleRepeatMode::STRETCH) {
63 soundDrum->killAllVoices();
64 soundEditor.currentSource->sampleControls.pitchAndSpeedAreIndependent =
false;
67 if (current_value == SampleRepeatMode::ONCE) {
70 NoteRow* noteRow = getCurrentInstrumentClip()->getNoteRowForDrum(soundDrum, ¬eRowIndex);
71 char modelStackMemory[MODEL_STACK_MAX_SIZE];
74 modelStack->addTimelineCounter(getCurrentClip())
75 ->addNoteRow(noteRowIndex, noteRow)
77 soundEditor.currentParamManager);
78 kit->noteOffPreKitArp(modelStackWithThreeMainThings, soundDrum);
81 source->repeatMode = current_value;
88 if (
static_cast<SampleRepeatMode
>(current_value) == SampleRepeatMode::STRETCH) {
90 soundEditor.currentSource->sampleControls.pitchAndSpeedAreIndependent =
true;
92 else if (soundEditor.currentSource->repeatMode == SampleRepeatMode::STRETCH) {
94 soundEditor.currentSource->sampleControls.pitchAndSpeedAreIndependent =
false;
97 if (current_value == SampleRepeatMode::ONCE) {
100 NoteRow* noteRow = getCurrentInstrumentClip()->getNoteRowForDrum(kit->selectedDrum, ¬eRowIndex);
101 char modelStackMemory[MODEL_STACK_MAX_SIZE];
102 ModelStack* modelStack = (ModelStack*)modelStackMemory;
103 ModelStackWithThreeMainThings* modelStackWithThreeMainThings =
104 modelStack->addTimelineCounter(getCurrentClip())
105 ->addNoteRow(noteRowIndex, noteRow)
106 ->
addOtherTwoThings(soundEditor.currentModControllable, soundEditor.currentParamManager);
107 kit->noteOffPreKitArp(modelStackWithThreeMainThings, kit->selectedDrum);
110 soundEditor.currentSource->repeatMode = current_value;
115 uiNeedsRendering(&instrumentClipView, 0xFFFFFFFF, 0);
117 deluge::vector<std::string_view> getOptions(OptType optType)
override {
120 l10n::getView(l10n::String::STRING_FOR_CUT),
121 l10n::getView(l10n::String::STRING_FOR_ONCE),
122 l10n::getView(l10n::String::STRING_FOR_LOOP),
123 l10n::getView(l10n::String::STRING_FOR_STRETCH),
Definition model_stack.h:231