Implement Z2AudioCS (#3103)

This commit is contained in:
Max Roncace
2026-02-20 05:53:27 -05:00
committed by GitHub
parent 0558bde1e6
commit 803bc041c7
42 changed files with 1728 additions and 137 deletions
+12 -9
View File
@@ -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 */