locked
How to render audio samples RRS feed

  • Question

  • Hi Everybody.

    I managed to use the sample grabber and get samples of a video stream of a webcam. I took the samples and draw them in the VMR9 BitmapMix.

    Now, I would like to do the same thing with the audio stream of the webcam. I managed to get the audio samples but now I am wondering how to render them??

    Because with the video there is an Device Context to draw the frame but what is the equivalent in audio.

    Thanks in advance for your further advise.
    Wednesday, August 8, 2007 9:29 AM

Answers

  • Yes, you can use the Push source sample, it's pretty much the same thing that was in the Wizard anyway.  Just remember to generate new GUID values for the filter at some point.

    Friday, August 17, 2007 3:52 PM

All replies

  • I don't understand.  Audio samples can be passed directly the audio renderer, either the DirectSound version or the winMM version.

     

    If you're "grabbing" audio samples using the sample grabber your going to have to describe what you are really trying to achieve here.

    Wednesday, August 8, 2007 5:06 PM
  • Hi thanks for the answer.

    I wanted to know how I could render the audio sample which is put into a buffer (type char * buffer) with ISampleGrabber interface? Because, I plan to send this buffer through winsock2 from a server computer to a client computer, and render it on this client computer.
    I was wondering what was the method to render this audio sample which is contained in the received buffer? If you use DirectSound version, what is the function you use which could take in parameter this buffer?

    Thanks in advance for your help.
    Thursday, August 9, 2007 7:52 AM
  •  

    You could use DirectSound (see my website for samples) or you can use DirectShow.  With the DirectShow method you would write a source filter that populates a sample with the data received.  Provided you have set the sample type correctly (format block etc) to the same that was on the sender side it will be decoded (if necessary) and rendered to the DirectShow audio renderer.

     

    Client Graph:

    Custom Source -> [ Decoder ] -> Audio Renderer

    Thursday, August 9, 2007 8:37 PM
  • Hi thanks for the answer.

    I see what you mean and I had a look at your sample codes. And I think that I would be more interested by a DirectShow version of your program. The problem is that I have never written a source filter by myself, so do you where to find an example code for writting such kind of filter? Because I will need the same kind of filter for video samples also.

    Thanks a lot.
    Tuesday, August 14, 2007 7:48 AM
  • You can use the DirectShow filter wizard from here under VS 2003 but it doesn't work in 2005.

    http://tmhare.mvps.org/downloads.htm

     

    It builds a push source sample for a video type, and can be easily modified to push video frames from another source or of a different type.

     

    Likewise the sample can be modified to push audio types, I can help you with that part.

     

    Tuesday, August 14, 2007 3:45 PM
  • Hi Chris. Thank you very much for your help.

    Unfortunately, I program under VC 2005 and the DSWizard seems not working on it.

    I think I have heard about a push source sample code for video. I'll try to find that and see if it's possible to modify it. I think that I will need your help soon for that.

    Regards
    Thursday, August 16, 2007 7:55 AM
  • Yes, you can use the Push source sample, it's pretty much the same thing that was in the Wizard anyway.  Just remember to generate new GUID values for the filter at some point.

    Friday, August 17, 2007 3:52 PM