34 Transpose(l10n::String name, l10n::String title_format_str, int32_t newP)
37 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
40 int32_t transpose = 0;
42 if ((soundEditor.currentMultiRange !=
nullptr) && soundEditor.currentSound->getSynthMode() != SynthMode::FM
43 && soundEditor.currentSource->oscType == OscType::SAMPLE) {
44 transpose = (
static_cast<MultisampleRange*
>(soundEditor.currentMultiRange))->sampleHolder.transpose;
45 cents = (
static_cast<MultisampleRange*
>(soundEditor.currentMultiRange))->sampleHolder.cents;
48 transpose = soundEditor.currentSource->transpose;
49 cents = soundEditor.currentSource->cents;
51 this->setValue(computeCurrentValueForTranspose(transpose, cents));
54 void writeCurrentValue()
override {
55 int32_t transpose, cents;
56 computeFinalValuesForTranspose(this->getValue(), &transpose, ¢s);
59 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKit()) {
61 Kit* kit = getCurrentKit();
63 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
64 if (thisDrum->type == DrumType::SOUND) {
65 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
67 if (soundDrum->sources[soundEditor.currentSourceIndex].ranges.getNumElements()
68 && soundDrum->getSynthMode() != SynthMode::FM
69 && soundDrum->sources[soundEditor.currentSourceIndex].oscType == OscType::SAMPLE) {
71 soundDrum->sources[soundEditor.currentSourceIndex].ranges.getElement(0));
72 multisampleRange->sampleHolder.transpose = transpose;
73 multisampleRange->sampleHolder.setCents(cents);
76 soundDrum->sources[soundEditor.currentSourceIndex].transpose = transpose;
77 soundDrum->sources[soundEditor.currentSourceIndex].setCents(cents);
80 char modelStackMemoryForSoundDrum[MODEL_STACK_MAX_SIZE];
82 getModelStackFromSoundDrum(modelStackMemoryForSoundDrum, soundDrum)->addSoundFlags();
84 soundDrum->recalculateAllVoicePhaseIncrements(modelStackForSoundDrum);
90 if ((soundEditor.currentMultiRange !=
nullptr) && soundEditor.currentSound->getSynthMode() != SynthMode::FM
91 && soundEditor.currentSource->oscType == OscType::SAMPLE) {
92 (
static_cast<MultisampleRange*
>(soundEditor.currentMultiRange))->sampleHolder.transpose = transpose;
93 (
static_cast<MultisampleRange*
>(soundEditor.currentMultiRange))->sampleHolder.setCents(cents);
96 soundEditor.currentSource->transpose = transpose;
97 soundEditor.currentSource->setCents(cents);
100 char modelStackMemory[MODEL_STACK_MAX_SIZE];
101 ModelStackWithSoundFlags* modelStack = soundEditor.getCurrentModelStack(modelStackMemory)->addSoundFlags();
103 soundEditor.currentSound->recalculateAllVoicePhaseIncrements(modelStack);
107 MenuPermission checkPermissionToBeginSession(ModControllableAudio* modControllable, int32_t whichThing,
108 ::MultiRange** currentRange)
override {
110 if (!
isRelevant(modControllable, whichThing)) {
111 return MenuPermission::NO;
114 Sound* sound =
static_cast<Sound*
>(modControllable);
115 Source* source = &sound->sources[whichThing];
117 if (sound->getSynthMode() == SynthMode::FM
118 || (source->oscType != OscType::SAMPLE && source->oscType != OscType::WAVETABLE)) {
119 return MenuPermission::YES;
122 return soundEditor.checkPermissionToBeginSessionForRangeSpecificParam(sound, whichThing, currentRange);