Microsoft DirectX 8.0 (C++) |
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.
HRESULT AddPort( IDirectMusicPort* pPort );
If the method succeeds, the return value is S_OK.
If it fails, the method can return one of the following error values:
DMUS_E_NOT_INIT |
DMUS_E_CANNOT_OPEN_PORT |
E_OUTOFMEMORY |
E_POINTER |
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.
Header: Declared in dmusici.h.