Master Clock

DirectMusic

Microsoft DirectX 9.0 SDK Update (Summer 2004)

Master Clock

To guarantee accurate timing with an acceptably low latency, DirectMusic incorporates a master clock in kernel mode. This clock is based on a hardware timer. DirectMusic automatically selects the system clock as the master clock, but an application can select a different one, such as the wave-out crystal on a sound card.

The master clock is a high-resolution timer that is shared by all processes, devices, and applications that are using DirectMusic. The clock is used to synchronize all audio playback in the system. It is a standard IReferenceClock interface. The IReferenceClock::GetTime method returns the current time as a 64-bit integer (defined as the REFERENCE_TIME type) in increments of 100 nanoseconds.

To obtain an interface to the master clock, call the IDirectMusic8::GetMasterClock method.

You can choose a different master clock for your application, but only if there are no other DirectMusic applications running. First, you get descriptions of all devices that can serve as the master clock by using the IDirectMusic8::EnumMasterClock method. After you have obtained the GUID of the device that you want to use as the master clock, pass it to the IDirectMusic8::SetMasterClock method.


© 2004 Microsoft Corporation. All rights reserved.