26class AudioRecorder final :
public MenuItem, FormattedTitle {
28 AudioRecorder(l10n::String newName, uint8_t sourceId)
29 : MenuItem(newName), FormattedTitle(newName, sourceId + 1), source_id_{sourceId} {}
31 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
32 [[nodiscard]] std::string_view
getName()
const override {
return FormattedTitle::title(); }
35 soundEditor.shouldGoUpOneLevelOnBegin =
true;
36 soundEditor.setCurrentSource(source_id_);
38 if (
bool success = openUI(&audioRecorder); !success) {
39 if (getCurrentUI() == &soundEditor) {
40 soundEditor.goUpOneLevel();
42 return uiTimerManager.unsetTimer(TimerName::SHORTCUT_BLINK);
45 audioRecorder.process();
49 const auto sound =
static_cast<Sound*
>(modControllable);
50 return sound->getSynthMode() == SynthMode::SUBTRACTIVE;
55 if (!
isRelevant(modControllable, source_id_)) {
56 display->displayPopup(l10n::get(l10n::String::STRING_FOR_CANT_RECORD_AUDIO_FM_MODE));
57 return MenuPermission::NO;
60 Sound* sound =
static_cast<Sound*
>(modControllable);
61 return soundEditor.checkPermissionToBeginSessionForRangeSpecificParam(sound, source_id_, currentRange);
69 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
70 using namespace hid::display;
74 int32_t x = startX + 5;
75 int32_t y = startY + 5;
76 const Icon& recIcon = OLED::recordIcon;
77 image.drawIcon(recIcon, x, y);
80 x += recIcon.width + 3;
82 image.drawString(
"rec", x, y, kTextSpacingX, kTextSpacingY);
85 x += kTextSpacingX * 3 + 3;
86 image.drawGraphicMultiLine(OLED::submenuArrowIconBold, x, y, 7);
89 x = startX + width - kTextBigSpacingX - 3;
91 DEF_STACK_STRING_BUF(sourceNumberBuf, kShortStringBufferSize);
92 sourceNumberBuf.appendInt(source_id_ + 1);
93 image.drawString(sourceNumberBuf.data(), x, y, kTextBigSpacingX, kTextBigSizeY);