summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-31 11:34:49 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-01-31 11:34:49 +0000
commitc4991c3549f4076e69eb6fecb2e277c0853c47d4 (patch)
treecf37ef7e1555c2a883b37aa78ee60c5146c63b6b /libaf
parent2ce3fb07a3b682d4d7b62b038bedcb9e65eb1924 (diff)
downloadmpv-c4991c3549f4076e69eb6fecb2e277c0853c47d4.tar.bz2
mpv-c4991c3549f4076e69eb6fecb2e277c0853c47d4.tar.xz
af_softclip
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14622 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af_tools.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libaf/af_tools.c b/libaf/af_tools.c
index 11eea2b49e..bd36a243f8 100644
--- a/libaf/af_tools.c
+++ b/libaf/af_tools.c
@@ -78,3 +78,15 @@ inline int af_test_output(struct af_instance_s* af, af_data_t* out)
}
return AF_OK;
}
+
+/* Soft clipping, the sound of a dream, thanks to Jon Wattes
+ post to Musicdsp.org */
+inline float af_softclip(float a)
+{
+ if (a >= M_PI/2)
+ return 1.0;
+ else if (a <= -M_PI/2)
+ return -1.0;
+ else
+ return sin(a);
+}