mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 06:54:28 -04:00
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef JASCALC_H
|
|
#define JASCALC_H
|
|
|
|
#include <dolphin/types.h>
|
|
#include <limits>
|
|
|
|
/**
|
|
* @ingroup jsystem-jaudio
|
|
*
|
|
*/
|
|
struct JASCalc {
|
|
static void imixcopy(const s16*, const s16*, s16*, u32);
|
|
static void bcopyfast(const void* src, void* dest, u32 size);
|
|
static void bcopy(const void* src, void* dest, u32 size);
|
|
static void bzerofast(void* dest, u32 size);
|
|
static void bzero(void* dest, u32 size);
|
|
static f32 pow2(f32);
|
|
|
|
template <typename A, typename B>
|
|
static A clamp(B x);
|
|
|
|
static f32 clamp01(f32 i_value) {
|
|
if (i_value <= 0.0f) {
|
|
return 0.0f;
|
|
}
|
|
if (i_value >= 1.0f) {
|
|
return 1.0f;
|
|
}
|
|
return i_value;
|
|
}
|
|
|
|
f32 fake1();
|
|
f32 fake2(s32 x);
|
|
f32 fake3();
|
|
|
|
static const s16 CUTOFF_TO_IIR_TABLE[128][4];
|
|
};
|
|
|
|
template <typename A, typename B>
|
|
A JASCalc::clamp(B x) {
|
|
if (x <= std::numeric_limits<A>::min())
|
|
return std::numeric_limits<A>::min();
|
|
if (x >= std::numeric_limits<A>::max())
|
|
return std::numeric_limits<A>::max();
|
|
return x;
|
|
}
|
|
|
|
#endif /* JASCALC_H */
|