26class RetriggerPhase final :
public Decimal,
public FormattedTitle {
28 RetriggerPhase(l10n::String newName, l10n::String title_format_str,
bool newForModulator =
false)
29 :
Decimal(newName), FormattedTitle(title_format_str), forModulator(newForModulator) {}
31 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
33 [[nodiscard]] int32_t getMinValue()
const override {
return -soundEditor.numberEditSize; }
34 [[nodiscard]] int32_t getMaxValue()
const override {
return 360; }
35 [[nodiscard]] int32_t getNumDecimalPlaces()
const override {
return 0; }
36 [[nodiscard]] int32_t getDefaultEditPos()
const override {
return 1; }
39 uint32_t value = *getValueAddress();
40 if (value == 0xFFFFFFFF) {
41 this->setValue(-soundEditor.numberEditSize);
44 this->setValue(value / 11930464);
48 void writeCurrentValue()
override {
50 if (this->getValue() < 0) {
54 value = this->getValue() * 11930464;
56 *getValueAddress() = value;
59 void drawValue()
override {
60 if (this->getValue() < 0) {
61 display->setText(l10n::get(l10n::String::STRING_FOR_DISABLED),
false, 255,
true);
70 if (this->getValue() < 0) {
71 canvas.
drawStringCentred(l10n::get(l10n::String::STRING_FOR_OFF), 20, kTextHugeSpacingX, kTextHugeSizeY);
79 if (this->getValue() >= 0) {
85 Sound* sound =
static_cast<Sound*
>(modControllable);
86 Source* source = &sound->sources[whichThing];
87 if (forModulator && sound->getSynthMode() != SynthMode::FM) {
90 return (source->oscType != OscType::SAMPLE || sound->getSynthMode() == SynthMode::FM);
95 [[nodiscard]] uint32_t* getValueAddress()
const {
97 return &soundEditor.currentSound->modulatorRetriggerPhase[soundEditor.currentSourceIndex];
99 return &soundEditor.currentSound->oscRetriggerPhase[soundEditor.currentSourceIndex];
void drawStringCentred(char const *string, int32_t pixelY, int32_t textWidth, int32_t textHeight, int32_t centrePos=OLED_MAIN_WIDTH_PIXELS/2)
Definition canvas.cpp:189