Previous Next

IAllocatorMXF

The IAllocatorMXF interface manages buffer storage for DirectMusic streams. This interface is implemented by the DMus port driver and exposed to the DMus miniport driver. The DMus port driver creates an IAllocatorMXF object and passes a pointer to this object to the DMus miniport driver's IMiniportDMus::NewStream method. IAllocatorMXF inherits from the IMXF interface.

IAllocatorMXF is the interface through which the miniport driver communicates with the port driver's internal allocator, which allocates and manages the reuse of a pool of DMUS_KERNEL_EVENT structures. Each structure can contain a time-stamped MIDI event.

The allocator also abstracts the allocation of the additional memory that is needed to store large events. The uData member of DMUS_KERNEL_EVENT is a union that is the size of a pointer: four bytes on a 32-bit system and eight bytes on a 64-bit system. If the data is small enough to fit in that space, then uData will contain the actual MIDI data. If the data for that event is larger than the four- or eight-byte pointer, however, the cbEvent member indicates this fact and uData contains a pointer to a buffer instead of the actual MIDI data. This buffer is managed by the allocator and is a constant size for any port-driver implementation.

In addition to the methods that AllocatorMXF inherits from the IMXF interface, IAllocatorMXF supports the following methods:

IAllocatorMXF::GetMessage

IAllocatorMXF::GetBufferSize

IAllocatorMXF::GetBuffer

IAllocatorMXF::PutBuffer