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 Signal Processing using Directshow(ISampleGrabber) - 2

Audio Signal Processing using Directshow(ISampleGrabber) - 2

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformancediscussion
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

    Hello , I wanted to re-ask my previos question , since I made some progress. And I want to clear some stuff in my head. 1. BUFFERING "STEREO" STREAMS : I use the code below . Generally 8000 bytes passed to callback function. Since my each sampleis 16bit , that is about 4000 samples for each call. So I defined CHANNEL_SIZE as 2048 which is approriatefor total sample count. I made it 2048 as power of 2 because I will implement FFT . What do you think about that buffering approach ? ................................................. #define CHANNEL_SIZE 2048 double leftChannel[CHANNEL_SIZE] ; double rightChannel[CHANNEL_SIZE] ; .................................................................. STDMETHODIMP BufferCB( double SampleTime, BYTE * pBuffer, long BufferSize ) { unsigned int nSampleCount = BufferSize/2 ; short* pStream = (short *) pBuffer ; for( i = 0;i<nSampleCount/2 ; i++) { leftChannel[i] = ((double)(*pStream)) ; pStream++ ; rightChannel[i] = ((double)(*pStream)) ; pStream++ ; } } 2. MULTITHREADING : Can you compare using sample grabber and creating threads for signal processing for performance (especially CPU usage ) ? In my first approach , I created thread for FFT since my FFT task didnt include changing samples , it was just about spectral analysis. 3. DATA FORMATS, CONVERSIONS : I get my each sample as 16 bit. When I looked some DXSDK9 audio samples , they declare "signed" shorts for samples. So I am confused about declaring sample variables as signed , since they can store negative values. Also I have question marks about getting double or float values from shorts , and replacing shorts with new floats or doubles after making some signal processing. I can understand dividing short values by 32768(2^16 / 2 ). But what about "vice-versa" ? Thank you very much for reading, BEST REGARDS, Akin Ocal

    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