Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Audio Processing Questions (2)

Audio Processing Questions (2)

Scheduled Pinned Locked Moved C / C++ / MFC
question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Akin Ocal
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups