Edit

KSPROPERTY_MIDILOOPEDSTREAMING_NOTIFICATION_EVENT

The KSPROPERTY_MIDILOOPEDSTREAMING_NOTIFICATION_EVENT is used to provide the read and write events for the looped buffer to the driver. The driver adds a reference to the handle for that event and stores it.

The following table summarizes the features of this property.

Usage Summary Table

Get Set Target Property descriptor type Property value type
Yes Yes Pin KSPROPERTY KSMIDILOOPED_EVENT2

The property descriptor type is KSPROPERTY. The property value type is KSMIDILOOPED_EVENT2 (which replaces KSMIDILOOPED_EVENT) containing the read and write events.

Return Value

A KSPROPERTY_MIDILOOPEDSTREAMING_NOTIFICATION_EVENT property request returns STATUS_SUCCESS to indicate successful completion. Otherwise, the request returns an appropriate failure status code. The following table shows some of the possible failure status codes.

Status code Meaning
STATUS_ALREADY_INITIALIZED The events are already set.
STATUS_ALREADY_INITIALIZED KSPROPERTY_MIDILOOPEDSTREAMING_BUFFER was called by a different process than the one attempting to configure the notification events.
STATUS_DEVICE_NOT_READY The device isn't ready
STATUS_INSUFFICIENT_RESOURCES Memory for the buffer can't be allocated.
STATUS_UNSUCCESSFUL A cyclic buffer with the specified combination of buffer attributes can't be allocated.

Remarks

KSPROPERTY_MIDILOOPEDSTREAMING_NOTIFICATION_EVENT takes in a caller created event handle in a KSMIDILOOPED_EVENT structure. The driver adds a reference to the handle for that event and stores it.

Sample Code

    HRESULT
    LoopedEventCall(
        _In_ HANDLE WriteEvent,
        _In_ HANDLE ReadEvent
    )
    {
        KSPROPERTY property {0};
        ULONG propertySize {sizeof(property)};
        KSMIDILOOPED_EVENT2 LoopedEvent {0};

        LoopedEvent.WriteEvent = WriteEvent;
        LoopedEvent.ReadEvent = ReadEvent;

        property.Set    = KSPROPSETID_MidiLoopedStreaming; 
        property.Id     = KSPROPERTY_MIDILOOPEDSTREAMING_NOTIFICATION_EVENT;       
        property.Flags  = KSPROPERTY_TYPE_SET;

        RETURN_IF_FAILED(SyncIoctl(
            m_Pin.get(),
            IOCTL_KS_PROPERTY,
            &property,
            propertySize,
            &LoopedEvent,
            sizeof(LoopedEvent),
            nullptr));

        return S_OK;
    }

Requirements

Item Description
Version Available in Windows 11 version 25H2 and later.
Header Ksmedia.h

See also