32class Type final :
public Selection,
public FormattedTitle {
34 Type(l10n::String name, l10n::String title_format_str) :
Selection(name), FormattedTitle(title_format_str) {};
37 bool mayUseDx() {
return !soundEditor.editingKit() && soundEditor.currentSourceIndex == 0; }
40 int32_t rawVal = (int32_t)soundEditor.currentSource->oscType;
41 if (!mayUseDx() && rawVal > (int32_t)OscType::DX7) {
44 this->setValue(rawVal);
46 void writeCurrentValue()
override {
48 OscType oldValue = soundEditor.currentSource->oscType;
49 auto newValue = this->getValue<OscType>();
50 if (!mayUseDx() && (int32_t)newValue >= (int32_t)OscType::DX7) {
51 newValue = (OscType)((int32_t)newValue + 1);
54 auto needs_unassignment = {
57 OscType::INPUT_STEREO,
65 if (util::one_of(oldValue, needs_unassignment) || util::one_of(newValue, needs_unassignment)) {
66 soundEditor.currentSound->killAllVoices();
69 soundEditor.currentSource->setOscType(newValue);
71 if (oldValue == OscType::SQUARE || newValue == OscType::SQUARE) {
72 soundEditor.currentSound->setupPatchingForAllParamManagers(currentSong);
76 [[nodiscard]] std::string_view
getTitle()
const override {
return FormattedTitle::title(); }
78 deluge::vector<std::string_view> getOptions(OptType optType)
override {
80 using enum l10n::String;
81 deluge::vector<std::string_view> options = {
82 l10n::getView(STRING_FOR_SINE),
83 l10n::getView(STRING_FOR_TRIANGLE),
84 l10n::getView(STRING_FOR_SQUARE),
85 l10n::getView(STRING_FOR_ANALOG_SQUARE),
86 l10n::getView(STRING_FOR_SAW),
87 l10n::getView(STRING_FOR_ANALOG_SAW),
88 l10n::getView(STRING_FOR_WAVETABLE),
91 if (soundEditor.currentSound->getSynthMode() == SynthMode::RINGMOD) {
95 options.emplace_back(l10n::getView(STRING_FOR_SAMPLE));
98 options.emplace_back(l10n::getView(STRING_FOR_DX7));
101 if (AudioEngine::micPluggedIn || AudioEngine::lineInPluggedIn) {
102 options.emplace_back(l10n::getView(STRING_FOR_INPUT_LEFT));
103 options.emplace_back(l10n::getView(STRING_FOR_INPUT_RIGHT));
104 options.emplace_back(l10n::getView(STRING_FOR_INPUT_STEREO));
107 options.emplace_back(l10n::getView(STRING_FOR_INPUT));
114 Sound* sound =
static_cast<Sound*
>(modControllable);
115 return (sound->getSynthMode() != SynthMode::FM);
119 if (soundEditor.currentSource->oscType != OscType::DX7) {
122 return (MenuItem*)&dxMenu;