27 PulseWidth(l10n::String name, l10n::String title_format_str, int32_t newP, uint8_t source_id)
28 : PatchedParam(name, newP, source_id), FormattedTitle(title_format_str, source_id + 1) {}
30 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
32 int32_t getFinalValue()
override {
return computeFinalValueForHalfPrecisionMenuItem(this->getValue()); }
35 this->setValue(computeCurrentValueForHalfPrecisionMenuItem(
36 soundEditor.currentParamManager->getPatchedParamSet()->getValue(getP())));
40 const auto sound =
static_cast<Sound*
>(modControllable);
41 if (sound->getSynthMode() == SynthMode::FM) {
45 const OscType oscType = sound->sources[source_id_].oscType;
46 if (oscType == OscType::WAVETABLE) {
47 auto& source = sound->sources[source_id_];
48 return source.hasAtLeastOneAudioFileLoaded();
51 return oscType != OscType::SAMPLE && oscType != OscType::INPUT_L && oscType != OscType::INPUT_R
52 && oscType != OscType::INPUT_STEREO;
58 const float norm = getValue() / 50.0f;
60 constexpr int32_t x_padding = 4;
61 const uint8_t width = slot.width - x_padding * 2;
63 int32_t start_x = slot.start_x + x_padding;
64 int32_t end_x = start_x + width - 1;
65 int32_t start_y = slot.start_y + kHorizontalMenuSlotYOffset;
66 int32_t end_y = slot.start_y + slot.height - 5;
68 int32_t pw_min_x = start_x + 2;
69 int32_t pw_max_x = start_x + width / 2;
70 int32_t pw_width = pw_max_x - pw_min_x;
71 int32_t pw_x = pw_max_x - pw_width * norm;
73 image.drawVerticalLine(start_x, start_y, end_y);
74 image.drawHorizontalLine(start_y, start_x, pw_x);
75 image.drawVerticalLine(pw_x, start_y, end_y);
76 image.drawHorizontalLine(end_y, pw_x, end_x);