summaryrefslogtreecommitdiff
path: root/sms/filters.c
diff options
context:
space:
mode:
authorJohn Glover <john@john-glovers-macbook.local>2010-12-17 15:59:42 +0000
committerJohn Glover <john@john-glovers-macbook.local>2010-12-17 15:59:42 +0000
commita2704c86955830fda9ef4c8de9dca5ae95eb7f2a (patch)
treef849ea6610e2f349fe9179fd0ba966f34a196d82 /sms/filters.c
parent97292e56442aa9442ee8863ea320e6e54c1c6fbf (diff)
downloadsimpl-a2704c86955830fda9ef4c8de9dca5ae95eb7f2a.tar.gz
simpl-a2704c86955830fda9ef4c8de9dca5ae95eb7f2a.tar.bz2
simpl-a2704c86955830fda9ef4c8de9dca5ae95eb7f2a.zip
Added an option in SMS_AnalParams/SMS_SynthParams to enable/disable pre-emphasis (still enabled by default).
Diffstat (limited to 'sms/filters.c')
-rw-r--r--sms/filters.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sms/filters.c b/sms/filters.c
index 9c13ad5..7f31317 100644
--- a/sms/filters.c
+++ b/sms/filters.c
@@ -33,9 +33,13 @@
*/
sfloat sms_preEmphasis(sfloat fInput, SMS_AnalParams *pAnalParams)
{
- sfloat fOutput = fInput - SMS_EMPH_COEF * pAnalParams->preEmphasisLastValue;
- pAnalParams->preEmphasisLastValue = fOutput;
- return fOutput;
+ if(pAnalParams->preEmphasis)
+ {
+ sfloat fOutput = fInput - SMS_EMPH_COEF * pAnalParams->preEmphasisLastValue;
+ pAnalParams->preEmphasisLastValue = fOutput;
+ return fOutput;
+ }
+ return fInput;
}
/* de-emphasis filter function, it returns the filtered value
@@ -44,9 +48,13 @@ sfloat sms_preEmphasis(sfloat fInput, SMS_AnalParams *pAnalParams)
*/
sfloat sms_deEmphasis(sfloat fInput, SMS_SynthParams *pSynthParams)
{
- sfloat fOutput = fInput + SMS_EMPH_COEF * pSynthParams->deEmphasisLastValue;
- pSynthParams->deEmphasisLastValue = fInput;
- return fOutput;
+ if(pSynthParams->deEmphasis)
+ {
+ sfloat fOutput = fInput + SMS_EMPH_COEF * pSynthParams->deEmphasisLastValue;
+ pSynthParams->deEmphasisLastValue = fInput;
+ return fOutput;
+ }
+ return fInput;
}
/*! \brief function to implement a zero-pole filter