Lines Matching refs:pContext
90 void LE_reset(LoudnessEnhancerContext *pContext) in LE_reset() argument
92 ALOGV(" > LE_reset(%p)", pContext); in LE_reset()
94 if (pContext->mCompressor != NULL) { in LE_reset()
95 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification in LE_reset()
96 ALOGV("LE_reset(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp); in LE_reset()
97 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate); in LE_reset()
99 ALOGE("LE_reset(%p): null compressors, can't apply target gain", pContext); in LE_reset()
117 int LE_setConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig) in LE_setConfig() argument
119 ALOGV("LE_setConfig(%p)", pContext); in LE_setConfig()
129 pContext->mConfig = *pConfig; in LE_setConfig()
131 LE_reset(pContext); in LE_setConfig()
151 void LE_getConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig) in LE_getConfig() argument
153 *pConfig = pContext->mConfig; in LE_getConfig()
169 int LE_init(LoudnessEnhancerContext *pContext) in LE_init() argument
171 ALOGV("LE_init(%p)", pContext); in LE_init()
173 pContext->mConfig.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; in LE_init()
174 pContext->mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; in LE_init()
175 pContext->mConfig.inputCfg.format = kProcessFormat; in LE_init()
176 pContext->mConfig.inputCfg.samplingRate = 44100; in LE_init()
177 pContext->mConfig.inputCfg.bufferProvider.getBuffer = NULL; in LE_init()
178 pContext->mConfig.inputCfg.bufferProvider.releaseBuffer = NULL; in LE_init()
179 pContext->mConfig.inputCfg.bufferProvider.cookie = NULL; in LE_init()
180 pContext->mConfig.inputCfg.mask = EFFECT_CONFIG_ALL; in LE_init()
181 pContext->mConfig.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE; in LE_init()
182 pContext->mConfig.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; in LE_init()
183 pContext->mConfig.outputCfg.format = kProcessFormat; in LE_init()
184 pContext->mConfig.outputCfg.samplingRate = 44100; in LE_init()
185 pContext->mConfig.outputCfg.bufferProvider.getBuffer = NULL; in LE_init()
186 pContext->mConfig.outputCfg.bufferProvider.releaseBuffer = NULL; in LE_init()
187 pContext->mConfig.outputCfg.bufferProvider.cookie = NULL; in LE_init()
188 pContext->mConfig.outputCfg.mask = EFFECT_CONFIG_ALL; in LE_init()
190 pContext->mTargetGainmB = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB; in LE_init()
191 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification in LE_init()
192 ALOGV("LE_init(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp); in LE_init()
194 if (pContext->mCompressor == NULL) { in LE_init()
195 pContext->mCompressor = new le_fx::AdaptiveDynamicRangeCompression(); in LE_init()
196 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate); in LE_init()
199 LE_setConfig(pContext, &pContext->mConfig); in LE_init()
223 LoudnessEnhancerContext *pContext = new LoudnessEnhancerContext; in LELib_Create() local
225 pContext->mItfe = &gLEInterface; in LELib_Create()
226 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED; in LELib_Create()
228 pContext->mCompressor = NULL; in LELib_Create()
229 ret = LE_init(pContext); in LELib_Create()
232 delete pContext; in LELib_Create()
236 *pHandle = (effect_handle_t)pContext; in LELib_Create()
238 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED; in LELib_Create()
240 ALOGV(" LELib_Create context is %p", pContext); in LELib_Create()
247 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)handle; in LELib_Release() local
250 if (pContext == NULL) { in LELib_Release()
253 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED; in LELib_Release()
254 if (pContext->mCompressor != NULL) { in LELib_Release()
255 delete pContext->mCompressor; in LELib_Release()
256 pContext->mCompressor = NULL; in LELib_Release()
258 delete pContext; in LELib_Release()
285 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self; in LE_process() local
287 if (pContext == NULL) { in LE_process()
303 const float inputAmp = pow(10, pContext->mTargetGainmB/2000.0f) * scale; in LE_process()
305 float inputAmp = pow(10, pContext->mTargetGainmB/2000.0f); in LE_process()
313 pContext->mCompressor->Compress(&leftSample, &rightSample); in LE_process()
319 pContext->mCompressor->Compress(&leftSample, &rightSample); in LE_process()
327 if (pContext->mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { in LE_process()
335 if (pContext->mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { in LE_process()
344 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) { in LE_process()
353 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self; in LE_command() local
355 if (pContext == NULL || pContext->mState == LOUDNESS_ENHANCER_STATE_UNINITIALIZED) { in LE_command()
365 *(int *) pReplyData = LE_init(pContext); in LE_command()
372 *(int *) pReplyData = LE_setConfig(pContext, in LE_command()
380 LE_getConfig(pContext, (effect_config_t *)pReplyData); in LE_command()
383 LE_reset(pContext); in LE_command()
389 if (pContext->mState != LOUDNESS_ENHANCER_STATE_INITIALIZED) { in LE_command()
392 pContext->mState = LOUDNESS_ENHANCER_STATE_ACTIVE; in LE_command()
400 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) { in LE_command()
403 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED; in LE_command()
424 ALOGV("get target gain(mB) = %d", pContext->mTargetGainmB); in LE_command()
425 *((int32_t *)p->data + 1) = pContext->mTargetGainmB; in LE_command()
447 pContext->mTargetGainmB = *((int32_t *)p->data + 1); in LE_command()
448 ALOGV("set target gain(mB) = %d", pContext->mTargetGainmB); in LE_command()
449 LE_reset(pContext); // apply parameter update in LE_command()
472 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *) self; in LE_getDescriptor() local
474 if (pContext == NULL || pDescriptor == NULL) { in LE_getDescriptor()