Re: SampleGrabber Buffer Sync to audio

On 19 Apr 2006 06:48:49 -0700, DiegoMol wrote:

OK, was really usefull to ask to the people of this group, thanks for
the quick and nice help.-

1.- i've done the code to run on VB, all is working
2.- i got the sample information from songs and i'm reading it.-
3.- all is workign in a nice way, and the result from each element on
the buffer array is between -32728 - +32728

actually my VU meter is working, and i'm using a formula to get the DB

decibels = 20 * Log10(channelvalue/ 32768.0)

i'm using ISampleGrabberCB.BufferCB setting teh callback or the
ISampleGrabber.GetCurrentBuffer as well, i actually have tested the
buffers from both sources
BUT!! how to sync the buffer with the audio that i'm listening?

playing 44100 stereo wav files of 16 bits i know that we have 176400
and reading as example 1764 samples each 10 ms.- is not sync at all.-

Yes, this is probably the trickiest part. You can get a little closer by
reducing the size of the buffers. The only highly accurate way is to know
the renderer's current play cursor position, but unfortunately you don't
have access to this in DirectShow. You could attach time stamps to each of
your VU meter samples and either render them as a image stream to a video
renderer or simply hold the rendering of the VU samples until the specified
reference time.


Relevant Pages

  • Re: 3D Graphs
    ... First thing I tried was creating a mesh with two triangles ... That's a large number of primitives to render per ... What format depth buffer are you using, and what near and far plane ...
  • Re: Newbie: Mulitple meshes or World transforms
    ... > render the shapes. ... index buffer data around etc. Ideally you want as much geometry to be ... Transform all the geometry yourself into a dynamic vertex buffer. ... use all the vertex shader registers for anything. ...
  • [PATCH] PRINTK: Decouple input locking from output locking and move render outside lock
    ... ring buffer, and move the render and processing (log level token ... read out to be fed to the console drivers. ... Instead of a single render buffer, vprintkhas two render buffers per ... static int console_locked, console_suspended; ...
  • Re: custom audio renderer glitch
    ... are there any disadvantages dereived from CBaseRender? ... is copied immediately to the audio buffer and released. ... from the actual audio render position. ...
  • Re: [PATCH resend 5/9] MIPS: sync after cacheflush
    ... Add a SYNC instruction to ensure that the ... Buffered writeback data finally gets flushed out to DRAM ... This patch adds SYNC between steps 3 and 4, ... such systems with that 'deep' write buffer and data incoherency is ...