Re: Actual sound playing position in DirectShow applications

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Chris P. [MVP] (msdn_at_chrisnet.net)
Date: 11/10/04


Date: Wed, 10 Nov 2004 09:20:43 -0500

On Mon, 8 Nov 2004 23:30:03 -0800, Andrey Zharkikh wrote:

> Hello,
>
> I'm writing application where is very critical to know actual audio
> playing position (I'm developing karaoke player). As a matter of fact this
> position is different from position in source file/stream which I can learn
> with GetCurrentPosition method of IMediaSeeking interface of graph. I think
> it is different since preloading, buffering, etc. mechanisms. Another fact
> that timing delta between actual playing music and time reported by
> GetCurrentPosition changing if I change it with m_pMS->SetPositions(&pos,
> AM_SEEKING_AbsolutePositioning , NULL, AM_SEEKING_NoPositioning). What I want
> to learn is position of actially playing data on output sound device or
> possibly actually finished playing sample. What I tried:
> 1) GetCurrentPosition of IMediaSeeking interface
> 2) Put sample grabber before audio rendersing filter into graph and learn
> samples sent to output device implementing ISampleGrabberCB and calling
> GetTime for each coming sample.

There are often problems with the accuracy if
IMediaSeeking::GetCurrentPosition(). You can try using the IMediaPosition
interface of the audio renderer, but I think the results will be the same.
Are you using the DirectSound renderer?

Tricks to try would be to
1) Reduce the audio buffer size, default is 1/2 second per buffer. An easy
way is to insert a transform filter that requests a smaller buffer size.
But I think there is another way through the Graph Manager?
2) As a last resort create a custom renderer. You will have full control
over the audio playback and will always know the exact playing position.



Relevant Pages

  • Jon Ds 2 audio clips for our esteemed perusal
    ... This is in response to a thread that Jon started on December 18 titled "2 audio clips for your esteemed perusal" I finally got around to playing with the unprocessed mp3 a little. ... can make things sound thin and distant, but compression and limiting can ...
    (rec.music.makers.guitar.jazz)
  • Re: Question for users of K&K PWM p/u
    ... this is Internet audio (and video). ... Hank say there is better gear. ... As is, for my meager attempts at "playing out", I can't justify a ...
    (rec.music.makers.guitar.acoustic)
  • Re: Question for users of K&K PWM p/u
    ... "Ty Ford" wrote in message ... this is Internet audio (and video). ... As is, for my meager attempts at "playing out", I can't justify a ...
    (rec.music.makers.guitar.acoustic)
  • Re: Compaq Armada 1520DM Laptop CD Rom Drive Problem
    ... ago, it started to have difficultly reading a CD rom, or playing an audio ... "playing" (audio) the CD. ...
    (sci.electronics.repair)
  • Sequential Playing of Buffers
    ... I am writing an application that combines audio from a number of sources. ... audio card that should be played as if they come from one big buffer. ... Is it possible to line up secondarybuffers and have them play one after ... and playing on the big buffers, but I am not sure even what to search for. ...
    (microsoft.public.win32.programmer.directx.audio)