27class TimeStretch final :
public Integer,
public FormattedTitle {
29 TimeStretch(l10n::String name, l10n::String title_format_str) :
Integer(name), FormattedTitle(title_format_str) {}
31 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
35 void readCurrentValue()
override { this->setValue(soundEditor.currentSource->timeStretchAmount); }
37 void writeCurrentValue()
override {
40 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
42 Kit* kit = getCurrentKit();
44 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
45 if (thisDrum->type == DrumType::SOUND) {
46 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
47 Source* source = &soundDrum->sources[soundEditor.currentSourceIndex];
49 source->timeStretchAmount = this->getValue();
55 soundEditor.currentSource->timeStretchAmount = this->getValue();
58 [[nodiscard]] int32_t getMinValue()
const override {
return -48; }
59 [[nodiscard]] int32_t getMaxValue()
const override {
return 48; }
61 return isSampleModeSample(modControllable, whichThing);