Microsoft DirectX 9.0 |
Description
This sample filter shows how to implement a reference clock. The filter uses your default microphone input to listen for audio spikes (such as clicks, hand claps, or coughs), which it uses to determine a clock rate.
Path
Source: (SDK root)\Samples\C++\DirectShow\Filters\Metronome
User's Guide
After building the filter, copy the filter DLL (Metronom.ax) to your Windows system directory. Run the Metronom.reg file to register the DLL.
To use the filter:
Programming Notes
This filter works only for video. The audio renderer is not capable of synchronizing to radically different clock rates.
If you clap 92 times per minute (once every ~652 ms), the video will play at the normal rate. You can change this default by changing the value of the constant BPM
in Metronom.cpp.
If you stop clapping for a period of time and then start clapping again, you must start again at approximately the same speed, or the filter will ignore it. Also, the video playback rate is limited by the CPU speed. If you exceed the limit for any length of time, the filter will stop responding to rate changes. If this happens, stop the graph and restart.
If you implement your own clock, the most important rules is that reference clocks must not go backwards. That is, they must never report a time value less than the previous time value.
See Also