31 PitchSpeed(l10n::String newName, uint8_t sourceId) :
Selection(newName), source_id_{sourceId} {}
36 if (
const auto audioClip = getCurrentAudioClip(); audioClip !=
nullptr) {
37 return audioClip->sampleHolder.audioFile !=
nullptr;
39 return isSampleModeSample(modControllable, source_id_);
43 const auto& sampleControls = getCurrentSampleControls(source_id_);
44 setValue(sampleControls.pitchAndSpeedAreIndependent);
47 void writeCurrentValue()
override {
49 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
51 const Kit* kit = getCurrentKit();
53 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
54 if (thisDrum->type == DrumType::SOUND) {
55 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
56 Source* source = &soundDrum->sources[source_id_];
57 source->sampleControls.pitchAndSpeedAreIndependent = this->getValue();
63 auto& sampleControls = getCurrentSampleControls(source_id_);
64 sampleControls.pitchAndSpeedAreIndependent = this->getValue();
68 deluge::vector<std::string_view> getOptions(OptType optType)
override {
70 return {l10n::getView(l10n::String::STRING_FOR_LINKED), l10n::getView(l10n::String::STRING_FOR_INDEPENDENT)};
73 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
74 const Icon& icon = getValue() ? OLED::pitchSpeedIndependentIcon : OLED::pitchSpeedLinkedIcon;
75 OLED::main.drawIconCentered(icon, startX, width, startY);
78 void getColumnLabel(StringBuf& label)
override {
79 const auto option = getOptions(OptType::SHORT)[getValue()].data();