Androidbring your own audio equalizerMUSICFXAnalysis
for various reasons, I would like to briefly analyze a android built-in The audio equalizer musicfx com.android.musicfx Set the sound flow --  from app audioflinger ". Note: android system version is 4.2.2_r1
The end point from App to Audiofliger is in android_media_audioeffect.cpp ( Previous version is Audio_ Media_audioeffect.cpp) in the android_media_audioeffect_native_getparameter().
This invokes the getparameter () in AudioEffect.cpp .
Final entry into Audioflinger:
Mieffect->command (effect_cmd_get_param, sizeof (effect_param_t) + param->psize, PARAM, &psize, Param
Audioflinger How to deal with this command the Android audio system Audioflinger ( a ) and Android Source Code Analysis:audioeffect.
The former calls to the following:
status_t status = (*meffectinterface)->command (Meffectinterface,
Cmdcode,
Cmdsize,
Pcmddata,
Replysize,
Preplydata);
Where is this meffectinterface sacred?
There was a fault in the middle, searching directly for Effect_cmd_get_param.
1.EffectBundle
2.EFFECTDOWNMIX.C-Downmix_command
3.effectequalizer.cpp-Equalizer_command
You can see that the equalizer_getparameter is called, and the prototype for this function is:
This corresponds to the API in the application, and the gain for the band is getbandlevel:
Returned Pcontext->pbundlecontext->bandgaindb[band] *;
Let's see who's setting this value.
Open Login the source code, in the application to enable the equalizer will have output, but first pause.
1) by looking at the log with audioeffect as TAG , you can determine the parameters that are set after the gain parameter is obtained first.
2) category is Normal.
Finally found: frameworks/av/media/libeffects/lvm/wrapper/bundle/EffectBundle.h
The top is a reference, really until the effect is the following eqnb_5bandsoftprosets.
The 5 paragraphs are:50hz/230hz/910hz/4khz/14khz. The following is the 230Hz adjusted to -10 the experiment:
Summary: The study of this MUSICFX is based on the device on which the speaker is too high in some bands to cause a snap (I can't now use a professional language to describe this phenomenon), ready to test the use of software EQ To solve the problem. Now the EQ default value is found, but it is software implementation, using software implementation to solve the hardware problem I think it is very inappropriate, but I also take this opportunity to understand the entire process and the location of the default values.