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; }
66 [[nodiscard]] NumberStyle getNumberStyle()
const override {
return NUMBER; }
69 Sound* sound =
static_cast<Sound*
>(modControllable);
70 return (sound->polyphonic == PolyphonyMode::POLY);
73 void getColumnLabel(
StringBuf& label)
override {
74 label.append(deluge::l10n::get(l10n::String::STRING_FOR_MAX_VOICES_SHORT));
82 using Selection::Selection;
83 void readCurrentValue()
override { this->setValue(soundEditor.currentSound->polyphonic); }
85 void writeCurrentValue()
override {
86 auto current_value = this->getValue<PolyphonyMode>();
89 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
91 Kit* kit = getCurrentKit();
93 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
94 if (thisDrum->type == DrumType::SOUND) {
95 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
96 soundDrum->polyphonic = current_value;
102 soundEditor.currentSound->polyphonic = current_value;
106 deluge::vector<std::string_view> getOptions(OptType optType)
override {
108 deluge::vector<std::string_view> options = {
109 l10n::getView(l10n::String::STRING_FOR_AUTO),
110 l10n::getView(l10n::String::STRING_FOR_POLYPHONIC),
111 l10n::getView(l10n::String::STRING_FOR_MONOPHONIC),
112 l10n::getView(l10n::String::STRING_FOR_LEGATO),
115 if (soundEditor.editingKit()) {
116 options.push_back(l10n::getView(l10n::String::STRING_FOR_CHOKE));
121 if (this->getValue<PolyphonyMode>() == PolyphonyMode::POLY) {
122 return &polyphonicVoiceCountMenu;
127 void getColumnLabel(
StringBuf& label)
override {
128 label.append(deluge::l10n::get(l10n::String::STRING_FOR_POLYPHONY_SHORT));