/* ========================================================================= */ void SPE_CustomProcess_Off() { if(spe_custom->state != SPE_STATE_WORKING) return; spe_custom->state = SPE_STATE_IDLE; #if 1 PCM4WAY_Stop(0); #else /* under construction !*/ #endif #if defined(__INTERNAL_SPE_ENGINE__) ENH_API_Free(); #elif defined( __VOICE_CHANGER_SUPPORT__ ) VCHG_Close(); if(VCHIsDcmLoad) { DCM_Unload(DYNAMIC_CODE_COMPRESS_VCH); VCHIsDcmLoad = KAL_FALSE; } kal_trace( TRACE_GROUP_AUD_SPE_CSUT, SPEECH_VCH_PROCESS, 0, VCHIsDcmLoad); #endif L1Audio_ClearFlag(spe_custom->aud_id); L1Audio_FreeAudioID(spe_custom->aud_id); if(spe_custom->working_buffer != NULL) audio_free_mem((void **)&(spe_custom->working_buffer)); audio_free_mem((void **)&spe_custom); spe_custom = NULL; }
OMX_ERRORTYPE AudioDrain_Free(MHPB_Internal *ihdl) { kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_DRAIN_FREE, ihdl, 0,0,0,0,0); #if defined(__BES_TS_SUPPORT__) if (ihdl->TSNode.curHdl != NULL) { ihdl->TSNode.curHdl->Deinit(ihdl->TSNode.curHdl); ihdl->TSNode.curHdl = NULL; pBesTS_AudComHdl = NULL; } #endif if (ihdl->APMNode.curHdl != NULL) { ihdl->APMNode.curHdl->Deinit(ihdl->APMNode.curHdl); ihdl->APMNode.curHdl = NULL; } if (ihdl->SinkNode.curHdl != NULL) { ihdl->SinkNode.curHdl->Deinit(ihdl->SinkNode.curHdl); ihdl->SinkNode.curHdl = NULL; } ASSERT(ihdl->pAudioDrainAllocBuf); audio_free_mem( (void **) &ihdl->pAudioDrainAllocBuf); ihdl->pAudioDrainAllocBuf = NULL; return OMX_ErrorNone; }
static Media_Status GenCompRecClose( MHdl *hdl ) { MHPB_Internal *ihdl = (MHPB_Internal *)hdl; kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_CLOSE, hdl->mediaType, hdl, hdl->state,0,0,0,0,0); ASSERT( hdl != 0 ); if (hdl->state == COMPONENT_STATE_PLAY) { hdl->Stop(hdl); } // Deinit component { AcHdlNode *pNode = ihdl->pNodeStart; while (pNode) { pNode->curHdl->Deinit( pNode->curHdl ); if (pNode->pAllocBuf) { audio_free_mem( (void **) &pNode->pAllocBuf); } pNode = pNode->pNextNode; } } // Wav only if (ihdl->pPublicInfo) { free_ctrl_buffer( ihdl->pPublicInfo ); } // Free memory if (ihdl->pAllocBuf) { if (ihdl->fIspAllocBufOnMED) { audio_free_mem( (void **) &ihdl->pAllocBuf); } else { free_ctrl_buffer(ihdl->pAllocBuf); ihdl->pAllocBuf = NULL; } } mhdlFinalize(hdl, NULL); free_ctrl_buffer( hdl ); return MEDIA_SUCCESS; }
static void dtmf_mcu_Destroy(kal_uint32 arg1, void* arg2) { kal_bool fIsAudioRunning = false;//PcmSink_IsAudioRuning() || PcmSink_IsMixerRuning(); kal_trace( TRACE_GROUP_AUD_PLAYBACK, MCU_DTMF_DESTROY, DTMF_SW.pHandle, DTMF_SW.fNewDTMF, DTMF_SW.fEnding, DTMF_SW.fForceStop); if(DTMF_SW.pHandle == NULL) { return; } if((DTMF_SW.fNewDTMF == KAL_FALSE && DTMF_SW.fEnding == KAL_TRUE) || DTMF_SW.fForceStop) { { { // void AM_SWToneOff( void ); // AM_SWToneOff(); } } DTMF_SW.pHandle = NULL; L1Audio_ClearFlag( DTMF_SW.uAudId); L1Audio_FreeAudioID(DTMF_SW.uAudId); audio_free_mem( (void **) &DTMF_SW.RingBuffer.rb_base);// DTMF_SW.RingBuffer.rb_base = NULL; if(fIsAudioRunning) { ////! PcmSink_Mute(KAL_TRUE, PCMSINK_MUTE_TONE); kal_sleep_task(uDtmfMuteLength3); } if(DTMF_SW.fIsKeytonePlaying) { ////! PcmSink_StopSound(PCM_FUNC_KEYTONE); } else if(DTMF_SW.fIsTonePlaying) { ////! PcmSink_StopSound(PCM_FUNC_TONE); } else { ASSERT(0); } memset(&DTMF_SW, 0, sizeof(DTMF_SW)); if(fIsAudioRunning) { kal_sleep_task(uDtmfMuteLength4); } ////! PcmSink_DepopUnMute( NULL ); ////! PcmSink_Mute(KAL_FALSE, PCMSINK_MUTE_TONE); } }
static void UnhookAndDeconstructComponent( MHPB_Internal *ihdl, AcHdlNode **pNode) { kal_int32 I; AcHdlNode *pPrevNode, *pNextNode, *pCurNode; // To check node pCurNode = *pNode; for (I=0; I<MAX_COMPONENT_LIST_SIZE; I++) { if (pCurNode == &ihdl->NodeArray[I]) break; } ASSERT(I < MAX_COMPONENT_LIST_SIZE); ASSERT( ihdl->fNodeUsed[I] ); // Deconstruct pCurNode->curHdl->Deinit(pCurNode->curHdl); audio_free_mem( (void **) &pCurNode->pAllocBuf); // Adjust linked list pPrevNode = pCurNode->pPrevNode; pNextNode = pCurNode->pNextNode; if (pNextNode) { if (pPrevNode) pNextNode->prev = pPrevNode->curHdl; else pNextNode->prev = NULL; pNextNode->pPrevNode = pPrevNode; } else { ihdl->pNodeEnd = pPrevNode; } if (pPrevNode) { if (pNextNode) pPrevNode->next = pNextNode->curHdl; else pPrevNode->next = NULL; pPrevNode->pNextNode = pNextNode; } else { ihdl->pNodeStart = pNextNode; } // Mark as unused ihdl->fNodeUsed[I] = KAL_FALSE; ihdl->numComp--; *pNode = NULL; }
void AVB_Close() { kal_uint16 uSampleRate; kal_uint8 uChannelNumber; kal_trace( TRACE_GROUP_SCO, L1AUDIO_AVB_CLOSE, AVB.uState); PcmSink_StopBT(PCMSINK_BT_SCO); if(AVB.uState == AVB_STATE_IDLE) { return; } L1Audio_UnhookHisrHandler(D2C_AUDIO_VIA_8KBT_ID); L1Audio_ClearFlag( AVB.uAudID ); //enable sleep mode L1Audio_FreeAudioID(AVB.uAudID); AVB.uState = AVB_STATE_IDLE; audio_free_mem( (void **) &AVB.pBuffer); BLI_Close(AVB.pBuffer, audio_free_ext_mem_simplified); uSampleRate = AVB.uSampleRate; uChannelNumber = AVB.uChannelNumber; memset(&AVB, 0, sizeof(AVB)); AVB.uSampleRate = uSampleRate; AVB.uChannelNumber = uChannelNumber; }
static Media_Status GenCompClose( MHdl *hdl ) { MHPB_Internal *ihdl = (MHPB_Internal *)hdl; kal_int32 I; kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_CLOSE, hdl->mediaType, hdl, hdl->state,0,0,0,0,0); ASSERT( hdl != 0 ); if(hdl->state == COMPONENT_STATE_PLAY) { hdl->Stop(hdl); } // Deinit component for (I=ihdl->numComp-1; I>=0; I--) { ihdl->NodeArray[I].curHdl->Deinit(ihdl->NodeArray[I].curHdl); } // Wav only if (ihdl->pPublicInfo) { free_ctrl_buffer( ihdl->pPublicInfo ); } // Free memory if (ihdl->pAllocBuf) { if (ihdl->fIspAllocBufOnMED) { audio_free_mem( (void **) &ihdl->pAllocBuf); } else { free_ctrl_buffer(ihdl->pAllocBuf); ihdl->pAllocBuf = NULL; } } mhdlFinalize(hdl, NULL); free_ctrl_buffer( hdl ); return MEDIA_SUCCESS; }
void audio_free_ext_mem_simplified(void *ptr) { audio_free_mem( &ptr ); }