Audio Processing Questions (2)
-
Hi , sorry for a new thread. I needed to open it since I made some progress. By the way , I implemented my callback function without buffering as below. So can you check it ? Especially I am not sure about getting floats from BYTEs and , replacing new floats back after making some signal processing. STDMETHODIMP BufferCB( double SampleTime, BYTE * pBuffer, long BufferSize ) { unsigned int i,j ; short nCurrentSampleValue = 0 ,temp = 0; float fCurrentSampleValue = 0,fNewSampleValue =0 ; long nSampleCount ; short nRatioOfDataTypes ; nRatioOfDataTypes = sizeof(short)/sizeof(BYTE) ; nSampleCount = BufferSize / nRatioOfDataTypes; for(i=0;i<nSampleCount;i++) { nCurrentSampleValue = 0 ; fCurrentSampleValue = 0 ; for(j=0;j<nRatioOfDataTypes ;j++) { temp = 0x0000 ; temp = ((short)pBuffer[i*nRatioOfDataTypes+j]) ; temp = temp << (8*(nRatioOfDataTypes-j-1)) ; nCurrentSampleValue |= temp ; fCurrentSampleValue = ((float)nCurrentSampleValue) / 32768 ; } fNewSampleValue = MAKE_SOME_SIGNAL_PROCESS(fCurrentSampleValue); //////////////////////////////////////////// temp = (short) (fNewSampleValue*32768); pBuffer[i*nRatioOfDataTypes] = (BYTE) (temp & 0xFF00) ; pBuffer[i*nRatioOfDataTypes+1] = (BYTE) (temp & 0x00FF) ; //////////////////////////////////////////// } } Finally can you send me any sample code for buffering or make any suggestion about that ? Thank you very much... Best Regards