31 using IntegerWithOff::IntegerWithOff;
33 uint8_t voiceCount = soundEditor.currentSound->maxVoiceCount;
34 if (voiceCount > getMaxValue()) {
37 this->setValue(voiceCount);
40 void writeCurrentValue()
override {
41 int32_t current_value = this->getValue();
42 current_value = current_value == 0 ? 127 : current_value;
45 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
47 Kit* kit = getCurrentKit();
49 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
50 if (thisDrum->type == DrumType::SOUND) {
51 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
53 if (soundDrum->polyphonic == PolyphonyMode::POLY) {
54 soundDrum->maxVoiceCount = current_value;
61 soundEditor.currentSound->maxVoiceCount = current_value;
64 [[nodiscard]] int32_t getMinValue()
const override {
return 0; }
65 [[nodiscard]] int32_t getMaxValue()
const override {
return 16; }
68 Sound* sound =
static_cast<Sound*
>(modControllable);
69 return (sound->polyphonic == PolyphonyMode::POLY);
73 label.append(deluge::l10n::get(deluge::l10n::String::STRING_FOR_MAX_VOICES_SHORT));
81 using Selection::Selection;
82 void readCurrentValue()
override { this->setValue(soundEditor.currentSound->polyphonic); }
84 void writeCurrentValue()
override {
85 auto current_value = this->getValue<PolyphonyMode>();
88 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
90 Kit* kit = getCurrentKit();
92 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
93 if (thisDrum->type == DrumType::SOUND) {
94 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
95 soundDrum->polyphonic = current_value;
101 soundEditor.currentSound->polyphonic = current_value;
105 deluge::vector<std::string_view> getOptions(OptType optType)
override {
107 deluge::vector<std::string_view> options = {
108 l10n::getView(l10n::String::STRING_FOR_AUTO),
109 l10n::getView(l10n::String::STRING_FOR_POLYPHONIC),
110 l10n::getView(l10n::String::STRING_FOR_MONOPHONIC),
111 l10n::getView(l10n::String::STRING_FOR_LEGATO),
114 if (soundEditor.editingKit()) {
115 options.push_back(l10n::getView(l10n::String::STRING_FOR_CHOKE));
120 if (this->getValue<PolyphonyMode>() == PolyphonyMode::POLY) {
121 return &polyphonicVoiceCountMenu;
127 label.append(deluge::l10n::get(l10n::String::STRING_FOR_POLYPHONY_SHORT));