IDirectMusicBuffer::PackUnstructured

The IDirectMusicBuffer::PackUnstructured method inserts unstructured data (typically a MIDI system exclusive message), along with timing and routing information, into the buffer.

HRESULT PackUnstructured(
  REFERENCE_TIME rt, 
  DWORD dwChannelGroup,
  DWORD cb, 
  LPBYTE lpb
);
 

Parameters

rt
Absolute time of the message.
dwChannelGroup
Channel group to which the message belongs.
cb
Size of the data, in bytes.
lpb
Pointer to the data.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method may return one of the following error values:

E_OUTOFMEMORY
E_POINTER

Remarks

This method can be used to send any kind of data to the port.

At least 28 bytes (the size of DMUS_EVENTHEADER) plus the size of the data, padded to a multiple of four bytes, must be free in the buffer. The buffer space required can be obtained by using the macro DMUS_EVENT_SIZE(cb), where cb is the size of the data.

The rt parameter must contain the absolute time at which the data is to be sent to the port. To play a message "now," retrieve the time from the latency clock and use this as rt. See IDirectMusicPort::GetLatencyClock.

Messages stamped with the same time do not necessarily play in the same order in which they were placed in the buffer.

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusicc.h.

See Also

IDirectMusicBuffer::PackStructured