Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

424 lines
15 KiB

  1. /***************************************************************************
  2. * *
  3. * DMusicKS.h -- This module defines the the DirectMusic WDM interface. *
  4. * *
  5. * Copyright (c) Microsoft Corp. All rights reserved. *
  6. * *
  7. ***************************************************************************/
  8. #ifndef _DMUSICKS_
  9. #define _DMUSICKS_
  10. #include <dmusprop.h>
  11. #define DONT_HOLD_FOR_SEQUENCING 0x8000000000000000
  12. typedef struct _DMUS_KERNEL_EVENT
  13. { // this offset
  14. BYTE bReserved; // 1 0
  15. BYTE cbStruct; // 1 1
  16. USHORT cbEvent; // 2 2
  17. USHORT usChannelGroup; // 2 4
  18. USHORT usFlags; // 2 6
  19. REFERENCE_TIME ullPresTime100ns; // 8 8
  20. ULONGLONG ullBytePosition; // 8 16
  21. _DMUS_KERNEL_EVENT *pNextEvt; // 4 (8) 24
  22. union
  23. {
  24. BYTE abData[sizeof(PBYTE)]; // 4 (8) 28 (32)
  25. PBYTE pbData;
  26. _DMUS_KERNEL_EVENT *pPackageEvt;
  27. } uData;
  28. } DMUS_KERNEL_EVENT, *PDMUS_KERNEL_EVENT; // 32 (40)
  29. #define DMUS_KEF_EVENT_COMPLETE 0x0000
  30. #define DMUS_KEF_EVENT_INCOMPLETE 0x0001 // This event is an incomplete package or sysex.
  31. // Do not use this data.
  32. #define DMUS_KEF_PACKAGE_EVENT 0x0002 // This event is a package. The uData.pPackageEvt
  33. // field contains a pointer to a chain of events.
  34. #define kBytePositionNone (~(ULONGLONG)0) // This message has no meaningful byte position
  35. #define SHORT_EVT(evt) ((evt)->cbEvent <= sizeof(PBYTE))
  36. #define PACKAGE_EVT(evt) ((evt)->usFlags & DMUS_KEF_PACKAGE_EVENT)
  37. #define INCOMPLETE_EVT(evt) ((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE)
  38. #define COMPLETE_EVT(evt) (((evt)->usFlags & DMUS_KEF_EVENT_INCOMPLETE) == 0)
  39. #define SET_INCOMPLETE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_EVENT_INCOMPLETE)
  40. #define SET_COMPLETE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_EVENT_INCOMPLETE))
  41. #define SET_PACKAGE_EVT(evt) ((evt)->usFlags |= DMUS_KEF_PACKAGE_EVENT)
  42. #define CLEAR_PACKAGE_EVT(evt) ((evt)->usFlags &= (~DMUS_KEF_PACKAGE_EVENT))
  43. #define STATIC_CLSID_PortDMus\
  44. 0xb7902fe9, 0xfb0a, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  45. DEFINE_GUIDSTRUCT("b7902fe9-fb0a-11d1-81b0-0060083316c1", CLSID_PortDMus);
  46. #define CLSID_PortDMus DEFINE_GUIDNAMED(CLSID_PortDMus)
  47. #define STATIC_CLSID_MiniportDriverDMusUART\
  48. 0xd3f0ce1c, 0xfffc, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  49. DEFINE_GUIDSTRUCT("d3f0ce1c-fffc-11d1-81b0-0060083316c1", CLSID_MiniportDriverDMusUART);
  50. #define CLSID_MiniportDriverDMusUART DEFINE_GUIDNAMED(CLSID_MiniportDriverDMusUART)
  51. #define STATIC_CLSID_MiniportDriverDMusUARTCapture\
  52. 0xd3f0ce1d, 0xfffc, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  53. DEFINE_GUIDSTRUCT("d3f0ce1d-fffc-11d1-81b0-0060083316c1", CLSID_MiniportDriverDMusUARTCapture);
  54. #define CLSID_MiniportDriverDMusUARTCapture DEFINE_GUIDNAMED(CLSID_MiniportDriverDMusUARTCapture)
  55. #define STATIC_IID_IPortDMus\
  56. 0xc096df9c, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  57. DEFINE_GUIDSTRUCT("c096df9c-fb09-11d1-81b0-0060083316c1", IID_IPortDMus);
  58. #define IID_IPortDMus DEFINE_GUIDNAMED(IID_IPortDMus)
  59. #define STATIC_IID_IMiniportDMus\
  60. 0xc096df9d, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  61. DEFINE_GUIDSTRUCT("c096df9d-fb09-11d1-81b0-0060083316c1", IID_IMiniportDMus);
  62. #define IID_IMiniportDMus DEFINE_GUIDNAMED(IID_IMiniportDMus)
  63. #define STATIC_IID_IMXF\
  64. 0xc096df9e, 0xfb09, 0x11d1, 0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  65. DEFINE_GUIDSTRUCT("c096df9e-fb09-11d1-81b0-0060083316c1", IID_IMXF);
  66. #define IID_IMXF DEFINE_GUIDNAMED(IID_IMXF)
  67. #define STATIC_IID_IAllocatorMXF\
  68. 0xa5f0d62c, 0xb30f, 0x11d2, 0xb7, 0xa3, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1
  69. DEFINE_GUIDSTRUCT("a5f0d62c-b30f-11d2-b7a3-0060083316c1", IID_IAllocatorMXF);
  70. #define IID_IAllocatorMXF DEFINE_GUIDNAMED(IID_IAllocatorMXF)
  71. #define STATIC_IID_ISynthSinkDMus\
  72. 0x1f476974, 0x679b, 0x11d2, 0x8f, 0x7d, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef
  73. DEFINE_GUIDSTRUCT("1f476974-679b-11d2-8f7d-00c04fbf8fef", IID_ISynthSinkDMus);
  74. #define IID_ISynthSinkDMus DEFINE_GUIDNAMED(IID_ISynthSinkDMus)
  75. #define STATIC_KSAUDFNAME_DMUSIC_MPU_OUT\
  76. 0xA4DF0EB5, 0xBAC9, 0x11d2, 0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1
  77. DEFINE_GUIDSTRUCT("A4DF0EB5-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_OUT);
  78. #define KSAUDFNAME_DMUSIC_MPU_OUT DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_OUT)
  79. #define STATIC_KSAUDFNAME_DMUSIC_MPU_IN\
  80. 0xB2EC0A7D, 0xBAC9, 0x11d2, 0xB7, 0xA8, 0x00, 0x60, 0x08, 0x33, 0x16, 0xC1
  81. DEFINE_GUIDSTRUCT("B2EC0A7D-BAC9-11d2-B7A8-0060083316C1", KSAUDFNAME_DMUSIC_MPU_IN);
  82. #define KSAUDFNAME_DMUSIC_MPU_IN DEFINE_GUIDNAMED(KSAUDFNAME_DMUSIC_MPU_IN)
  83. /*****************************************************************************
  84. * IPortDMus
  85. *****************************************************************************
  86. * Interface for DMusic port lower edge.
  87. */
  88. DECLARE_INTERFACE_(IPortDMus,IPort)
  89. {
  90. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  91. DEFINE_ABSTRACT_PORT() // For IPort
  92. // For IPortDMus
  93. STDMETHOD_(void,Notify)
  94. ( THIS_
  95. IN PSERVICEGROUP ServiceGroup OPTIONAL
  96. ) PURE;
  97. STDMETHOD_(void,RegisterServiceGroup)
  98. ( THIS_
  99. IN PSERVICEGROUP ServiceGroup
  100. ) PURE;
  101. };
  102. typedef IPortDMus *PPORTDMUS;
  103. #ifdef PC_IMPLEMENTATION
  104. #define IMP_IPortDMus\
  105. IMP_IPort;\
  106. STDMETHODIMP_(void) Notify\
  107. ( IN PSERVICEGROUP ServiceGroup OPTIONAL\
  108. );\
  109. STDMETHODIMP_(void) RegisterServiceGroup\
  110. ( IN PSERVICEGROUP ServiceGroup\
  111. )
  112. #endif /* PC_IMPLEMENTATION */
  113. /*****************************************************************************
  114. * IMXF
  115. *****************************************************************************
  116. * Interface for DMusic miniport streams.
  117. */
  118. struct IMXF;
  119. typedef IMXF *PMXF;
  120. #if !defined(DEFINE_ABSTRACT_MXF)
  121. #define DEFINE_ABSTRACT_MXF() \
  122. STDMETHOD_(NTSTATUS,SetState) \
  123. ( THIS_ \
  124. IN KSSTATE State \
  125. ) PURE; \
  126. STDMETHOD_(NTSTATUS,PutMessage) \
  127. ( THIS_ \
  128. IN PDMUS_KERNEL_EVENT pDMKEvt \
  129. ) PURE; \
  130. STDMETHOD_(NTSTATUS,ConnectOutput) \
  131. ( THIS_ \
  132. IN PMXF sinkMXF \
  133. ) PURE; \
  134. STDMETHOD_(NTSTATUS,DisconnectOutput) \
  135. ( THIS_ \
  136. IN PMXF sinkMXF \
  137. ) PURE;
  138. #endif //!defined(DEFINE_ABSTRACT_MXF)
  139. DECLARE_INTERFACE_(IMXF,IUnknown)
  140. {
  141. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  142. DEFINE_ABSTRACT_MXF() // For IMXF
  143. };
  144. #define IMP_IMXF\
  145. STDMETHODIMP_(NTSTATUS) SetState\
  146. ( IN KSSTATE State\
  147. );\
  148. STDMETHODIMP_(NTSTATUS) PutMessage\
  149. ( IN PDMUS_KERNEL_EVENT pDMKEvt\
  150. );\
  151. STDMETHODIMP_(NTSTATUS) ConnectOutput\
  152. ( IN PMXF sinkMXF\
  153. );\
  154. STDMETHODIMP_(NTSTATUS) DisconnectOutput\
  155. ( IN PMXF sinkMXF\
  156. );\
  157. /*****************************************************************************
  158. * IAllocatorMXF
  159. *****************************************************************************
  160. * Interface for DMusic miniport streams.
  161. */
  162. struct IAllocatorMXF;
  163. typedef IAllocatorMXF *PAllocatorMXF;
  164. DECLARE_INTERFACE_(IAllocatorMXF,IMXF)
  165. {
  166. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  167. DEFINE_ABSTRACT_MXF() // For IMXF
  168. // For IAllocatorMXF
  169. STDMETHOD_(NTSTATUS,GetMessage)
  170. ( THIS_
  171. OUT PDMUS_KERNEL_EVENT * ppDMKEvt
  172. ) PURE;
  173. STDMETHOD_(USHORT,GetBufferSize)
  174. ( THIS
  175. ) PURE;
  176. STDMETHOD_(NTSTATUS,GetBuffer)
  177. ( THIS_
  178. OUT PBYTE * ppBuffer
  179. ) PURE;
  180. STDMETHOD_(NTSTATUS,PutBuffer)
  181. ( THIS_
  182. IN PBYTE pBuffer
  183. ) PURE;
  184. };
  185. #define IMP_IAllocatorMXF\
  186. IMP_IMXF;\
  187. STDMETHODIMP_(NTSTATUS) GetMessage\
  188. ( OUT PDMUS_KERNEL_EVENT * ppDMKEvt\
  189. );\
  190. STDMETHODIMP_(USHORT) GetBufferSize\
  191. ( void\
  192. );\
  193. STDMETHODIMP_(NTSTATUS) GetBuffer\
  194. ( OUT PBYTE * ppBuffer\
  195. );\
  196. STDMETHODIMP_(NTSTATUS) PutBuffer\
  197. ( IN PBYTE pBuffer\
  198. );\
  199. typedef enum
  200. {
  201. DMUS_STREAM_MIDI_INVALID = -1,
  202. DMUS_STREAM_MIDI_RENDER = 0,
  203. DMUS_STREAM_MIDI_CAPTURE,
  204. DMUS_STREAM_WAVE_SINK
  205. } DMUS_STREAM_TYPE;
  206. /*****************************************************************************
  207. * ISynthSinkDMus
  208. *****************************************************************************
  209. * Interface for synth wave out.
  210. */
  211. DECLARE_INTERFACE_(ISynthSinkDMus,IMXF)
  212. {
  213. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  214. DEFINE_ABSTRACT_MXF() // For IMXF
  215. // For ISynthSinkDMus
  216. STDMETHOD_(void,Render)
  217. ( THIS_
  218. IN PBYTE pBuffer,
  219. IN DWORD dwLength,
  220. IN LONGLONG llPosition
  221. ) PURE;
  222. STDMETHOD_(NTSTATUS,SyncToMaster)
  223. ( THIS_
  224. IN REFERENCE_TIME rfTime,
  225. IN BOOL fStart
  226. ) PURE;
  227. STDMETHOD_(NTSTATUS,SampleToRefTime)
  228. ( THIS_
  229. IN LONGLONG llSampleTime,
  230. OUT REFERENCE_TIME * prfTime
  231. ) PURE;
  232. STDMETHOD_(NTSTATUS,RefTimeToSample)
  233. ( THIS_
  234. IN REFERENCE_TIME rfTime,
  235. OUT LONGLONG * pllSampleTime
  236. ) PURE;
  237. };
  238. typedef ISynthSinkDMus * PSYNTHSINKDMUS;
  239. #define IMP_ISynthSinkDMus\
  240. IMP_IMXF;\
  241. STDMETHODIMP_(void) Render\
  242. ( IN PBYTE pBuffer,\
  243. IN DWORD dwLength,\
  244. IN LONGLONG llPosition\
  245. );\
  246. STDMETHODIMP_(NTSTATUS) SyncToMaster\
  247. ( IN REFERENCE_TIME rfTime,\
  248. IN BOOL fStart\
  249. );\
  250. STDMETHODIMP_(NTSTATUS) SampleToRefTime\
  251. ( IN LONGLONG llSampleTime,\
  252. OUT REFERENCE_TIME * prfTime\
  253. );\
  254. STDMETHODIMP_(NTSTATUS) RefTimeToSample\
  255. ( IN REFERENCE_TIME rfTime,\
  256. OUT LONGLONG * pllSampleTime\
  257. )
  258. /*****************************************************************************
  259. * IMasterClock
  260. *****************************************************************************
  261. * Master clock for MXF graph
  262. */
  263. DECLARE_INTERFACE_(IMasterClock,IUnknown)
  264. {
  265. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  266. STDMETHOD_(NTSTATUS,GetTime)
  267. ( THIS_
  268. OUT REFERENCE_TIME * pTime
  269. ) PURE;
  270. };
  271. typedef IMasterClock *PMASTERCLOCK;
  272. #define IMP_IMasterClock \
  273. STDMETHODIMP_(NTSTATUS) GetTime \
  274. ( THIS_ \
  275. OUT REFERENCE_TIME * pTime \
  276. ); \
  277. /*****************************************************************************
  278. * IMiniportDMus
  279. *****************************************************************************
  280. * Interface for DMusic miniports.
  281. */
  282. DECLARE_INTERFACE_(IMiniportDMus,IMiniport)
  283. {
  284. DEFINE_ABSTRACT_UNKNOWN() // For IUnknown
  285. DEFINE_ABSTRACT_MINIPORT() // For IMiniport
  286. // For IMiniportDMus
  287. STDMETHOD_(NTSTATUS,Init)
  288. ( THIS_
  289. IN PUNKNOWN UnknownAdapter,
  290. IN PRESOURCELIST ResourceList,
  291. IN PPORTDMUS Port,
  292. OUT PSERVICEGROUP * ServiceGroup
  293. ) PURE;
  294. STDMETHOD_(void,Service)
  295. ( THIS
  296. ) PURE;
  297. STDMETHOD_(NTSTATUS,NewStream)
  298. ( THIS_
  299. OUT PMXF * MXF,
  300. IN PUNKNOWN OuterUnknown OPTIONAL,
  301. IN POOL_TYPE PoolType,
  302. IN ULONG PinID,
  303. IN DMUS_STREAM_TYPE StreamType,
  304. IN PKSDATAFORMAT DataFormat,
  305. OUT PSERVICEGROUP * ServiceGroup,
  306. IN PAllocatorMXF AllocatorMXF,
  307. IN PMASTERCLOCK MasterClock,
  308. OUT PULONGLONG SchedulePreFetch
  309. ) PURE;
  310. };
  311. typedef IMiniportDMus *PMINIPORTDMUS;
  312. #define IMP_IMiniportDMus\
  313. IMP_IMiniport;\
  314. STDMETHODIMP_(NTSTATUS) Init\
  315. ( IN PUNKNOWN UnknownAdapter,\
  316. IN PRESOURCELIST ResourceList,\
  317. IN PPORTDMUS Port,\
  318. OUT PSERVICEGROUP * ServiceGroup\
  319. );\
  320. STDMETHODIMP_(void) Service\
  321. ( void\
  322. );\
  323. STDMETHODIMP_(NTSTATUS) NewStream\
  324. ( OUT PMXF * MXF, \
  325. IN PUNKNOWN OuterUnknown OPTIONAL, \
  326. IN POOL_TYPE PoolType, \
  327. IN ULONG PinID, \
  328. IN DMUS_STREAM_TYPE StreamType, \
  329. IN PKSDATAFORMAT DataFormat, \
  330. OUT PSERVICEGROUP * ServiceGroup, \
  331. IN PAllocatorMXF AllocatorMXF, \
  332. IN PMASTERCLOCK MasterClock, \
  333. OUT PULONGLONG SchedulePreFetch \
  334. )
  335. DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  336. DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  337. DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  338. DEFINE_GUID(GUID_DMUS_PROP_XG_Capable, 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
  339. DEFINE_GUID(GUID_DMUS_PROP_GS_Capable, 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
  340. DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  341. DEFINE_GUID(GUID_DMUS_PROP_WavesReverb, 0x04cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6);
  342. DEFINE_GUID(GUID_DMUS_PROP_Effects, 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd);
  343. #ifndef DMUS_EFFECT_NONE
  344. #define DMUS_EFFECT_NONE 0x00000000
  345. #endif
  346. #ifndef DMUS_EFFECT_REVERB
  347. #define DMUS_EFFECT_REVERB 0x00000001
  348. #endif
  349. #ifndef DMUS_EFFECT_CHORUS
  350. #define DMUS_EFFECT_CHORUS 0x00000002
  351. #endif
  352. #endif /* _DMUSICKS_ */