diff options
author | Antti S. Lankila <alankila@gmail.com> | 2010-08-11 03:16:54 +0300 |
---|---|---|
committer | Antti S. Lankila <alankila@gmail.com> | 2010-08-11 12:56:15 +0300 |
commit | da153363b790b8eec6b3bbfa95779b19c5149afa (patch) | |
tree | b091e0e32fbd11ca618b77f927f9caa2ee7145d0 | |
parent | 89e1cbe599e1b7aeea1454b38602e1de487f77e5 (diff) | |
download | frameworks_base-da153363b790b8eec6b3bbfa95779b19c5149afa.zip frameworks_base-da153363b790b8eec6b3bbfa95779b19c5149afa.tar.gz frameworks_base-da153363b790b8eec6b3bbfa95779b19c5149afa.tar.bz2 |
Take some ideas from bs2b.
Bs2b uses the low-pass filter to generate the delay as a byproduct
of its operation. The filter is generally set around 700 Hz where
it produces about 250 microseconds of delay. In addition to that,
the crossfeed is now mixed at -6 dB level. The reverb is unchanged,
although the new configuration gives it larger role in forming
an impression of a soundstage.
The design is still not complete, but good enough for a commit.
-rw-r--r-- | libs/audioflinger/AudioDSP.cpp | 35 | ||||
-rw-r--r-- | libs/audioflinger/AudioDSP.h | 2 |
2 files changed, 4 insertions, 33 deletions
diff --git a/libs/audioflinger/AudioDSP.cpp b/libs/audioflinger/AudioDSP.cpp index c56773b..114a7ff 100644 --- a/libs/audioflinger/AudioDSP.cpp +++ b/libs/audioflinger/AudioDSP.cpp @@ -33,7 +33,6 @@ static int16_t toFixedPoint(float x) return int16_t(x * (1 << fixedPointDecimals) + 0.5f); } - /*************************************************************************** * Delay * ***************************************************************************/ @@ -403,12 +402,6 @@ EffectHeadphone::~EffectHeadphone() { delete &mReverbDelayL; delete &mReverbDelayR; - delete &mDelayL; - delete &mDelayR; - for (int32_t i = 0; i < 3; i ++) { - delete &mAllpassL[i]; - delete &mAllpassR[i]; - } delete &mLowpassL; delete &mLowpassR; } @@ -418,16 +411,8 @@ void EffectHeadphone::configure(const float samplingFrequency) { mReverbDelayL.setParameters(mSamplingFrequency, 0.030f); mReverbDelayR.setParameters(mSamplingFrequency, 0.030f); - mDelayL.setParameters(mSamplingFrequency, 0.00045f); - mDelayR.setParameters(mSamplingFrequency, 0.00045f); - mAllpassL[0].setParameters(mSamplingFrequency, 0.4f, 0.00031f); - mAllpassR[0].setParameters(mSamplingFrequency, 0.4f, 0.00031f); - mAllpassL[1].setParameters(mSamplingFrequency, 0.4f, 0.00021f); - mAllpassR[1].setParameters(mSamplingFrequency, 0.4f, 0.00021f); - mAllpassL[2].setParameters(mSamplingFrequency, 0.4f, 0.00011f); - mAllpassR[2].setParameters(mSamplingFrequency, 0.4f, 0.00011f); - mLowpassL.setRC(4000.0f, mSamplingFrequency); - mLowpassR.setRC(4000.0f, mSamplingFrequency); + mLowpassL.setRC(700.0f, mSamplingFrequency); + mLowpassR.setRC(700.0f, mSamplingFrequency); } void EffectHeadphone::setDeep(bool deep) @@ -479,26 +464,14 @@ void EffectHeadphone::process(int32_t* inout, int32_t frames) dataL += dryL; dataR += dryR; - /* Add fixed ear-to-ear propagation delay of about 10 cm, based - * on the idea that ear-to-ear distance is 30 cm and the speakers - * are placed in front of the listener, which means that the actual - * time delay will be somewhat less than the maximum. */ - dataL = mDelayL.process(dataL); - dataR = mDelayR.process(dataR); - for (int32_t j = 0; j < 3; j ++) { - /* Confuse phase, simulating shoulder echoes and whatnot. */ - dataL = mAllpassL[j].process(dataL); - dataR = mAllpassR[j].process(dataR); - } - /* Lowpass filter to estimate head shadow. */ dataL = mLowpassL.process(dataL >> fixedPointDecimals); dataR = mLowpassR.process(dataR >> fixedPointDecimals); /* 28 bits */ /* Mix right-to-left and vice versa. */ - inout[0] += dataR; - inout[1] += dataL; + inout[0] += dataR >> 1; + inout[1] += dataL >> 1; inout += 2; } } diff --git a/libs/audioflinger/AudioDSP.h b/libs/audioflinger/AudioDSP.h index 99cc299..de213e3 100644 --- a/libs/audioflinger/AudioDSP.h +++ b/libs/audioflinger/AudioDSP.h @@ -119,8 +119,6 @@ class EffectHeadphone : public Effect { Delay mReverbDelayL, mReverbDelayR; int32_t mDelayDataL, mDelayDataR; - Delay mDelayL, mDelayR; - Allpass mAllpassL[3], mAllpassR[3]; Biquad mLowpassL, mLowpassR; public: |