31 PitchSpeed(l10n::String newName, uint8_t sourceId) :
Selection(newName), source_id_{sourceId} {}
36 return getCurrentAudioClip() !=
nullptr || isSampleModeSample(modControllable, source_id_);
40 const auto& sampleControls = getCurrentSampleControls(source_id_);
41 setValue(sampleControls.pitchAndSpeedAreIndependent);
44 void writeCurrentValue()
override {
46 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
48 const Kit* kit = getCurrentKit();
50 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
51 if (thisDrum->type == DrumType::SOUND) {
52 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
53 Source* source = &soundDrum->sources[source_id_];
54 source->sampleControls.pitchAndSpeedAreIndependent = this->getValue();
60 auto& sampleControls = getCurrentSampleControls(source_id_);
61 sampleControls.pitchAndSpeedAreIndependent = this->getValue();
65 deluge::vector<std::string_view> getOptions(OptType optType)
override {
67 return {l10n::getView(l10n::String::STRING_FOR_LINKED), l10n::getView(l10n::String::STRING_FOR_INDEPENDENT)};
70 void renderInHorizontalMenu(
const HorizontalMenuSlotParams& slot)
override {
71 const Icon& icon = getValue() ? OLED::pitchSpeedIndependentIcon : OLED::pitchSpeedLinkedIcon;
72 OLED::main.drawIconCentered(icon, slot.start_x, slot.width, slot.start_y - 1);
75 void getColumnLabel(StringBuf& label)
override {
76 const auto option = getOptions(OptType::SHORT)[getValue()].data();