mirror of
https://github.com/zeldaret/tp
synced 2026-08-04 01:03:47 -04:00
Implement Z2AudioCS (#3103)
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
#define JASCALC_H
|
||||
|
||||
#include <dolphin/types.h>
|
||||
#include <limits>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct JASCalc {
|
||||
static void imixcopy(const s16*, const s16*, s16*, u32);
|
||||
@@ -15,15 +16,8 @@ struct JASCalc {
|
||||
static void bzero(void* dest, u32 size);
|
||||
static f32 pow2(f32);
|
||||
|
||||
// Could not make it work as inline - specialization is in JASCalc.cpp
|
||||
template <typename A, typename B>
|
||||
static A clamp(B x); /* {
|
||||
if (std::numeric_limits<A>::min() >= x)
|
||||
return std::numeric_limits<A>::min();
|
||||
if (x >= std::numeric_limits<A>::max())
|
||||
return std::numeric_limits<A>::max();
|
||||
return x;
|
||||
} */
|
||||
static A clamp(B x);
|
||||
|
||||
static f32 clamp01(f32 i_value) {
|
||||
if (i_value <= 0.0f) {
|
||||
@@ -42,4 +36,13 @@ struct JASCalc {
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user