共用方式為


IDirectMusicPort8 Interface

The IDirectMusicPort8 interface represents a device that sends or receives sound data. Examples are the input port of an MPU-401, the output port of an MPU-401, the Microsoft software synthesizer, and an IHV-provided filter. A physical device such as an MPU-401 might provide multiple ports. A single port, however, cannot both capture and render data.

IDirectMusicPort8 is a define for IDirectMusicPort. The two interface names are interchangeable.

The interface is typically obtained by using the IDirectMusic8::CreatePort method.

For an overview, see Using DirectMusic Ports.

In addition to the methods inherited from IUnknown, the IDirectMusicPort8 interface exposes the following methods, arranged by category.

Buffers

Method Description
PlayBuffer Cues a buffer for playback by the port.
Read Fills a buffer with incoming MIDI data.
SetReadNotificationHandle Specifies an event that is to be set when MIDI messages are available to be read with the Read method.

Devices

Method Description
Activate Activates or deactivates the port.
DeviceIoControl Calls the Win32 DeviceIoControl function on the underlying file handle implementing the port.
SetDirectSound Overrides the default DirectSound device object or buffer, or both, to which a port's waveform data is streamed.

DLS data

Method Description
Compact Instructs the port to compact DLS or wave-table memory, thus making the largest possible contiguous chunk of memory available for new instruments to be downloaded.
DownloadInstrument Downloads an instrument to the DLS device.
UnloadInstrument Unloads a previously downloaded DLS instrument.

Information retrieval

Method Description
GetCaps Retrieves the port's capabilities.
GetFormat Retrieves information about the WAV format specified in the DMUS_PORTPARAMS8 structure passed to IDirectMusic8::CreatePort, and the recommended size of the buffer to use for waveform output.
GetLatencyClock Retrieves a pointer to the port's latency clock.
GetRunningStats Retrieves information about the state of the synthesizer.

MIDI Channels

Method Description
GetChannelPriority Retrieves the priority of a MIDI channel.
GetNumChannelGroups Retrieves the number of channel groups on the port.
SetChannelPriority Sets the priority of a MIDI channel.
SetNumChannelGroups Changes the number of channel groups that the application needs on the port.

The LPDIRECTMUSICPORT8 type is defined as a pointer to the IDirectMusicPort8 interface.

typedef IDirectMusicPort8 *LPDIRECTMUSICPORT8;

Requirements

**  Header:** Dmusicc.h

See Also

© 2004 Microsoft Corporation. All rights reserved.