mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-25 07:10:43 -04:00
Add AudioVolumeField -- cleanup (#1107)
* WIP Adding AudioVolumeField * Fix build break * Add Bernd to about --------- Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
parent
7e8a139732
commit
28319652c1
22 changed files with 91 additions and 186 deletions
|
@ -94,13 +94,22 @@ int fast_int_magnitude(int y, int x);
|
|||
int int_atan2(int y, int x);
|
||||
int32_t int16_sin_s4(int32_t x);
|
||||
|
||||
/* Returns value constrained to min and max. */
|
||||
template <class T>
|
||||
constexpr const T& clip(const T& value, const T& minimum, const T& maximum) {
|
||||
return std::max(std::min(value, maximum), minimum);
|
||||
}
|
||||
|
||||
// TODO: need to decide if this is inclusive or exclusive.
|
||||
// The implementations are different and cause the subtle
|
||||
// bugs mentioned below.
|
||||
template <class T>
|
||||
struct range_t {
|
||||
const T minimum;
|
||||
const T maximum;
|
||||
|
||||
constexpr const T& clip(const T& value) const {
|
||||
return std::max(std::min(value, maximum), minimum);
|
||||
return ::clip(value, minimum, maximum);
|
||||
}
|
||||
|
||||
constexpr void reset_if_outside(T& value, const T& reset_value) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue