Lines Matching refs:pContext

132 int  LvmBundle_init            (EffectContext *pContext);
133 int LvmEffect_enable (EffectContext *pContext);
134 int LvmEffect_disable (EffectContext *pContext);
135 void LvmEffect_free (EffectContext *pContext);
136 int Effect_setConfig (EffectContext *pContext, effect_config_t *pConfig);
137 void Effect_getConfig (EffectContext *pContext, effect_config_t *pConfig);
138 int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue);
139 int BassBoost_getParameter (EffectContext *pContext,
143 int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue);
144 int Virtualizer_getParameter (EffectContext *pContext,
148 int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue);
149 int Equalizer_getParameter (EffectContext *pContext,
153 int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue);
154 int Volume_getParameter (EffectContext *pContext,
158 int Effect_setEnabled(EffectContext *pContext, bool enabled);
169 EffectContext *pContext = NULL;
203 pContext = new EffectContext;
214 pContext->pBundledContext = GlobalSessionMemory[sessionNo].pBundledContext;
215 pContext->pBundledContext->SessionNo = sessionNo;
216 pContext->pBundledContext->SessionId = sessionId;
217 pContext->pBundledContext->hInstance = NULL;
218 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
219 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
220 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
221 pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
222 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
223 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
224 pContext->pBundledContext->NumberEffectsEnabled = 0;
225 pContext->pBundledContext->NumberEffectsCalled = 0;
226 pContext->pBundledContext->firstVolume = LVM_TRUE;
227 pContext->pBundledContext->volume = 0;
231 snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
232 pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
233 if (pContext->pBundledContext->PcmInPtr == NULL) {
239 snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
240 pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
241 if (pContext->pBundledContext->PcmOutPtr == NULL) {
243 fclose(pContext->pBundledContext->PcmInPtr);
244 pContext->pBundledContext->PcmInPtr = NULL;
254 pContext->pBundledContext->BassStrengthSaved = 0;
255 pContext->pBundledContext->VirtStrengthSaved = 0;
256 pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
257 pContext->pBundledContext->levelSaved = 0;
258 pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
259 pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
260 pContext->pBundledContext->positionSaved = 0;
261 pContext->pBundledContext->workBuffer = NULL;
262 pContext->pBundledContext->frameCount = -1;
263 pContext->pBundledContext->SamplesToExitCountVirt = 0;
264 pContext->pBundledContext->SamplesToExitCountBb = 0;
265 pContext->pBundledContext->SamplesToExitCountEq = 0;
268 pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
272 ret = LvmBundle_init(pContext);
282 pContext->pBundledContext =
285 ALOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
287 pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
294 pContext->pBundledContext->SamplesToExitCountBb = 0;
296 pContext->itfe = &gLvmEffectInterface;
297 pContext->EffectType = LVM_BASS_BOOST;
302 pContext->pBundledContext->SamplesToExitCountVirt = 0;
304 pContext->itfe = &gLvmEffectInterface;
305 pContext->EffectType = LVM_VIRTUALIZER;
310 pContext->pBundledContext->SamplesToExitCountEq = 0;
312 pContext->itfe = &gLvmEffectInterface;
313 pContext->EffectType = LVM_EQUALIZER;
319 pContext->itfe = &gLvmEffectInterface;
320 pContext->EffectType = LVM_VOLUME;
330 if (pContext != NULL) {
334 delete pContext->pBundledContext;
336 delete pContext;
340 *pHandle = (effect_handle_t)pContext;
348 EffectContext * pContext = (EffectContext *)handle;
350 ALOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
351 if (pContext == NULL){
356 SessionContext *pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
360 if(pContext->EffectType == LVM_BASS_BOOST) {
363 if(pContext->pBundledContext->SamplesToExitCountBb > 0){
364 pContext->pBundledContext->NumberEffectsEnabled--;
366 pContext->pBundledContext->SamplesToExitCountBb = 0;
367 } else if(pContext->EffectType == LVM_VIRTUALIZER) {
370 if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
371 pContext->pBundledContext->NumberEffectsEnabled--;
373 pContext->pBundledContext->SamplesToExitCountVirt = 0;
374 } else if(pContext->EffectType == LVM_EQUALIZER) {
377 if(pContext->pBundledContext->SamplesToExitCountEq > 0){
378 pContext->pBundledContext->NumberEffectsEnabled--;
380 pContext->pBundledContext->SamplesToExitCountEq = 0;
381 } else if(pContext->EffectType == LVM_VOLUME) {
384 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE){
385 pContext->pBundledContext->NumberEffectsEnabled--;
393 Effect_setEnabled(pContext, LVM_FALSE);
402 if (pContext->pBundledContext->PcmInPtr != NULL) {
403 fclose(pContext->pBundledContext->PcmInPtr);
404 pContext->pBundledContext->PcmInPtr = NULL;
406 if (pContext->pBundledContext->PcmOutPtr != NULL) {
407 fclose(pContext->pBundledContext->PcmOutPtr);
408 pContext->pBundledContext->PcmOutPtr = NULL;
415 if(SessionIndex[i] == pContext->pBundledContext->SessionId){
418 i, pContext->pBundledContext->SessionId);
427 LvmEffect_free(pContext);
428 ALOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
429 if (pContext->pBundledContext->workBuffer != NULL) {
430 free(pContext->pBundledContext->workBuffer);
432 delete pContext->pBundledContext;
433 pContext->pBundledContext = LVM_NULL;
436 delete pContext;
492 // pContext: effect engine context
498 int LvmBundle_init(EffectContext *pContext){
503 pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
504 pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
505 pContext->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
506 pContext->config.inputCfg.samplingRate = 44100;
507 pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
508 pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
509 pContext->config.inputCfg.bufferProvider.cookie = NULL;
510 pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
511 pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
512 pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
513 pContext->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
514 pContext->config.outputCfg.samplingRate = 44100;
515 pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
516 pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
517 pContext->config.outputCfg.bufferProvider.cookie = NULL;
518 pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
520 CHECK_ARG(pContext != NULL);
522 if (pContext->pBundledContext->hInstance != NULL){
523 ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
524 "-> Calling pContext->pBassBoost->free()");
526 LvmEffect_free(pContext);
528 ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
529 "-> Called pContext->pBassBoost->free()");
593 pContext->pBundledContext->hInstance = LVM_NULL;
596 LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance,
612 pContext->pBundledContext->SampleRate = LVM_FS_44100;
659 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance,
678 LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance,
700 // pContext: effect engine context
711 EffectContext *pContext){
717 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
719 }else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
720 if (pContext->pBundledContext->frameCount != frameCount) {
721 if (pContext->pBundledContext->workBuffer != NULL) {
722 free(pContext->pBundledContext->workBuffer);
724 pContext->pBundledContext->workBuffer =
726 pContext->pBundledContext->frameCount = frameCount;
728 pOutTmp = pContext->pBundledContext->workBuffer;
735 fwrite(pIn, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmInPtr);
736 fflush(pContext->pBundledContext->PcmInPtr);
742 LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
752 fwrite(pOutTmp, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmOutPtr);
753 fflush(pContext->pBundledContext->PcmOutPtr);
756 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
770 // pContext: effect engine context
776 int LvmEffect_enable(EffectContext *pContext){
783 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
790 if(pContext->EffectType == LVM_BASS_BOOST) {
794 if(pContext->EffectType == LVM_VIRTUALIZER) {
798 if(pContext->EffectType == LVM_EQUALIZER) {
802 if(pContext->EffectType == LVM_VOLUME) {
806 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
821 // pContext: effect engine context
827 int LvmEffect_disable(EffectContext *pContext){
833 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
840 if(pContext->EffectType == LVM_BASS_BOOST) {
844 if(pContext->EffectType == LVM_VIRTUALIZER) {
848 if(pContext->EffectType == LVM_EQUALIZER) {
852 if(pContext->EffectType == LVM_VOLUME) {
856 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
871 // pContext: effect engine context
877 void LvmEffect_free(EffectContext *pContext){
883 LvmStatus = LVM_GetMemoryTable(pContext->pBundledContext->hInstance,
914 // pContext: effect engine context
922 int Effect_setConfig(EffectContext *pContext, effect_config_t *pConfig){
926 CHECK_ARG(pContext != NULL);
937 pContext->config = *pConfig;
942 pContext->pBundledContext->SamplesPerSecond = 8000*2; // 2 secs Stereo
946 pContext->pBundledContext->SamplesPerSecond = 16000*2; // 2 secs Stereo
950 pContext->pBundledContext->SamplesPerSecond = 22050*2; // 2 secs Stereo
954 pContext->pBundledContext->SamplesPerSecond = 32000*2; // 2 secs Stereo
958 pContext->pBundledContext->SamplesPerSecond = 44100*2; // 2 secs Stereo
962 pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
969 if(pContext->pBundledContext->SampleRate != SampleRate){
977 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
985 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
989 pContext->pBundledContext->SampleRate = SampleRate;
1005 // pContext: effect engine context
1013 void Effect_getConfig(EffectContext *pContext, effect_config_t *pConfig)
1015 *pConfig = pContext->config;
1028 // pContext: effect engine context
1032 uint32_t BassGetStrength(EffectContext *pContext){
1033 //ALOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
1038 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1048 (LVM_INT16)((15*pContext->pBundledContext->BassStrengthSaved)/1000)){
1050 ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
1055 //ALOGV("\tBassGetStrength() (saved) -> %d\n", pContext->pBundledContext->BassStrengthSaved );
1056 return pContext->pBundledContext->BassStrengthSaved;
1066 // pContext: effect engine context
1071 void BassSetStrength(EffectContext *pContext, uint32_t strength){
1074 pContext->pBundledContext->BassStrengthSaved = (int)strength;
1080 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1093 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1109 // pContext: effect engine context
1113 uint32_t VirtualizerGetStrength(EffectContext *pContext){
1114 //ALOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
1119 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1126 return pContext->pBundledContext->VirtStrengthSaved;
1136 // pContext: effect engine context
1141 void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){
1146 pContext->pBundledContext->VirtStrengthSaved = (int)strength;
1149 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
1161 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1174 // pContext: effect engine context
1179 void EqualizerLimitBandLevels(EffectContext *pContext) {
1184 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1198 if (pContext->pBundledContext->bandGaindB[i] >= maxGain) {
1199 int tmpMaxGain = pContext->pBundledContext->bandGaindB[i];
1203 int gain = pContext->pBundledContext->bandGaindB[j];
1230 ActiveParams.pEQNB_BandDefinition[i].Gain = pContext->pBundledContext->bandGaindB[i];
1234 if (maxGain + pContext->pBundledContext->volume > 0) {
1235 gainCorrection = maxGain + pContext->pBundledContext->volume;
1244 ActiveParams.VC_EffectLevel = pContext->pBundledContext->volume - gainCorrection;
1250 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1256 if(pContext->pBundledContext->firstVolume == LVM_TRUE){
1257 LvmStatus = LVM_SetVolumeNoSmoothing(pContext->pBundledContext->hInstance, &ActiveParams);
1260 pContext->pBundledContext->firstVolume = LVM_FALSE;
1272 // pContext: effect engine context
1277 int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){
1278 //ALOGV("\tEqualizerGetBandLevel -> %d\n", pContext->pBundledContext->bandGaindB[band] );
1279 return pContext->pBundledContext->bandGaindB[band] * 100;
1291 // pContext: effect engine context
1296 void EqualizerSetBandLevel(EffectContext *pContext, int band, short Gain){
1304 pContext->pBundledContext->bandGaindB[band] = gainRounded;
1305 pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
1307 EqualizerLimitBandLevels(pContext);
1317 // pContext: effect engine context
1322 int32_t EqualizerGetCentreFrequency(EffectContext *pContext, int32_t band){
1329 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1354 // pContext: effect engine context
1360 int32_t EqualizerGetBandFreqRange(EffectContext *pContext, int32_t band, uint32_t *pLow,
1378 // pContext: effect engine context
1384 int32_t EqualizerGetBand(EffectContext *pContext, uint32_t targetFreq){
1410 // pContext: effect engine context
1413 int32_t EqualizerGetPreset(EffectContext *pContext){
1414 return pContext->pBundledContext->CurPreset;
1426 // pContext: effect engine context
1430 void EqualizerSetPreset(EffectContext *pContext, int preset){
1433 pContext->pBundledContext->CurPreset = preset;
1438 pContext->pBundledContext->bandGaindB[i] =
1442 EqualizerLimitBandLevels(pContext);
1480 // pContext: effect engine context
1485 int VolumeSetVolumeLevel(EffectContext *pContext, int16_t level){
1491 if (pContext->pBundledContext->bMuteEnabled == LVM_TRUE) {
1492 pContext->pBundledContext->levelSaved = level / 100;
1494 pContext->pBundledContext->volume = level / 100;
1497 EqualizerLimitBandLevels(pContext);
1508 // pContext: effect engine context
1512 int VolumeGetVolumeLevel(EffectContext *pContext, int16_t *level){
1514 if (pContext->pBundledContext->bMuteEnabled == LVM_TRUE) {
1515 *level = pContext->pBundledContext->levelSaved * 100;
1517 *level = pContext->pBundledContext->volume * 100;
1528 // pContext: effect engine context
1533 int32_t VolumeSetMute(EffectContext *pContext, uint32_t mute){
1536 pContext->pBundledContext->bMuteEnabled = mute;
1539 if(pContext->pBundledContext->bMuteEnabled == LVM_TRUE){
1540 pContext->pBundledContext->levelSaved = pContext->pBundledContext->volume;
1541 pContext->pBundledContext->volume = -96;
1543 pContext->pBundledContext->volume = pContext->pBundledContext->levelSaved;
1546 EqualizerLimitBandLevels(pContext);
1557 // pContext: effect engine context
1563 int32_t VolumeGetMute(EffectContext *pContext, uint32_t *mute){
1565 if((pContext->pBundledContext->bMuteEnabled == LVM_FALSE)||
1566 (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)){
1567 *mute = pContext->pBundledContext->bMuteEnabled;
1571 pContext->pBundledContext->bMuteEnabled);
1591 // pContext: effect engine context
1597 int VolumeSetStereoPosition(EffectContext *pContext, int16_t position){
1605 pContext->pBundledContext->positionSaved = position;
1606 Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1608 //ALOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
1609 //pContext->pBundledContext->positionSaved);
1611 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
1614 pContext->pBundledContext->positionSaved = position;
1616 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1627 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1634 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1644 //ALOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
1645 //pContext->pBundledContext->positionSaved);
1656 // pContext: effect engine context
1662 int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){
1669 //ALOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
1670 //pContext->pBundledContext->positionSaved);
1672 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1679 balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1681 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
1686 *position = (LVM_INT16)pContext->pBundledContext->positionSaved; // Convert dB to millibels
1687 //ALOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
1688 //pContext->pBundledContext->positionSaved);
1698 // pContext: effect engine context
1703 int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){
1706 pContext->pBundledContext->bStereoPositionEnabled = enabled;
1712 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1721 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_FALSE){
1725 VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1729 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1759 int BassBoost_getParameter(EffectContext *pContext,
1801 *(int16_t *)pValue = BassGetStrength(pContext);
1832 int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue){
1844 BassSetStrength(pContext, (int32_t)strength);
1877 int Virtualizer_getParameter(EffectContext *pContext,
1919 *(int16_t *)pValue = VirtualizerGetStrength(pContext);
1950 int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue){
1963 VirtualizerSetStrength(pContext, (int32_t)strength);
1995 int Equalizer_getParameter(EffectContext *pContext,
2079 *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
2090 *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, param2);
2101 EqualizerGetBandFreqRange(pContext, param2, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
2108 *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
2114 *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
2141 p[0] = (int16_t)EqualizerGetPreset(pContext);
2144 p[2 + i] = (int16_t)EqualizerGetBandLevel(pContext, i);
2172 int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue){
2191 EqualizerSetPreset(pContext, preset);
2201 EqualizerSetBandLevel(pContext, band, level);
2211 EqualizerSetPreset(pContext, (int)p[0]);
2218 EqualizerSetBandLevel(pContext, i, (int)p[2 + i]);
2253 int Volume_getParameter(EffectContext *pContext,
2292 status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
2304 VolumeGetStereoPosition(pContext, (int16_t *)pValue);
2310 status = VolumeGetMute(pContext, (uint32_t *)pValue);
2316 *(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
2347 int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue){
2363 status = VolumeSetVolumeLevel(pContext, (int16_t)level);
2371 status = VolumeSetMute(pContext, mute);
2377 status = VolumeEnableStereoPosition(pContext, positionEnabled);
2378 status = VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
2386 status = VolumeSetStereoPosition(pContext, (int16_t)position);
2452 // pContext - pointer to effect context
2459 int Effect_setEnabled(EffectContext *pContext, bool enabled)
2461 ALOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
2467 switch (pContext->EffectType) {
2469 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
2473 if(pContext->pBundledContext->SamplesToExitCountBb <= 0){
2474 pContext->pBundledContext->NumberEffectsEnabled++;
2476 pContext->pBundledContext->SamplesToExitCountBb =
2477 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2478 pContext->pBundledContext->bBassEnabled = LVM_TRUE;
2479 tempDisabled = pContext->pBundledContext->bBassTempDisabled;
2482 if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) {
2486 if(pContext->pBundledContext->SamplesToExitCountEq <= 0){
2487 pContext->pBundledContext->NumberEffectsEnabled++;
2489 pContext->pBundledContext->SamplesToExitCountEq =
2490 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2491 pContext->pBundledContext->bEqualizerEnabled = LVM_TRUE;
2494 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
2498 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0){
2499 pContext->pBundledContext->NumberEffectsEnabled++;
2501 pContext->pBundledContext->SamplesToExitCountVirt =
2502 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2503 pContext->pBundledContext->bVirtualizerEnabled = LVM_TRUE;
2504 tempDisabled = pContext->pBundledContext->bVirtualizerTempDisabled;
2507 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE) {
2511 pContext->pBundledContext->NumberEffectsEnabled++;
2512 pContext->pBundledContext->bVolumeEnabled = LVM_TRUE;
2519 LvmEffect_enable(pContext);
2522 switch (pContext->EffectType) {
2524 if (pContext->pBundledContext->bBassEnabled == LVM_FALSE) {
2528 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
2531 if (pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE) {
2535 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
2538 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE) {
2542 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
2545 if (pContext->pBundledContext->bVolumeEnabled == LVM_FALSE) {
2549 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
2555 LvmEffect_disable(pContext);
2590 EffectContext * pContext = (EffectContext *) self;
2598 //pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
2599 // pContext->pBundledContext->SamplesToExitCountBb,
2600 // pContext->pBundledContext->SamplesToExitCountVirt,
2601 // pContext->pBundledContext->SamplesToExitCountEq);
2603 if (pContext == NULL){
2604 ALOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
2608 //if(pContext->EffectType == LVM_BASS_BOOST){
2610 //}else if(pContext->EffectType == LVM_EQUALIZER){
2612 //}else if(pContext->EffectType == LVM_VIRTUALIZER){
2622 if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE)&&
2623 (pContext->EffectType == LVM_BASS_BOOST)){
2625 if(pContext->pBundledContext->SamplesToExitCountBb > 0){
2626 pContext->pBundledContext->SamplesToExitCountBb -= outBuffer->frameCount * 2; // STEREO
2628 // pContext->pBundledContext->SamplesToExitCountBb);
2630 if(pContext->pBundledContext->SamplesToExitCountBb <= 0) {
2632 pContext->pBundledContext->NumberEffectsEnabled--;
2636 if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE)&&
2637 (pContext->EffectType == LVM_VOLUME)){
2640 pContext->pBundledContext->NumberEffectsEnabled--;
2642 if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE)&&
2643 (pContext->EffectType == LVM_EQUALIZER)){
2645 if(pContext->pBundledContext->SamplesToExitCountEq > 0){
2646 pContext->pBundledContext->SamplesToExitCountEq -= outBuffer->frameCount * 2; // STEREO
2648 // pContext->pBundledContext->SamplesToExitCountEq);
2650 if(pContext->pBundledContext->SamplesToExitCountEq <= 0) {
2652 pContext->pBundledContext->NumberEffectsEnabled--;
2656 if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE)&&
2657 (pContext->EffectType == LVM_VIRTUALIZER)){
2659 if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
2660 pContext->pBundledContext->SamplesToExitCountVirt -= outBuffer->frameCount * 2;// STEREO
2662 // pContext->pBundledContext->SamplesToExitCountVirt);
2664 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
2666 pContext->pBundledContext->NumberEffectsEnabled--;
2672 pContext->pBundledContext->NumberEffectsCalled++;
2675 if(pContext->pBundledContext->NumberEffectsCalled ==
2676 pContext->pBundledContext->NumberEffectsEnabled){
2678 //pContext->pBundledContext->NumberEffectsEnabled,
2679 //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
2684 pContext->pBundledContext->NumberEffectsCalled = 0;
2690 pContext);
2697 //pContext->pBundledContext->NumberEffectsEnabled,
2698 //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
2700 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
2720 EffectContext * pContext = (EffectContext *) self;
2725 if(pContext->EffectType == LVM_BASS_BOOST){
2728 if(pContext->EffectType == LVM_VIRTUALIZER){
2731 if(pContext->EffectType == LVM_EQUALIZER){
2734 if(pContext->EffectType == LVM_VOLUME){
2738 if (pContext == NULL){
2739 ALOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
2747 // pContext->pBundledContext->NumberEffectsCalled = 0;
2750 // pContext->pBundledContext->NumberEffectsCalled,
2751 // pContext->pBundledContext->NumberEffectsEnabled);
2757 pContext->EffectType);
2762 if(pContext->EffectType == LVM_BASS_BOOST){
2764 android::BassSetStrength(pContext, 0);
2766 if(pContext->EffectType == LVM_VIRTUALIZER){
2768 android::VirtualizerSetStrength(pContext, 0);
2770 if(pContext->EffectType == LVM_EQUALIZER){
2772 android::EqualizerSetPreset(pContext, 0);
2774 if(pContext->EffectType == LVM_VOLUME){
2776 *(int *) pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
2790 *(int *) pReplyData = android::Effect_setConfig(pContext, (effect_config_t *) pCmdData);
2802 android::Effect_getConfig(pContext, (effect_config_t *)pReplyData);
2807 android::Effect_setConfig(pContext, &pContext->config);
2814 if(pContext->EffectType == LVM_BASS_BOOST){
2831 p->status = android::BassBoost_getParameter(pContext,
2845 if(pContext->EffectType == LVM_VIRTUALIZER){
2862 p->status = android::Virtualizer_getParameter(pContext,
2875 if(pContext->EffectType == LVM_EQUALIZER){
2894 p->status = android::Equalizer_getParameter(pContext,
2908 if(pContext->EffectType == LVM_VOLUME){
2926 p->status = android::Volume_getParameter(pContext,
2943 if(pContext->EffectType == LVM_BASS_BOOST){
2972 *(int *)pReplyData = android::BassBoost_setParameter(pContext,
2976 if(pContext->EffectType == LVM_VIRTUALIZER){
3005 *(int *)pReplyData = android::Virtualizer_setParameter(pContext,
3009 if(pContext->EffectType == LVM_EQUALIZER){
3025 *(int *)pReplyData = android::Equalizer_setParameter(pContext,
3029 if(pContext->EffectType == LVM_VOLUME){
3046 *(int *)pReplyData = android::Volume_setParameter(pContext,
3060 *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_TRUE);
3069 *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
3077 if (pContext->EffectType == LVM_BASS_BOOST) {
3089 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
3092 android::LvmEffect_disable(pContext);
3094 pContext->pBundledContext->bBassTempDisabled = LVM_TRUE;
3102 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
3105 android::LvmEffect_enable(pContext);
3107 pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
3110 if (pContext->EffectType == LVM_VIRTUALIZER) {
3122 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
3125 android::LvmEffect_disable(pContext);
3127 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE;
3135 if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){
3138 android::LvmEffect_enable(pContext);
3140 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
3191 //pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
3192 //(int32_t)maxdB, maxVol<<7, pContext->EffectType);
3198 android::VolumeSetVolumeLevel(pContext, (int16_t)(maxdB*100));
3201 LvmStatus =LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
3210 LvmStatus =LVM_SetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
3229 EffectContext * pContext = (EffectContext *) self;
3232 if (pContext == NULL || pDescriptor == NULL) {
3237 switch(pContext->EffectType) {