Guitarix
gx_faust_support.h
Go to the documentation of this file.
1#include <cmath>
2#include <algorithm>
3#include "gx_resampler.h"
4
5using std::signbit;
6
7#define max(x, y) (((x) > (y)) ? (x) : (y))
8#define min(x, y) (((x) < (y)) ? (x) : (y))
9
10template <int N> inline float faustpower(float x) {return powf(x, N);}
11template <int N> inline double faustpower(double x) {return pow(x, N);}
12template <int N> inline int faustpower(int x) {return faustpower<N/2>(x) * faustpower<N-N/2>(x);}
13template <> inline int faustpower<0>(int x) {return 1;}
14template <> inline int faustpower<1>(int x) {return x;}
15
16
17template<class T> inline T mydsp_faustpower2_f(T x) {return (x * x);}
18template<class T> inline T mydsp_faustpower3_f(T x) {return ((x * x) * x);}
19template<class T> inline T mydsp_faustpower4_f(T x) {return (((x * x) * x) * x);}
20template<class T> inline T mydsp_faustpower5_f(T x) {return ((((x * x) * x) * x) * x);}
21template<class T> inline T mydsp_faustpower6_f(T x) {return (((((x * x) * x) * x) * x) * x);}
22
23#define FAUSTFLOAT float
24#ifndef N_
25#define N_(String) (String)
26#endif
27#ifndef NC_
28#define NC_(Context, String) (String)
29#endif
30
31#define always_inline inline __attribute__((__always_inline__))
int faustpower< 1 >(int x)
T mydsp_faustpower2_f(T x)
T mydsp_faustpower3_f(T x)
T mydsp_faustpower4_f(T x)
int faustpower< 0 >(int x)
T mydsp_faustpower6_f(T x)
T mydsp_faustpower5_f(T x)
float faustpower(float x)