mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-09 07:02:26 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -25,84 +25,83 @@
|
|||
#include <cstdint>
|
||||
|
||||
class volume_t {
|
||||
public:
|
||||
constexpr volume_t operator-() const {
|
||||
return { -cb };
|
||||
}
|
||||
public:
|
||||
constexpr volume_t operator-() const {
|
||||
return {-cb};
|
||||
}
|
||||
|
||||
constexpr volume_t operator+(const volume_t& other) const {
|
||||
return { cb + other.cb };
|
||||
}
|
||||
constexpr volume_t operator+(const volume_t& other) const {
|
||||
return {cb + other.cb};
|
||||
}
|
||||
|
||||
constexpr volume_t operator-(const volume_t& other) const {
|
||||
return { cb - other.cb };
|
||||
}
|
||||
constexpr volume_t operator-(const volume_t& other) const {
|
||||
return {cb - other.cb};
|
||||
}
|
||||
|
||||
volume_t& operator+=(const volume_t& other) {
|
||||
cb += other.cb;
|
||||
return *this;
|
||||
}
|
||||
volume_t& operator+=(const volume_t& other) {
|
||||
cb += other.cb;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr bool operator<(const volume_t& other) const {
|
||||
return cb < other.cb;
|
||||
}
|
||||
constexpr bool operator<(const volume_t& other) const {
|
||||
return cb < other.cb;
|
||||
}
|
||||
|
||||
constexpr bool operator>(const volume_t& other) const {
|
||||
return cb > other.cb;
|
||||
}
|
||||
constexpr bool operator>(const volume_t& other) const {
|
||||
return cb > other.cb;
|
||||
}
|
||||
|
||||
static constexpr volume_t centibel(const int cb) {
|
||||
return { cb };
|
||||
}
|
||||
static constexpr volume_t centibel(const int cb) {
|
||||
return {cb};
|
||||
}
|
||||
|
||||
static constexpr volume_t decibel(const int db) {
|
||||
return { db * 10 };
|
||||
}
|
||||
static constexpr volume_t decibel(const int db) {
|
||||
return {db * 10};
|
||||
}
|
||||
|
||||
int32_t centibel() const {
|
||||
return cb;
|
||||
}
|
||||
int32_t centibel() const {
|
||||
return cb;
|
||||
}
|
||||
|
||||
int32_t decibel() const {
|
||||
return cb / 10;
|
||||
}
|
||||
int32_t decibel() const {
|
||||
return cb / 10;
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t cb;
|
||||
private:
|
||||
int32_t cb;
|
||||
|
||||
constexpr volume_t(
|
||||
const int cb
|
||||
) : cb(cb)
|
||||
{
|
||||
}
|
||||
constexpr volume_t(
|
||||
const int cb)
|
||||
: cb(cb) {
|
||||
}
|
||||
};
|
||||
|
||||
constexpr volume_t operator"" _cB(long double v) {
|
||||
return volume_t::centibel(v);
|
||||
return volume_t::centibel(v);
|
||||
}
|
||||
|
||||
constexpr volume_t operator"" _dB(long double v) {
|
||||
return volume_t::centibel(v * 10);
|
||||
return volume_t::centibel(v * 10);
|
||||
}
|
||||
|
||||
struct volume_range_t {
|
||||
volume_t min;
|
||||
volume_t max;
|
||||
volume_t min;
|
||||
volume_t max;
|
||||
|
||||
volume_t limit(const volume_t value) const {
|
||||
if( value < min ) {
|
||||
return min;
|
||||
}
|
||||
if( value > max ) {
|
||||
return max;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
volume_t limit(const volume_t value) const {
|
||||
if (value < min) {
|
||||
return min;
|
||||
}
|
||||
if (value > max) {
|
||||
return max;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
volume_t normalize(const volume_t value) const {
|
||||
/* Limit volume to specified range, and adjust minimum value to 0. */
|
||||
return limit(value) - min;
|
||||
}
|
||||
volume_t normalize(const volume_t value) const {
|
||||
/* Limit volume to specified range, and adjust minimum value to 0. */
|
||||
return limit(value) - min;
|
||||
}
|
||||
};
|
||||
|
||||
#endif/*__VOLUME_H__*/
|
||||
#endif /*__VOLUME_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue