DirectX SDK

Core Objects and Interfaces

[Visual Basic]

The information in this topic pertains only to applications written in C++. See Overview of DirectMusic Classes.

[C++]

The core objects handle the basic needs of DirectMusic: input, output, and timing. These objects are usually managed by other objects, such as DirectMusicPerformance, and you might never need to use their interfaces directly.

DirectMusic Object

The DirectMusic object, represented by the IDirectMusic interface, is used for creating ports and buffers, for connecting with DirectSound, and for setting up a master clock. There should not be more than one instance of this object per application.

Many applications never need to use the IDirectMusic interface directly. In this respect, it differs from other DirectX base interfaces. For example, IDirectSound is the starting point for every DirectSound application, performing essential tasks such as setting the cooperative level and creating sound buffers. In DirectMusic, most initialization is handled by other objects, such as DirectMusicPerformance, and these objects are created independently by direct calls to CoCreateInstance.

Port

Each device that sends or receives music data is encapsulated in a DirectMusicPort object. The methods of the IDirectMusicPort interface allow direct manipulation of the port, but most applications do not need to use these methods because the port is managed by the performance. For example, you assign channels to a port through the DirectMusicPerformance object so that data in those channels is correctly routed.

Buffer

The IDirectMusicBuffer interface represents the data currently ready to be played by the port (or read from the port). Most applications do not deal directly with the buffer object, but methods are available to manipulate its contents directly, if necessary.

Thru

The IDirectMusicThru interface is used to set up direct transmission of data from a capture port to another port.

Reference Clock

Objects that implement the IReferenceClock interface represent the master clock that synchronizes all DirectMusic activity and the latency clock of a port.