1 #ifndef _DMUSICKS_ 2 #define _DMUSICKS_ 3 4 #include <dmusprop.h> 5 6 #define DONT_HOLD_FOR_SEQUENCING 0x8000000000000000 7 8 #ifndef REFERENCE_TIME 9 typedef LONGLONG REFERENCE_TIME; 10 #endif 11 12 typedef struct _DMUS_KERNEL_EVENT { 13 BYTE bReserved; 14 BYTE cbStruct; 15 USHORT cbEvent; 16 USHORT usChannelGroup; 17 USHORT usFlags; 18 REFERENCE_TIME ullPresTime100ns; 19 ULONGLONG ullBytePosition; 20 struct _DMUS_KERNEL_EVENT *pNextEvt; 21 union { 22 BYTE abData[sizeof(PBYTE)]; 23 PBYTE pbData; 24 struct _DMUS_KERNEL_EVENT *pPackageEvt; 25 } uData; 26 } DMUS_KERNEL_EVENT, *PDMUS_KERNEL_EVENT; 27 28 typedef enum { 29 DMUS_STREAM_MIDI_INVALID = -1, 30 DMUS_STREAM_MIDI_RENDER = 0, 31 DMUS_STREAM_MIDI_CAPTURE, 32 DMUS_STREAM_WAVE_SINK 33 } DMUS_STREAM_TYPE; 34 35 DEFINE_GUID(CLSID_MiniportDriverDMusUART, 0xd3f0ce1c, 0xFFFC, 0x11D1, 0x81, 0xB0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1); 36 DEFINE_GUID(CLSID_MiniportDriverDMusUARTCapture, 0xD3F0CE1D, 0xFFFC, 0x11D1, 0x81, 0xB0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1); 37 38 /* =============================================================== 39 IMasterClock Interface 40 */ 41 42 #undef INTERFACE 43 #define INTERFACE IMasterClock 44 45 DECLARE_INTERFACE_(IMasterClock,IUnknown) { 46 DEFINE_ABSTRACT_UNKNOWN() 47 48 STDMETHOD_(NTSTATUS,GetTime)( THIS_ 49 _Out_ REFERENCE_TIME *pTime 50 ) PURE; 51 }; 52 53 typedef IMasterClock *PMASTERCLOCK; 54 55 #define IMP_IMasterClock \ 56 STDMETHODIMP_(NTSTATUS) GetTime( \ 57 _Out_ REFERENCE_TIME *pTime \ 58 ) 59 60 /* =============================================================== 61 IMXF Interface 62 */ 63 64 #undef INTERFACE 65 #define INTERFACE IMXF 66 67 struct IMXF; 68 typedef struct IMXF *PMXF; 69 70 #define DEFINE_ABSTRACT_IMXF() \ 71 STDMETHOD_(NTSTATUS,SetState)(THIS_ \ 72 _In_ KSSTATE State \ 73 ) PURE; \ 74 STDMETHOD_(NTSTATUS,PutMessage)(THIS_ \ 75 _In_ PDMUS_KERNEL_EVENT pDMKEvt \ 76 ) PURE; \ 77 STDMETHOD_(NTSTATUS,ConnectOutput)(THIS_ \ 78 _In_ PMXF sinkMXF \ 79 ) PURE; \ 80 STDMETHOD_(NTSTATUS,DisconnectOutput)(THIS_ \ 81 _In_ PMXF sinkMXF \ 82 ) PURE; 83 84 #define IMP_IMXF \ 85 STDMETHODIMP_(NTSTATUS) SetState ( \ 86 _In_ KSSTATE State); \ 87 STDMETHODIMP_(NTSTATUS) PutMessage (THIS_ \ 88 _In_ PDMUS_KERNEL_EVENT pDMKEvt); \ 89 STDMETHODIMP_(NTSTATUS) ConnectOutput (THIS_ \ 90 _In_ PMXF sinkMXF); \ 91 STDMETHODIMP_(NTSTATUS) DisconnectOutput (THIS_ \ 92 _In_ PMXF sinkMXF) 93 94 DECLARE_INTERFACE_(IMXF,IUnknown) { 95 DEFINE_ABSTRACT_UNKNOWN() 96 DEFINE_ABSTRACT_IMXF() 97 }; 98 99 /* =============================================================== 100 IAllocatorMXF Interface 101 */ 102 103 #undef INTERFACE 104 #define INTERFACE IAllocatorMXF 105 106 struct IAllocatorMXF; 107 typedef struct IAllocatorMXF *PAllocatorMXF; 108 109 #define STATIC_IID_IAllocatorMXF\ 110 0xa5f0d62c, 0xb30f, 0x11d2, {0xb7, 0xa3, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1} 111 DEFINE_GUIDSTRUCT("a5f0d62c-b30f-11d2-b7a3-0060083316c1", IID_IAllocatorMXF); 112 #define IID_IAllocatorMXF DEFINE_GUIDNAMED(IID_IAllocatorMXF) 113 114 115 DECLARE_INTERFACE_(IAllocatorMXF, IMXF) { 116 DEFINE_ABSTRACT_UNKNOWN() 117 118 DEFINE_ABSTRACT_IMXF() 119 120 STDMETHOD_(NTSTATUS,GetMessage)(THIS_ 121 _Out_ PDMUS_KERNEL_EVENT *ppDMKEvt 122 ) PURE; 123 124 STDMETHOD_(USHORT,GetBufferSize)(THIS) PURE; 125 126 STDMETHOD_(NTSTATUS,GetBuffer)(THIS_ 127 _Outptr_result_bytebuffer_(_Inexpressible_(GetBufferSize bytes)) PBYTE *ppBuffer 128 )PURE; 129 130 STDMETHOD_(NTSTATUS,PutBuffer)(THIS_ 131 _In_ PBYTE pBuffer 132 ) PURE; 133 }; 134 135 #define IMP_IAllocatorMXF \ 136 IMP_IMXF; \ 137 STDMETHODIMP_(NTSTATUS) GetMessage( \ 138 _Out_ PDMUS_KERNEL_EVENT *ppDMKEvt); \ 139 \ 140 STDMETHODIMP_(USHORT) GetBufferSize(void); \ 141 \ 142 STDMETHODIMP_(NTSTATUS) GetBuffer( \ 143 _Outptr_result_bytebuffer_(_Inexpressible_(GetBufferSize bytes)) \ 144 PBYTE *ppBuffer); \ 145 \ 146 STDMETHODIMP_(NTSTATUS) PutBuffer( \ 147 _In_ PBYTE pBuffer) 148 149 #undef INTERFACE 150 #define INTERFACE IPortDMus 151 152 DEFINE_GUID(IID_IPortDMus, 0xc096df9c, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); 153 DEFINE_GUID(CLSID_PortDMus, 0xb7902fe9, 0xfb0a, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); 154 155 DECLARE_INTERFACE_(IPortDMus, IPort) { 156 DEFINE_ABSTRACT_UNKNOWN() 157 158 DEFINE_ABSTRACT_PORT() 159 160 STDMETHOD_(void,Notify)(THIS_ 161 _In_opt_ PSERVICEGROUP ServiceGroup 162 ) PURE; 163 164 STDMETHOD_(void,RegisterServiceGroup)(THIS_ 165 _In_ PSERVICEGROUP ServiceGroup 166 ) PURE; 167 }; 168 typedef IPortDMus *PPORTDMUS; 169 170 #define IMP_IPortDMus \ 171 IMP_IPort; \ 172 STDMETHODIMP_(void) Notify( \ 173 _In_opt_ PSERVICEGROUP ServiceGroup); \ 174 \ 175 STDMETHODIMP_(void) RegisterServiceGroup( \ 176 _In_ PSERVICEGROUP ServiceGroup) 177 178 #undef INTERFACE 179 #define INTERFACE IMiniportDMus 180 181 DEFINE_GUID(IID_IMiniportDMus, 0xc096df9d, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); 182 183 DECLARE_INTERFACE_(IMiniportDMus, IMiniport) { 184 DEFINE_ABSTRACT_UNKNOWN() 185 186 DEFINE_ABSTRACT_MINIPORT() 187 188 STDMETHOD_(NTSTATUS,Init)(THIS_ 189 _In_opt_ PUNKNOWN UnknownAdapter, 190 _In_ PRESOURCELIST ResourceList, 191 _In_ PPORTDMUS Port, 192 _Out_ PSERVICEGROUP *ServiceGroup 193 ) PURE; 194 195 STDMETHOD_(void,Service)(THIS) PURE; 196 197 STDMETHOD_(NTSTATUS,NewStream)(THIS_ 198 _Out_ PMXF *MXF, 199 _In_opt_ PUNKNOWN OuterUnknown, 200 _In_ POOL_TYPE PoolType, 201 _In_ ULONG PinID, 202 _In_ DMUS_STREAM_TYPE StreamType, 203 _In_ PKSDATAFORMAT DataFormat, 204 _Out_ PSERVICEGROUP *ServiceGroup, 205 _In_ PAllocatorMXF AllocatorMXF, 206 _In_ PMASTERCLOCK MasterClock, 207 _Out_ PULONGLONG SchedulePreFetch 208 ) PURE; 209 }; 210 211 typedef IMiniportDMus *PMINIPORTDMUS; 212 #undef INTERFACE 213 214 #define IMP_IMiniportDMus \ 215 IMP_IMiniport; \ 216 STDMETHODIMP_(NTSTATUS) Init( \ 217 _In_opt_ PUNKNOWN UnknownAdapter, \ 218 _In_ PRESOURCELIST ResourceList, \ 219 _In_ PPORTDMUS Port, \ 220 _Out_ PSERVICEGROUP *ServiceGroup); \ 221 \ 222 STDMETHODIMP_(void) Service(THIS); \ 223 \ 224 STDMETHODIMP_(NTSTATUS) NewStream( \ 225 _Out_ PMXF *MXF, \ 226 _In_opt_ PUNKNOWN OuterUnknown, \ 227 _In_ POOL_TYPE PoolType, \ 228 _In_ ULONG PinID, \ 229 _In_ DMUS_STREAM_TYPE StreamType, \ 230 _In_ PKSDATAFORMAT DataFormat, \ 231 _Out_ PSERVICEGROUP *ServiceGroup, \ 232 _In_ PAllocatorMXF AllocatorMXF, \ 233 _In_ PMASTERCLOCK MasterClock, \ 234 _Out_ PULONGLONG SchedulePreFetch) 235 236 237 #define STATIC_KSAUDFNAME_DMUSIC_MPU_OUT\ 238 0xA4DF0EB5, 0xBAC9, 0x11d2, {0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1} 239 DEFINE_GUIDSTRUCT("A4DF0EB5-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_OUT); 240 #define KSAUDFNAME_DMUSIC_MPU_OUT DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_OUT) 241 242 #define STATIC_KSAUDFNAME_DMUSIC_MPU_IN\ 243 0xB2EC0A7D, 0xBAC9, 0x11d2, {0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1} 244 DEFINE_GUIDSTRUCT("B2EC0A7D-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_IN); 245 #define KSAUDFNAME_DMUSIC_MPU_IN DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_IN) 246 247 #define STATIC_IID_IMXF\ 248 0xc096df9e, 0xfb09, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1} 249 DEFINE_GUIDSTRUCT("c096df9e-fb09-11d1-81b0-0060083316c1", IID_IMXF); 250 #define IID_IMXF DEFINE_GUIDNAMED(IID_IMXF) 251 252 #define DMUS_KEF_EVENT_COMPLETE 0x0000 253 #define DMUS_KEF_EVENT_INCOMPLETE 0x0001 254 #define DMUS_KEF_PACKAGE_EVENT 0x0002 255 #define kBytePositionNone (~(ULONGLONG)0) 256 257 #define SHORT_EVT(evt) ((evt)->cbEvent <= sizeof(PBYTE)) 258 #define PACKAGE_EVT(evt) ((evt)->usFlags & DMUS_KEF_PACKAGE_EVENT) 259 #define INCOMPLETE_EVT(evt) ((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE) 260 #define COMPLETE_EVT(evt) (((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE) == 0) 261 262 #define SET_INCOMPLETE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_EVENT_INCOMPLETE) 263 #define SET_COMPLETE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_EVENT_INCOMPLETE)) 264 #define SET_PACKAGE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_PACKAGE_EVENT) 265 #define CLEAR_PACKAGE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_PACKAGE_EVENT)) 266 267 #endif /* _DMUSICKS_ */ 268