////////////////////////////////////////////////////////////////////////////// // Data output bool CWaveOut::Output(float *pData, int nSamples, int scaleFactor) { // routine check if ((pData == NULL)|| (nSamples < 1)) return(false); // have we started ? if (m_Dev == NULL) return(false); // have we free block ? if ((m_B[m_Idx].dwFlags & WHDR_INQUEUE) == WHDR_INQUEUE) return(false); // if we have too much samples, cut it if (nSamples > m_MaxBlockSamples) nSamples = m_MaxBlockSamples; // convert data into shorts ippsConvert_32f16s_Sfs((Ipp32f *)pData, (Ipp16s *)m_B[m_Idx].lpData, nSamples*m_Fmt.nChannels, ippRndNear, scaleFactor); // set right data length m_B[m_Idx].dwBufferLength = m_Fmt.nBlockAlign * nSamples; // schedule it to play if (waveOutWrite(m_Dev, m_B+m_Idx, sizeof(m_B[m_Idx])) != MMSYSERR_NOERROR) return(false); // goto to the next block m_Idx = (m_Idx + 1) % m_nBlock; // success return(true); }
static USC_Status CancelEcho(USC_Handle handle, short *pSin, short *pRin, short *pSout) { ECFP_Handle_Header *ecfp_header; USC_Handle *obj_ec; int framesize; Ipp32f r_in_32f_cur[MAX_BLOCK_SIZE]; Ipp32f s_in_32f_cur[MAX_BLOCK_SIZE]; Ipp32f s_out_32f_cur[MAX_BLOCK_SIZE]; if(handle==NULL) return USC_InvalidHandler; if(pSin==NULL) return USC_BadDataPointer; if(pRin==NULL) return USC_BadDataPointer; if(pSout==NULL) return USC_BadDataPointer; ecfp_header = (ECFP_Handle_Header*)handle; obj_ec = (USC_Handle*)((char*)handle + sizeof(ECFP_Handle_Header)); if(ecfp_header->algType == EC_SUBBAND) framesize = SUBBAND_FRAME_SIZE; else if(ecfp_header->algType == EC_FULLBAND) framesize = FULLBAND_FRAME_SIZE; else framesize = FASTSBBAND_FRAME_SIZE; ippsConvert_16s32f_Sfs((Ipp16s *)pRin, r_in_32f_cur, framesize, 0); ippsConvert_16s32f_Sfs((Ipp16s *)pSin, s_in_32f_cur, framesize, 0); ecfp_header->fun.ec_ProcessFrame(obj_ec, r_in_32f_cur, s_in_32f_cur, s_out_32f_cur); ippsConvert_32f16s_Sfs(s_out_32f_cur, (Ipp16s *)pSout, framesize, ippRndZero, 0); return USC_NoError; }
static USC_Status CancelEcho(USC_Handle handle, Ipp16s *pSin, Ipp16s *pRin, Ipp16s *pSout) { ECFP_Handle_Header *ecfp_header; USC_Handle *obj_ec; Ipp32s framesize; Ipp32f r_in_32f_cur[MAX_BLOCK_SIZE]; Ipp32f s_in_32f_cur[MAX_BLOCK_SIZE]; Ipp32f s_out_32f_cur[MAX_BLOCK_SIZE]; //Ipp64f noisePwr; //int dstFlag,j; if(handle==NULL) return USC_InvalidHandler; if(pSin==NULL) return USC_BadDataPointer; if(pRin==NULL) return USC_BadDataPointer; if(pSout==NULL) return USC_BadDataPointer; ecfp_header = (ECFP_Handle_Header*)handle; obj_ec = (USC_Handle*)((Ipp8s*)handle + ALIGN(sizeof(ECFP_Handle_Header))); framesize = FRAME_SIZE_10ms; ippsConvert_16s32f_Sfs((Ipp16s *)pRin, r_in_32f_cur, framesize, 0); ippsConvert_16s32f_Sfs((Ipp16s *)pSin, s_in_32f_cur, framesize, 0); //if (ecfp_header->dcFlag) //{ // ippsSubC_32f_I(ecfp_header->dcOffset,s_in_32f_cur, framesize); // for (j=0;j<framesize;j+=16){ // ippsFilterNoiseDetect_EC_32f64f((const Ipp32f *)&s_in_32f_cur[j],&noisePwr, // &ecfp_header->dcOffset,&dstFlag,ecfp_header->nrSin); // } //} ecfp_header->fun.ec_ProcessFrame(obj_ec, r_in_32f_cur, s_in_32f_cur, s_out_32f_cur); ippsConvert_32f16s_Sfs(s_out_32f_cur, (Ipp16s *)pSout, framesize, ippRndZero, 0); return USC_NoError; }