Home | History | Annotate | Download | only in loudness

Lines Matching defs:pContext

66 void LE_reset(LoudnessEnhancerContext *pContext)
68 ALOGV(" > LE_reset(%p)", pContext);
70 if (pContext->mCompressor != NULL) {
71 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification
72 ALOGV("LE_reset(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp);
73 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate);
75 ALOGE("LE_reset(%p): null compressors, can't apply target gain", pContext);
92 // pContext: effect engine context
100 int LE_setConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig)
102 ALOGV("LE_setConfig(%p)", pContext);
112 pContext->mConfig = *pConfig;
114 LE_reset(pContext);
126 // pContext: effect engine context
134 void LE_getConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig)
136 *pConfig = pContext->mConfig;
146 // pContext: effect engine context
152 int LE_init(LoudnessEnhancerContext *pContext)
154 ALOGV("LE_init(%p)", pContext);
156 pContext->mConfig.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
157 pContext->mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
158 pContext->mConfig.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
159 pContext->mConfig.inputCfg.samplingRate = 44100;
160 pContext->mConfig.inputCfg.bufferProvider.getBuffer = NULL;
161 pContext->mConfig.inputCfg.bufferProvider.releaseBuffer = NULL;
162 pContext->mConfig.inputCfg.bufferProvider.cookie = NULL;
163 pContext->mConfig.inputCfg.mask = EFFECT_CONFIG_ALL;
164 pContext->mConfig.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
165 pContext->mConfig.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
166 pContext->mConfig.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
167 pContext->mConfig.outputCfg.samplingRate = 44100;
168 pContext->mConfig.outputCfg.bufferProvider.getBuffer = NULL;
169 pContext->mConfig.outputCfg.bufferProvider.releaseBuffer = NULL;
170 pContext->mConfig.outputCfg.bufferProvider.cookie = NULL;
171 pContext->mConfig.outputCfg.mask = EFFECT_CONFIG_ALL;
173 pContext->mTargetGainmB = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB;
174 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification
175 ALOGV("LE_init(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp);
177 if (pContext->mCompressor == NULL) {
178 pContext->mCompressor = new le_fx::AdaptiveDynamicRangeCompression();
179 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate);
182 LE_setConfig(pContext, &pContext->mConfig);
207 LoudnessEnhancerContext *pContext = new LoudnessEnhancerContext;
209 pContext->mItfe = &gLEInterface;
210 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;
212 pContext->mCompressor = NULL;
213 ret = LE_init(pContext);
216 delete pContext;
220 *pHandle = (effect_handle_t)pContext;
222 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;
224 ALOGV(" LELib_Create context is %p", pContext);
231 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)handle;
234 if (pContext == NULL) {
237 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;
238 if (pContext->mCompressor != NULL) {
239 delete pContext->mCompressor;
240 pContext->mCompressor = NULL;
242 delete pContext;
269 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self;
271 if (pContext == NULL) {
284 float inputAmp = pow(10, pContext->mTargetGainmB/2000.0f);
290 pContext->mCompressor->Compress(&leftSample, &rightSample);
296 if (pContext->mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
304 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) {
313 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self;
316 if (pContext == NULL || pContext->mState == LOUDNESS_ENHANCER_STATE_UNINITIALIZED) {
326 *(int *) pReplyData = LE_init(pContext);
333 *(int *) pReplyData = LE_setConfig(pContext,
341 LE_getConfig(pContext, (effect_config_t *)pReplyData);
344 LE_reset(pContext);
350 if (pContext->mState != LOUDNESS_ENHANCER_STATE_INITIALIZED) {
353 pContext->mState = LOUDNESS_ENHANCER_STATE_ACTIVE;
361 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) {
364 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;
385 ALOGV("get target gain(mB) = %d", pContext->mTargetGainmB);
386 *((int32_t *)p->data + 1) = pContext->mTargetGainmB;
408 pContext->mTargetGainmB = *((int32_t *)p->data + 1);
409 ALOGV("set target gain(mB) = %d", pContext->mTargetGainmB);
410 LE_reset(pContext); // apply parameter update
433 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *) self;
435 if (pContext == NULL || pDescriptor == NULL) {