-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
horizontal menus for LPF and HPF (#3147)
- Add support for displaying Selection-instances in horizontal menus, in order to display current filter mode. This uses regular font size to fit in 4 character names. - Move renderInHorizontalMenu() from patched_param::Integer to Number, where it works for both patched and unpatched parameters. - Refactor the colummn label code to MenuItem::renderColumnLabel(), fixing a bug in the chop-to-width logic while at it. - Refactor classes used for filter params to be more generic, so we don't need so many of them. - Fix a bug in horizontal menu rendering when there's only one relevant item, which isn't the first item. - Filter modes get short names (12DB, 24DB, DRV, BP, NTCH) to fit into a mode-column. - Remove the special casing for filter freq display on 7-seg: it no longer display as OFF when fully open without modulation. - Re-order the filter menu so mode is last, which works better in the horizontal menu -- and arguably in the vertical as well, even if there's now a slight ordering mismatch betweeh shortcuts and the menu. - Morph column is titled by the morph name for the filter family. - Rename the NONE filter mode to OFF, which seems clearer in the menu. - Turning filter mode to oFF makes all other filter menu items non-relevant.
- Loading branch information
Showing
29 changed files
with
486 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Synthstrom Audible Limited | ||
* | ||
* This file is part of The Synthstrom Audible Deluge Firmware. | ||
* | ||
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License as published by the Free Software Foundation, | ||
* either version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
|
||
#include "gui/ui/sound_editor.h" | ||
#include "model/mod_controllable/filters/filter_config.h" | ||
#include "modulation/patch/patch_cable_set.h" | ||
|
||
namespace deluge::gui::menu_item::filter { | ||
|
||
enum class FilterSlot : uint8_t { | ||
LPF, | ||
HPF, | ||
}; | ||
|
||
enum class FilterParamType : uint8_t { | ||
FREQUENCY, | ||
RESONANCE, | ||
MORPH, | ||
MODE, | ||
}; | ||
|
||
class FilterInfo { | ||
public: | ||
FilterInfo(FilterSlot slot_, FilterParamType type_) : slot{slot_}, type{type_} {} | ||
::FilterMode getMode() const { | ||
if (slot == FilterSlot::LPF) { | ||
return soundEditor.currentModControllable->lpfMode; | ||
} | ||
else { | ||
return soundEditor.currentModControllable->hpfMode; | ||
} | ||
} | ||
int32_t getModeValue() const { | ||
if (slot == FilterSlot::HPF) { | ||
return util::to_underlying(soundEditor.currentModControllable->hpfMode) - kFirstHPFMode; | ||
} | ||
else { | ||
// Off is located past the HPFLadder, which isn't an option for the low pass filter (should it be?) | ||
int32_t selection = util::to_underlying(soundEditor.currentModControllable->lpfMode); | ||
return std::min(selection, kNumLPFModes); | ||
} | ||
} | ||
void setMode(int32_t value) const { | ||
if (slot == FilterSlot::HPF) { | ||
soundEditor.currentModControllable->hpfMode = static_cast<FilterMode>(value + kFirstHPFMode); | ||
} | ||
else { | ||
// num lpf modes counts off but there's HPF modes in the middle | ||
if (value >= kNumLPFModes) { | ||
soundEditor.currentModControllable->lpfMode = FilterMode::OFF; | ||
} | ||
else { | ||
soundEditor.currentModControllable->lpfMode = static_cast<FilterMode>(value); | ||
} | ||
} | ||
} | ||
FilterParamType getFilterParamType() const { return type; } | ||
FilterSlot getSlot() const { return slot; } | ||
/// Returns morphname for morph parameters, and the alt argument for others. | ||
[[nodiscard]] std::string_view getMorphNameOr(std::string_view alt) const { | ||
if (type == FilterParamType::MORPH) { | ||
using enum l10n::String; | ||
auto filt = deluge::dsp::filter::SpecificFilter(getMode()); | ||
return l10n::getView(filt.getMorphName()); | ||
} | ||
else { | ||
return alt; | ||
} | ||
} | ||
bool isOn() const { return getMode() != ::FilterMode::OFF; } | ||
|
||
private: | ||
FilterSlot slot; | ||
FilterParamType type; | ||
}; | ||
|
||
static_assert(sizeof(FilterInfo) <= 4); | ||
|
||
} // namespace deluge::gui::menu_item::filter |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.