Home | History | Annotate | Download | only in loudness

Lines Matching defs:pContext

70 void LE_reset(LoudnessEnhancerContext *pContext)
72 ALOGV(" > LE_reset(%p)", pContext);
74 if (pContext->mCompressor != NULL) {
75 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification
76 ALOGV("LE_reset(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp);
77 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate);
79 ALOGE("LE_reset(%p): null compressors, can't apply target gain", pContext);
96 // pContext: effect engine context
104 int LE_setConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig)
106 ALOGV("LE_setConfig(%p)", pContext);
116 pContext->mConfig = *pConfig;
118 LE_reset(pContext);
130 // pContext: effect engine context
138 void LE_getConfig(LoudnessEnhancerContext *pContext, effect_config_t *pConfig)
140 *pConfig = pContext->mConfig;
150 // pContext: effect engine context
156 int LE_init(LoudnessEnhancerContext *pContext)
158 ALOGV("LE_init(%p)", pContext);
160 pContext->mConfig.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
161 pContext->mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
162 pContext->mConfig.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
163 pContext->mConfig.inputCfg.samplingRate = 44100;
164 pContext->mConfig.inputCfg.bufferProvider.getBuffer = NULL;
165 pContext->mConfig.inputCfg.bufferProvider.releaseBuffer = NULL;
166 pContext->mConfig.inputCfg.bufferProvider.cookie = NULL;
167 pContext->mConfig.inputCfg.mask = EFFECT_CONFIG_ALL;
168 pContext->mConfig.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
169 pContext->mConfig.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
170 pContext->mConfig.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
171 pContext->mConfig.outputCfg.samplingRate = 44100;
172 pContext->mConfig.outputCfg.bufferProvider.getBuffer = NULL;
173 pContext->mConfig.outputCfg.bufferProvider.releaseBuffer = NULL;
174 pContext->mConfig.outputCfg.bufferProvider.cookie = NULL;
175 pContext->mConfig.outputCfg.mask = EFFECT_CONFIG_ALL;
177 pContext->mTargetGainmB = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB;
178 float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification
179 ALOGV("LE_init(): Target gain=%dmB <=> factor=%.2fX", pContext->mTargetGainmB, targetAmp);
181 if (pContext->mCompressor == NULL) {
182 pContext->mCompressor = new le_fx::AdaptiveDynamicRangeCompression();
183 pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate);
186 LE_setConfig(pContext, &pContext->mConfig);
210 LoudnessEnhancerContext *pContext = new LoudnessEnhancerContext;
212 pContext->mItfe = &gLEInterface;
213 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;
215 pContext->mCompressor = NULL;
216 ret = LE_init(pContext);
219 delete pContext;
223 *pHandle = (effect_handle_t)pContext;
225 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;
227 ALOGV(" LELib_Create context is %p", pContext);
234 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)handle;
237 if (pContext == NULL) {
240 pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;
241 if (pContext->mCompressor != NULL) {
242 delete pContext->mCompressor;
243 pContext->mCompressor = NULL;
245 delete pContext;
272 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self;
274 if (pContext == NULL) {
287 float inputAmp = pow(10, pContext->mTargetGainmB/2000.0f);
293 pContext->mCompressor->Compress(&leftSample, &rightSample);
299 if (pContext->mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
307 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) {
316 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *)self;
318 if (pContext == NULL || pContext->mState == LOUDNESS_ENHANCER_STATE_UNINITIALIZED) {
328 *(int *) pReplyData = LE_init(pContext);
335 *(int *) pReplyData = LE_setConfig(pContext,
343 LE_getConfig(pContext, (effect_config_t *)pReplyData);
346 LE_reset(pContext);
352 if (pContext->mState != LOUDNESS_ENHANCER_STATE_INITIALIZED) {
355 pContext->mState = LOUDNESS_ENHANCER_STATE_ACTIVE;
363 if (pContext->mState != LOUDNESS_ENHANCER_STATE_ACTIVE) {
366 pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;
387 ALOGV("get target gain(mB) = %d", pContext->mTargetGainmB);
388 *((int32_t *)p->data + 1) = pContext->mTargetGainmB;
410 pContext->mTargetGainmB = *((int32_t *)p->data + 1);
411 ALOGV("set target gain(mB) = %d", pContext->mTargetGainmB);
412 LE_reset(pContext); // apply parameter update
435 LoudnessEnhancerContext * pContext = (LoudnessEnhancerContext *) self;
437 if (pContext == NULL || pDescriptor == NULL) {