27class TimeStretch final :
public Integer,
public FormattedTitle {
29 TimeStretch(l10n::String name, l10n::String title_format_str, uint8_t source_id)
30 :
Integer(name), FormattedTitle(title_format_str, source_id + 1), source_id_{source_id} {}
32 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
37 return isSampleModeSample(modControllable, source_id_);
41 const Source& source = soundEditor.currentSound->sources[source_id_];
42 setValue(source.timeStretchAmount);
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_];
55 source->timeStretchAmount = getValue();
61 Source& source = soundEditor.currentSound->sources[source_id_];
62 source.timeStretchAmount = getValue();
65 [[nodiscard]] int32_t getMinValue()
const override {
return -48; }
66 [[nodiscard]] int32_t getMaxValue()
const override {
return 48; }
68 void getColumnLabel(StringBuf& label)
override { label.append(l10n::get(l10n::String::STRING_FOR_SPEED_SHORT)); }