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; }
67 Sound* sound =
static_cast<Sound*
>(modControllable);
68 return (sound->polyphonic == PolyphonyMode::POLY);
76 using Selection::Selection;
77 void readCurrentValue()
override { this->setValue(soundEditor.currentSound->polyphonic); }
79 void writeCurrentValue()
override {
80 auto current_value = this->getValue<PolyphonyMode>();
83 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
85 Kit* kit = getCurrentKit();
87 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
88 if (thisDrum->type == DrumType::SOUND) {
89 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
90 soundDrum->polyphonic = current_value;
96 soundEditor.currentSound->polyphonic = current_value;
100 deluge::vector<std::string_view> getOptions(OptType optType)
override {
102 deluge::vector<std::string_view> options = {
103 l10n::getView(l10n::String::STRING_FOR_AUTO),
104 l10n::getView(l10n::String::STRING_FOR_POLYPHONIC),
105 l10n::getView(l10n::String::STRING_FOR_MONOPHONIC),
106 l10n::getView(l10n::String::STRING_FOR_LEGATO),
109 if (soundEditor.editingKit()) {
110 options.push_back(l10n::getView(l10n::String::STRING_FOR_CHOKE));
115 if (this->getValue<PolyphonyMode>() == PolyphonyMode::POLY) {
116 return &polyphonicVoiceCountMenu;