Microsoft DirectX 8.1 (C++)

IDirectMusicPerformance8::AddPort

The AddPort method assigns a port to the performance. This method is valid only for performances that do not use audiopaths; that is, performances initialized by using IDirectMusicPerformance8::Init.

Syntax

HRESULT AddPort(
  IDirectMusicPort* pPort
);

Parameters

pPort

Address of a variable that contains the port to add. If NULL, the default port is added. See Remarks.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the error values shown in the following table.

Return code
DMUS_E_CANNOT_OPEN_PORT
DMUS_E_NOT_INIT
E_OUTOFMEMORY
E_POINTER

Remarks

When the default port is specified by passing NULL in pPort, it is assigned one channel group. If no performance channels have been set up for any other port, channels 0 through 15 are assigned to MIDI channels 0 through 15.

If pPort is not NULL, it must be a port created by the same DirectMusic object that was passed to, or created by, IDirectMusicPerformance8::Init. The port must be activated by a call to IDirectMusicPort8::Activate, and a block of channels must be assigned by a call to IDirectMusicPerformance8::AssignPChannelBlock.

This method creates a reference to IDirectMusicPort8 that is released by IDirectMusicPerformance8::RemovePort or IDirectMusicPerformance8::CloseDown. However, if NULL is passed to AddPort, the port cannot be removed by RemovePort, because the application has no reference to pass to RemovePort.

Requirements

  Header: Declared in dmusici.h.

See Also