Home | History | Annotate | Download | only in Bundle

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_configure (EffectContext *pContext, effect_config_t *pConfig);
137 int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue);
138 int BassBoost_getParameter (EffectContext *pContext,
142 int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue);
143 int Virtualizer_getParameter (EffectContext *pContext,
147 int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue);
148 int Equalizer_getParameter (EffectContext *pContext,
152 int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue);
153 int Volume_getParameter (EffectContext *pContext,
157 int Effect_setEnabled(EffectContext *pContext, bool enabled);
204 EffectContext *pContext = NULL;
238 pContext = new EffectContext;
249 pContext->pBundledContext = GlobalSessionMemory[sessionNo].pBundledContext;
250 pContext->pBundledContext->SessionNo = sessionNo;
251 pContext->pBundledContext->SessionId = sessionId;
252 pContext->pBundledContext->hInstance = NULL;
253 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
254 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
255 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
256 pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
257 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
258 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
259 pContext->pBundledContext->NumberEffectsEnabled = 0;
260 pContext->pBundledContext->NumberEffectsCalled = 0;
261 pContext->pBundledContext->firstVolume = LVM_TRUE;
265 snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
266 pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
267 if (pContext->pBundledContext->PcmInPtr == NULL) {
273 snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
274 pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
275 if (pContext->pBundledContext->PcmOutPtr == NULL) {
277 fclose(pContext->pBundledContext->PcmInPtr);
278 pContext->pBundledContext->PcmInPtr = NULL;
288 pContext->pBundledContext->BassStrengthSaved = 0;
289 pContext->pBundledContext->VirtStrengthSaved = 0;
290 pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
291 pContext->pBundledContext->levelSaved = 0;
292 pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
293 pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
294 pContext->pBundledContext->positionSaved = 0;
295 pContext->pBundledContext->workBuffer = NULL;
296 pContext->pBundledContext->frameCount = -1;
297 pContext->pBundledContext->SamplesToExitCountVirt = 0;
298 pContext->pBundledContext->SamplesToExitCountBb = 0;
299 pContext->pBundledContext->SamplesToExitCountEq = 0;
302 ret = LvmBundle_init(pContext);
312 pContext->pBundledContext =
315 LOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
317 pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
324 pContext->pBundledContext->SamplesToExitCountBb = 0;
326 pContext->itfe = &gLvmEffectInterface;
327 pContext->EffectType = LVM_BASS_BOOST;
332 pContext->pBundledContext->SamplesToExitCountVirt = 0;
334 pContext->itfe = &gLvmEffectInterface;
335 pContext->EffectType = LVM_VIRTUALIZER;
340 pContext->pBundledContext->SamplesToExitCountEq = 0;
342 pContext->itfe = &gLvmEffectInterface;
343 pContext->EffectType = LVM_EQUALIZER;
349 pContext->itfe = &gLvmEffectInterface;
350 pContext->EffectType = LVM_VOLUME;
360 if (pContext != NULL) {
364 delete pContext->pBundledContext;
366 delete pContext;
370 *pHandle = (effect_handle_t)pContext;
378 EffectContext * pContext = (EffectContext *)handle;
380 LOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
381 if (pContext == NULL){
386 SessionContext *pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
390 if(pContext->EffectType == LVM_BASS_BOOST) {
393 if(pContext
394 pContext->pBundledContext->NumberEffectsEnabled--;
396 pContext->pBundledContext->SamplesToExitCountBb = 0;
397 } else if(pContext->EffectType == LVM_VIRTUALIZER) {
400 if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
401 pContext->pBundledContext->NumberEffectsEnabled--;
403 pContext->pBundledContext->SamplesToExitCountVirt = 0;
404 } else if(pContext->EffectType == LVM_EQUALIZER) {
407 if(pContext->pBundledContext->SamplesToExitCountEq > 0){
408 pContext->pBundledContext->NumberEffectsEnabled--;
410 pContext->pBundledContext->SamplesToExitCountEq = 0;
411 } else if(pContext->EffectType == LVM_VOLUME) {
414 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE){
415 pContext->pBundledContext->NumberEffectsEnabled--;
423 Effect_setEnabled(pContext, LVM_FALSE);
432 if (pContext->pBundledContext->PcmInPtr != NULL) {
433 fclose(pContext->pBundledContext->PcmInPtr);
434 pContext->pBundledContext->PcmInPtr = NULL;
436 if (pContext->pBundledContext->PcmOutPtr != NULL) {
437 fclose(pContext->pBundledContext->PcmOutPtr);
438 pContext->pBundledContext->PcmOutPtr = NULL;
445 if(SessionIndex[i] == pContext->pBundledContext->SessionId){
448 i, pContext->pBundledContext->SessionId);
457 LvmEffect_free(pContext);
458 LOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
459 if (pContext->pBundledContext->workBuffer != NULL) {
460 free(pContext->pBundledContext->workBuffer);
462 delete pContext->pBundledContext;
463 pContext->pBundledContext = LVM_NULL;
466 delete pContext;
522 // pContext: effect engine context
528 int LvmBundle_init(EffectContext *pContext){
533 pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
534 pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
535 pContext->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
536 pContext->config.inputCfg.samplingRate = 44100;
537 pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
538 pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
539 pContext->config.inputCfg.bufferProvider.cookie = NULL;
540 pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
541 pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
542 pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
543 pContext->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
544 pContext->config.outputCfg.samplingRate = 44100;
545 pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
546 pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
547 pContext->config.outputCfg.bufferProvider.cookie = NULL;
548 pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
550 CHECK_ARG(pContext != NULL);
552 if (pContext->pBundledContext->hInstance != NULL){
553 LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
554 "-> Calling pContext->pBassBoost->free()");
556 LvmEffect_free(pContext);
558 LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
559 "-> Called pContext->pBassBoost->free()");
623 pContext->pBundledContext->hInstance = LVM_NULL;
626 LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance,
642 pContext->pBundledContext->SampleRate = LVM_FS_44100;
689 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance,
708 LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance,
730 // pContext: effect engine context
741 EffectContext *pContext){
747 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
749 }else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
750 if (pContext->pBundledContext->frameCount != frameCount) {
751 if (pContext->pBundledContext->workBuffer != NULL) {
752 free(pContext->pBundledContext->workBuffer);
754 pContext->pBundledContext->workBuffer =
756 pContext->pBundledContext->frameCount = frameCount;
758 pOutTmp = pContext->pBundledContext->workBuffer;
765 fwrite(pIn, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmInPtr);
766 fflush(pContext->pBundledContext->PcmInPtr);
772 LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
782 fwrite(pOutTmp, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmOutPtr);
783 fflush(pContext->pBundledContext->PcmOutPtr);
786 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
800 // pContext: effect engine context
806 int LvmEffect_enable(EffectContext *pContext){
813 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
820 if(pContext->EffectType == LVM_BASS_BOOST) {
824 if(pContext->EffectType == LVM_VIRTUALIZER) {
828 if(pContext->EffectType == LVM_EQUALIZER) {
832 if(pContext->EffectType == LVM_VOLUME) {
836 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
851 // pContext: effect engine context
857 int LvmEffect_disable(EffectContext *pContext){
863 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
870 if(pContext->EffectType == LVM_BASS_BOOST) {
874 if(pContext->EffectType == LVM_VIRTUALIZER) {
878 if(pContext->EffectType == LVM_EQUALIZER) {
882 if(pContext->EffectType == LVM_VOLUME) {
886 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
901 // pContext: effect engine context
907 void LvmEffect_free(EffectContext *pContext){
913 LvmStatus = LVM_GetMemoryTable(pContext->pBundledContext->hInstance,
944 // pContext: effect engine context
952 int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
956 CHECK_ARG(pContext != NULL);
967 memcpy(&pContext->config, pConfig, sizeof(effect_config_t));
972 pContext->pBundledContext->SamplesPerSecond = 8000*2; // 2 secs Stereo
976 pContext->pBundledContext->SamplesPerSecond = 16000*2; // 2 secs Stereo
980 pContext->pBundledContext->SamplesPerSecond = 22050*2; // 2 secs Stereo
984 pContext->pBundledContext->SamplesPerSecond = 32000*2; // 2 secs Stereo
988 pContext->pBundledContext->SamplesPerSecond = 44100*2; // 2 secs Stereo
992 pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
999 if(pContext->pBundledContext->SampleRate != SampleRate){
1007 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1013 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1017 pContext->pBundledContext->SampleRate = SampleRate;
1037 // pContext: effect engine context
1041 uint32_t BassGetStrength(EffectContext *pContext){
1042 //LOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
1047 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1057 (LVM_INT16)((15*pContext->pBundledContext->BassStrengthSaved)/1000)){
1059 ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
1064 //LOGV("\tBassGetStrength() (saved) -> %d\n", pContext->pBundledContext->BassStrengthSaved );
1065 return pContext->pBundledContext->BassStrengthSaved;
1075 // pContext: effect engine context
1080 void BassSetStrength(EffectContext *pContext, uint32_t strength){
1083 pContext->pBundledContext->BassStrengthSaved = (int)strength;
1089 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1102 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1118 // pContext: effect engine context
1122 uint32_t VirtualizerGetStrength(EffectContext *pContext){
1123 //LOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
1128 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1135 return pContext->pBundledContext->VirtStrengthSaved;
1145 // pContext: effect engine context
1150 void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){
1155 pContext->pBundledContext->VirtStrengthSaved = (int)strength;
1158 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
1170 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1182 // pContext: effect engine context
1187 int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){
1194 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1216 // pContext: effect engine context
1221 void EqualizerSetBandLevel(EffectContext *pContext, int band, short Gain){
1236 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1246 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1250 pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
1260 // pContext: effect engine context
1265 int32_t EqualizerGetCentreFrequency(EffectContext *pContext, int32_t band){
1272 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
1297 // pContext: effect engine context
1303 int32_t EqualizerGetBandFreqRange(EffectContext *pContext, int32_t band, uint32_t *pLow,
1321 // pContext: effect engine context
1327 int32_t EqualizerGetBand(EffectContext *pContext, uint32_t targetFreq){
1353 // pContext: effect engine context
1356 int32_t EqualizerGetPreset(EffectContext *pContext){
1357 return pContext->pBundledContext->CurPreset;
1369 // pContext: effect engine context
1373 void EqualizerSetPreset(EffectContext *pContext, int preset){
1376 pContext->pBundledContext->CurPreset = preset;
1382 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1395 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1434 // pContext: effect engine context
1439 int VolumeSetVolumeLevel(EffectContext *pContext, int16_t level){
1446 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1457 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1464 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1469 if(pContext->pBundledContext->firstVolume == LVM_TRUE){
1470 LvmStatus = LVM_SetVolumeNoSmoothing(pContext->pBundledContext->hInstance, &ActiveParams);
1473 pContext->pBundledContext->firstVolume = LVM_FALSE;
1484 // pContext: effect engine context
1488 int VolumeGetVolumeLevel(EffectContext *pContext, int16_t *level){
1495 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1513 // pContext: effect engine context
1518 int32_t VolumeSetMute(EffectContext *pContext, uint32_t mute){
1521 pContext->pBundledContext->bMuteEnabled = mute;
1527 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1535 if(pContext->pBundledContext->bMuteEnabled == LVM_TRUE){
1536 pContext->pBundledContext->levelSaved = ActiveParams.VC_EffectLevel;
1539 ActiveParams.VC_EffectLevel = pContext->pBundledContext->levelSaved;
1543 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1558 // pContext: effect engine context
1564 int32_t VolumeGetMute(EffectContext *pContext, uint32_t *mute){
1566 if((pContext
1567 (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)){
1568 *mute = pContext->pBundledContext->bMuteEnabled;
1572 pContext->pBundledContext->bMuteEnabled);
1592 // pContext: effect engine context
1598 int VolumeSetStereoPosition(EffectContext *pContext, int16_t position){
1606 pContext->pBundledContext->positionSaved = position;
1607 Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1609 //LOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
1610 //pContext->pBundledContext->positionSaved);
1612 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
1615 pContext->pBundledContext->positionSaved = position;
1617 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1628 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1635 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1645 //LOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
1646 //pContext->pBundledContext->positionSaved);
1657 // pContext: effect engine context
1663 int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){
1670 //LOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
1671 //pContext->pBundledContext->positionSaved);
1673 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1680 balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1682 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
1687 *position = (LVM_INT16)pContext->pBundledContext->positionSaved; // Convert dB to millibels
1688 //LOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
1689 //pContext->pBundledContext->positionSaved);
1699 // pContext: effect engine context
1704 int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){
1707 pContext->pBundledContext->bStereoPositionEnabled = enabled;
1713 LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1722 if(pContext->pBundledContext->bStereoPositionEnabled == LVM_FALSE){
1726 VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
1730 LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
1760 int BassBoost_getParameter(EffectContext *pContext,
1802 *(int16_t *)pValue = BassGetStrength(pContext);
1833 int BassBoost_setParameter (EffectContext *pContext, void *pParam, void *pValue){
1845 BassSetStrength(pContext, (int32_t)strength);
1878 int Virtualizer_getParameter(EffectContext *pContext,
1920 *(int16_t *)pValue = VirtualizerGetStrength(pContext);
1951 int Virtualizer_setParameter (EffectContext *pContext, void *pParam, void *pValue){
1964 VirtualizerSetStrength(pContext, (int32_t)strength);
1996 int Equalizer_getParameter(EffectContext *pContext,
2080 *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
2091 *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, param2);
2102 EqualizerGetBandFreqRange(pContext, param2, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
2109 *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
2115 *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
2142 p[0] = (int16_t)EqualizerGetPreset(pContext);
2145 p[2 + i] = (int16_t)EqualizerGetBandLevel(pContext, i);
2173 int Equalizer_setParameter (EffectContext *pContext, void *pParam, void *pValue){
2192 EqualizerSetPreset(pContext, preset);
2202 EqualizerSetBandLevel(pContext, band, level);
2212 EqualizerSetPreset(pContext, (int)p[0]);
2219 EqualizerSetBandLevel(pContext, i, (int)p[2 + i]);
2254 int Volume_getParameter(EffectContext *pContext,
2293 status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
2305 VolumeGetStereoPosition(pContext, (int16_t *)pValue);
2311 status = VolumeGetMute(pContext, (uint32_t *)pValue);
2317 *(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
2348 int Volume_setParameter (EffectContext *pContext, void *pParam, void *pValue){
2364 status = VolumeSetVolumeLevel(pContext, (int16_t)level);
2372 status = VolumeSetMute(pContext, mute);
2378 status = VolumeEnableStereoPosition(pContext, positionEnabled);
2379 status = VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
2387 status = VolumeSetStereoPosition(pContext, (int16_t)position);
2453 // pContext - pointer to effect context
2460 int Effect_setEnabled(EffectContext *pContext, bool enabled)
2462 LOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
2468 switch (pContext->EffectType) {
2470 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
2474 if(pContext->pBundledContext->SamplesToExitCountBb <= 0){
2475 pContext->pBundledContext->NumberEffectsEnabled++;
2477 pContext->pBundledContext->SamplesToExitCountBb =
2478 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2479 pContext->pBundledContext->bBassEnabled = LVM_TRUE;
2480 tempDisabled = pContext->pBundledContext->bBassTempDisabled;
2483 if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) {
2487 if(pContext->pBundledContext->SamplesToExitCountEq <= 0){
2488 pContext->pBundledContext->NumberEffectsEnabled++;
2490 pContext->pBundledContext->SamplesToExitCountEq =
2491 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2492 pContext->pBundledContext->bEqualizerEnabled = LVM_TRUE;
2495 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
2499 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0){
2500 pContext->pBundledContext->NumberEffectsEnabled++;
2502 pContext->pBundledContext->SamplesToExitCountVirt =
2503 (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
2504 pContext->pBundledContext->bVirtualizerEnabled = LVM_TRUE;
2505 tempDisabled = pContext->pBundledContext->bVirtualizerTempDisabled;
2508 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE) {
2512 pContext->pBundledContext->NumberEffectsEnabled++;
2513 pContext->pBundledContext->bVolumeEnabled = LVM_TRUE;
2520 LvmEffect_enable(pContext);
2523 switch (pContext->EffectType) {
2525 if (pContext->pBundledContext->bBassEnabled == LVM_FALSE) {
2529 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
2532 if (pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE) {
2536 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
2539 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE) {
2543 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
2546 if (pContext->pBundledContext->bVolumeEnabled == LVM_FALSE) {
2550 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
2556 LvmEffect_disable(pContext);
2591 EffectContext * pContext = (EffectContext *) self;
2599 //pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
2600 // pContext->pBundledContext->SamplesToExitCountBb,
2601 // pContext->pBundledContext->SamplesToExitCountVirt,
2602 // pContext->pBundledContext->SamplesToExitCountEq);
2604 if (pContext == NULL){
2605 LOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
2609 //if(pContext->EffectType == LVM_BASS_BOOST){
2611 //}else if(pContext->EffectType == LVM_EQUALIZER){
2613 //}else if(pContext->EffectType == LVM_VIRTUALIZER){
2623 if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE)&&
2624 (pContext->EffectType == LVM_BASS_BOOST)){
2626 if(pContext->pBundledContext->SamplesToExitCountBb > 0){
2627 pContext->pBundledContext->SamplesToExitCountBb -= outBuffer->frameCount * 2; // STEREO
2629 // pContext->pBundledContext->SamplesToExitCountBb);
2631 if(pContext->pBundledContext->SamplesToExitCountBb <= 0) {
2633 pContext->pBundledContext->NumberEffectsEnabled--;
2637 if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE)&&
2638 (pContext->EffectType == LVM_VOLUME)){
2641 pContext->pBundledContext->NumberEffectsEnabled--;
2643 if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE)&&
2644 (pContext->EffectType == LVM_EQUALIZER)){
2646 if(pContext->pBundledContext->SamplesToExitCountEq > 0){
2647 pContext->pBundledContext->SamplesToExitCountEq -= outBuffer->frameCount * 2; // STEREO
2649 // pContext->pBundledContext->SamplesToExitCountEq);
2651 if(pContext->pBundledContext->SamplesToExitCountEq <= 0) {
2653 pContext->pBundledContext->NumberEffectsEnabled--;
2657 if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE)&&
2658 (pContext->EffectType == LVM_VIRTUALIZER)){
2660 if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
2661 pContext->pBundledContext->SamplesToExitCountVirt -= outBuffer->frameCount * 2;// STEREO
2663 // pContext->pBundledContext->SamplesToExitCountVirt);
2665 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
2667 pContext->pBundledContext->NumberEffectsEnabled--;
2673 pContext->pBundledContext->NumberEffectsCalled++;
2676 if(pContext->pBundledContext->NumberEffectsCalled ==
2677 pContext->pBundledContext->NumberEffectsEnabled){
2679 //pContext->pBundledContext->NumberEffectsEnabled,
2680 //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
2685 pContext->pBundledContext->NumberEffectsCalled = 0;
2691 pContext);
2698 //pContext->pBundledContext->NumberEffectsEnabled,
2699 //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
2701 if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
2721 EffectContext * pContext = (EffectContext *) self;
2726 if(pContext->EffectType == LVM_BASS_BOOST){
2729 if(pContext->EffectType == LVM_VIRTUALIZER){
2732 if(pContext->EffectType == LVM_EQUALIZER){
2735 if(pContext->EffectType == LVM_VOLUME){
2739 if (pContext == NULL){
2740 LOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
2748 // pContext->pBundledContext->NumberEffectsCalled = 0;
2751 // pContext->pBundledContext->NumberEffectsCalled,
2752 // pContext->pBundledContext->NumberEffectsEnabled);
2758 pContext->EffectType);
2763 if(pContext->EffectType == LVM_BASS_BOOST){
2765 android::BassSetStrength(pContext, 0);
2767 if(pContext->EffectType == LVM_VIRTUALIZER){
2769 android::VirtualizerSetStrength(pContext, 0);
2771 if(pContext->EffectType == LVM_EQUALIZER){
2773 android::EqualizerSetPreset(pContext, 0);
2775 if(pContext->EffectType == LVM_VOLUME){
2777 *(int *) pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
2791 *(int *) pReplyData = android::Effect_configure(pContext, (effect_config_t *) pCmdData);
2797 android::Effect_configure(pContext, &pContext->config);
2804 if(pContext->EffectType == LVM_BASS_BOOST){
2821 p->status = android::BassBoost_getParameter(pContext,
2835 if(pContext->EffectType == LVM_VIRTUALIZER){
2852 p->status = android::Virtualizer_getParameter(pContext,
2865 if(pContext->EffectType == LVM_EQUALIZER){
2884 p->status = android::Equalizer_getParameter(pContext,
2898 if(pContext->EffectType == LVM_VOLUME){
2916 p->status = android::Volume_getParameter(pContext,
2933 if(pContext->EffectType == LVM_BASS_BOOST){
2962 *(int *)pReplyData = android::BassBoost_setParameter(pContext,
2966 if(pContext->EffectType == LVM_VIRTUALIZER){
2995 *(int *)pReplyData = android::Virtualizer_setParameter(pContext,
2999 if(pContext->EffectType == LVM_EQUALIZER){
3015 *(int *)pReplyData = android::Equalizer_setParameter(pContext,
3019 if(pContext->EffectType == LVM_VOLUME){
3036 *(int *)pReplyData = android::Volume_setParameter(pContext,
3050 *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_TRUE);
3059 *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
3067 if (pContext->EffectType == LVM_BASS_BOOST) {
3079 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
3082 android::LvmEffect_disable(pContext);
3084 pContext->pBundledContext->bBassTempDisabled = LVM_TRUE;
3092 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
3095 android::LvmEffect_enable(pContext);
3097 pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
3100 if (pContext->EffectType == LVM_VIRTUALIZER) {
3112 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
3115 android::LvmEffect_disable(pContext);
3117 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE;
3125 if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){
3128 android::LvmEffect_enable(pContext);
3130 pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
3181 //pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
3182 //(int32_t)maxdB, maxVol<<7, pContext->EffectType);
3188 android::VolumeSetVolumeLevel(pContext, (int16_t)(maxdB*100));
3191 LvmStatus =LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
3200 LvmStatus =LVM_SetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
3219 EffectContext * pContext = (EffectContext *) self;
3222 if (pContext == NULL || pDescriptor == NULL) {
3227 switch(pContext->EffectType) {