diff options
Diffstat (limited to 'chugins/SoftClipper.cpp')
-rw-r--r-- | chugins/SoftClipper.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/chugins/SoftClipper.cpp b/chugins/SoftClipper.cpp new file mode 100644 index 0000000..d702576 --- /dev/null +++ b/chugins/SoftClipper.cpp @@ -0,0 +1,28 @@ +#include <math.h> + +#include <chuck_dl.h> +#include <chuck_def.h> + +CK_DLL_TICK(clipper_tick); + +CK_DLL_QUERY(SoftClipper) +{ + QUERY->setname(QUERY, "SoftClipper"); + + QUERY->begin_class(QUERY, "SoftClipper", "UGen"); + QUERY->add_ugen_func(QUERY, clipper_tick, NULL, 1, 1); + QUERY->end_class(QUERY); + + return TRUE; +} + +CK_DLL_TICK(clipper_tick) +{ +#ifdef __CHUCK_USE_64_BIT_SAMPLE__ + *out = atan(in * 2.)/M_PI_2; +#else + *out = atanf(in * 2.)/M_PI_2; +#endif + + return TRUE; +} |