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.

693 lines
28 KiB

  1. /*
  2. *
  3. */
  4. #ifndef _DMUSICC_
  5. #define _DMUSICC_
  6. #include <windows.h>
  7. #define COM_NO_WINDOWS_H
  8. #include <objbase.h>
  9. #include <mmsystem.h>
  10. #include "dls1.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #define FACILITY_DIRECTMUSIC 0x878 /* Shared with DirectSound */
  15. #define DMUS_ERRBASE 0x1000 /* Make error codes human readable in hex */
  16. #define MAKE_DMHRESULTSUCCESS(code) MAKE_HRESULT(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code)))
  17. #define MAKE_DMHRESULTERROR(code) MAKE_HRESULT(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code)))
  18. #define DMUS_S_CORE_ALREADY_DOWNLOADED MAKE_DMHRESULTSUCCESS(0x090)
  19. #define DMUS_S_IME_PARTIALLOAD MAKE_DMHRESULTSUCCESS(0x091)
  20. #define DMUS_E_CORE_NO_DRIVER MAKE_DMHRESULTERROR(0x0100)
  21. #define DMUS_E_CORE_DRIVER_FAILED MAKE_DMHRESULTERROR(0x0101)
  22. #define DMUS_E_CORE_PORTS_OPEN MAKE_DMHRESULTERROR(0x0102)
  23. #define DMUS_E_CORE_DEVICE_IN_USE MAKE_DMHRESULTERROR(0x0103)
  24. #define DMUS_E_CORE_INSUFFICIENTBUFFER MAKE_DMHRESULTERROR(0x0104)
  25. #define DMUS_E_CORE_BUFFERNOTSET MAKE_DMHRESULTERROR(0x0105)
  26. #define DMUS_E_CORE_BUFFERNOTAVAILABLE MAKE_DMHRESULTERROR(0x0106)
  27. #define DMUS_E_CORE_NOTINITED MAKE_DMHRESULTERROR(0x0107)
  28. #define DMUS_E_CORE_NOTADLSCOL MAKE_DMHRESULTERROR(0x0108)
  29. #define DMUS_E_CORE_INVALIDOFFSET MAKE_DMHRESULTERROR(0x0109)
  30. #define DMUS_E_CORE_INVALIDID MAKE_DMHRESULTERROR(0x0110)
  31. #define DMUS_E_CORE_ALREADY_LOADED MAKE_DMHRESULTERROR(0x0111)
  32. #define DMUS_E_CORE_INVALIDPOS MAKE_DMHRESULTERROR(0x0113)
  33. #define DMUS_E_CORE_INVALIDPATCH MAKE_DMHRESULTERROR(0x0114)
  34. #define DMUS_E_CORE_CANNOTSEEK MAKE_DMHRESULTERROR(0x0115)
  35. #define DMUS_E_CORE_CANNOTWRITE MAKE_DMHRESULTERROR(0x0116)
  36. #define DMUS_E_CORE_CHUNKNOTFOUND MAKE_DMHRESULTERROR(0x0117)
  37. #define DMUS_E_CORE_CHUNKNOTFOUNDINPARENT MAKE_DMHRESULTERROR(0x0118)
  38. #define DMUS_E_CORE_INVALID_DOWNLOADID MAKE_DMHRESULTERROR(0x0119)
  39. #define DMUS_E_CORE_NOT_DOWNLOADED_TO_PORT MAKE_DMHRESULTERROR(0x0120)
  40. #define DMUS_E_CORE_ALREADY_DOWNLOADED MAKE_DMHRESULTERROR(0x0121)
  41. #define DMUS_E_CORE_UNKNOWN_PROPERTY MAKE_DMHRESULTERROR(0x0122)
  42. #define DMUS_E_CORE_SET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0123)
  43. #define DMUS_E_CORE_GET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0124)
  44. #define DMUS_E_CORE_NOTMONO MAKE_DMHRESULTERROR(0x0125)
  45. #define DMUS_E_CORE_BADARTICULATION MAKE_DMHRESULTERROR(0x0126)
  46. #define DMUS_E_CORE_BADINSTRUMENT MAKE_DMHRESULTERROR(0x0127)
  47. #define DMUS_E_CORE_BADWAVELINK MAKE_DMHRESULTERROR(0x0128)
  48. #define DMUS_E_CORE_NOARTICULATION MAKE_DMHRESULTERROR(0x0129)
  49. #define DMUS_E_CORE_NOTPCM MAKE_DMHRESULTERROR(0x012A)
  50. #define DMUS_E_CORE_BADWAVE MAKE_DMHRESULTERROR(0x012B)
  51. #define DMUS_E_CORE_BADOFFSETTABLE MAKE_DMHRESULTERROR(0x012C)
  52. #define DMUS_E_CORE_UNKNOWNDOWNLOAD MAKE_DMHRESULTERROR(0x012D)
  53. #define DMUS_E_CORE_NOSYNTHSINK MAKE_DMHRESULTERROR(0x012E)
  54. #define DMUS_E_CORE_ALREADYOPEN MAKE_DMHRESULTERROR(0x012F)
  55. #define DMUS_E_CORE_ALREADYCLOSED MAKE_DMHRESULTERROR(0x0130)
  56. #define DMUS_E_CORE_SYNTHNOTCONFIGURED MAKE_DMHRESULTERROR(0x0131)
  57. #define DMUS_E_IME_UNSUPPORTED_STREAM MAKE_DMHRESULTERROR(0x0150)
  58. #define DMUS_E_IME_ALREADY_INITED MAKE_DMHRESULTERROR(0x0151)
  59. #define DMUS_E_IME_INVALID_BAND MAKE_DMHRESULTERROR(0x0152)
  60. #define DMUS_E_IME_CANNOT_ADD_AFTER_INITED MAKE_DMHRESULTERROR(0x0153)
  61. #define DMUS_E_IME_NOT_INITED MAKE_DMHRESULTERROR(0x0154)
  62. #define DMUS_E_IME_TRACK_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0155)
  63. #define DMUS_E_IME_TOOL_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0156)
  64. #define DMUS_E_IME_INVALID_TRACK_HDR MAKE_DMHRESULTERROR(0x0157)
  65. #define DMUS_E_IME_INVALID_TOOL_HDR MAKE_DMHRESULTERROR(0x0158)
  66. #define DMUS_E_IME_ALL_TOOLS_FAILED MAKE_DMHRESULTERROR(0x0159)
  67. #define DMUS_E_IME_ALL_TRACKS_FAILED MAKE_DMHRESULTERROR(0x0160)
  68. #define DMUS_E_NO_MASTER_CLOCK MAKE_DMHRESULTERROR(0x0160)
  69. #define DMUS_E_LOADER_NOCLASSID MAKE_DMHRESULTERROR(0x0170)
  70. #define DMUS_E_LOADER_BADPATH MAKE_DMHRESULTERROR(0x0171)
  71. #define DMUS_E_LOADER_FAILEDOPEN MAKE_DMHRESULTERROR(0x0172)
  72. #define DMUS_E_LOADER_FORMATNOTSUPPORTED MAKE_DMHRESULTERROR(0x0173)
  73. #define DMUS_MAX_DESCRIPTION 128
  74. #define DMUS_MAX_DRIVER 128
  75. #define DMUS_PC_INPUTCLASS (0)
  76. #define DMUS_PC_OUTPUTCLASS (1)
  77. #define DMUS_PC_DLS (0x00000001)
  78. #define DMUS_PC_EXTERNAL (0x00000002)
  79. #define DMUS_PC_SOFTWARESYNTH (0x00000004)
  80. #define DMUS_PC_MEMORYSIZEFIXED (0x00000008)
  81. #define DMUS_PC_GMINHARDWARE (0x00000010)
  82. #define DMUS_PC_GSINHARDWARE (0x00000020)
  83. #define DMUS_PC_REVERB (0x00000040)
  84. #define DMUS_PC_SYSTEMMEMORY (0x7FFFFFFF)
  85. typedef struct _DMUS_BUFFERDESC *LPDMUS_BUFFERDESC;
  86. typedef struct _DMUS_BUFFERDESC{
  87. DWORD dwSize;
  88. DWORD dwFlags;
  89. GUID guidBufferFormat;
  90. DWORD cbBuffer;
  91. } DMUS_BUFFERDESC;
  92. typedef struct _DMUS_PORTCAPS *LPDMUS_PORTCAPS;
  93. typedef struct _DMUS_PORTCAPS
  94. {
  95. DWORD dwSize;
  96. DWORD dwFlags;
  97. GUID guidPort;
  98. DWORD dwClass;
  99. DWORD dwMemorySize;
  100. DWORD dwMaxChannelGroups;
  101. DWORD dwMaxVoices;
  102. WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
  103. } DMUS_PORTCAPS;
  104. typedef struct _DMUS_PORTPARAMS *LPDMUS_PORTPARAMS;
  105. typedef struct _DMUS_PORTPARAMS
  106. {
  107. DWORD dwSize;
  108. DWORD dwValidParams;
  109. DWORD dwVoices;
  110. DWORD dwChannelGroups;
  111. BOOL fStereo;
  112. DWORD dwSampleRate;
  113. BOOL fReverb;
  114. } DMUS_PORTPARAMS;
  115. /* These flags (set in dwValidParams) indicate which other members of the */
  116. /* DMOPENDESC are valid. */
  117. /* */
  118. #define DMUS_PORTPARAMS_VOICES 0x00000001
  119. #define DMUS_PORTPARAMS_CHANNELGROUPS 0x00000002
  120. #define DMUS_PORTPARAMS_STEREO 0x00000004
  121. #define DMUS_PORTPARAMS_SAMPLERATE 0x00000008
  122. #define DMUS_PORTPARAMS_REVERB 0x00000010
  123. typedef struct _DMUS_SYNTHSTATS *LPDMUS_SYNTHSTATS;
  124. typedef struct _DMUS_SYNTHSTATS
  125. {
  126. DWORD dwSize; /* Size in bytes of the structure */
  127. DWORD dwValidStats; /* Flags indicating which fields below are valid. */
  128. DWORD dwVoices; /* Average number of voices playing. */
  129. DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */
  130. DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */
  131. DWORD dwLostNotes; /* Number of notes lost in 1 second. */
  132. DWORD dwFreeMemory; /* Free memory in bytes */
  133. long lPeakVolume; /* Decibel level * 100. */
  134. } DMUS_SYNTHSTATS;
  135. #define DMUS_SYNTHSTATS_VOICES (1 << 0)
  136. #define DMUS_SYNTHSTATS_TOTAL_CPU (1 << 1)
  137. #define DMUS_SYNTHSTATS_CPU_PER_VOICE (1 << 2)
  138. #define DMUS_SYNTHSTATS_LOST_NOTES (1 << 3)
  139. #define DMUS_SYNTHSTATS_PEAK_VOLUME (1 << 4)
  140. #define DMUS_SYNTHSTATS_FREE_MEMORY (1 << 5)
  141. #define DMUS_SYNTHSTATS_SYSTEMMEMORY DMUS_PC_SYSTEMMEMORY
  142. typedef enum
  143. {
  144. DMUS_CLOCK_SYSTEM = 0,
  145. DMUS_CLOCK_WAVE = 1
  146. } DMUS_CLOCKTYPE;
  147. typedef struct _DMUS_CLOCKINFO *LPDMUS_CLOCKINFO;
  148. typedef struct _DMUS_CLOCKINFO
  149. {
  150. DWORD dwSize;
  151. DMUS_CLOCKTYPE ctType;
  152. GUID guidClock; /* Identifies this time source */
  153. WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
  154. } DMUS_CLOCKINFO;
  155. typedef LONGLONG REFERENCE_TIME;
  156. typedef REFERENCE_TIME *LPREFERENCE_TIME;
  157. #define DMUS_EVENTCLASS_CHANNELMSG (0x00000000)
  158. #define DMUS_EVENTCLASS_SYSEX (0x00000001)
  159. typedef long PCENT; /* Pitch cents */
  160. typedef long GCENT; /* Gain cents */
  161. typedef long TCENT; /* Time cents */
  162. typedef long PERCENT; /* Per.. cent! */
  163. typedef struct _DMUS_DOWNLOADINFO
  164. {
  165. DWORD dwDLType;
  166. DWORD dwDLId;
  167. DWORD dwNumOffsetTableEntries;
  168. DWORD cbSizeData;
  169. } DMUS_DOWNLOADINFO;
  170. #define DMUS_DOWNLOADINFO_INSTRUMENT 1
  171. #define DMUS_DOWNLOADINFO_WAVE 2
  172. #define DMUS_DEFAULT_SIZE_OFFSETTABLE 1
  173. /* Flags for DMUS_INSTRUMENT's ulFlags member */
  174. #define DMUS_INSTRUMENT_GM_INSTRUMENT (1 << 0)
  175. typedef struct _DMUS_OFFSETTABLE
  176. {
  177. ULONG ulOffsetTable[DMUS_DEFAULT_SIZE_OFFSETTABLE];
  178. } DMUS_OFFSETTABLE;
  179. typedef struct _DMUS_INSTRUMENT
  180. {
  181. ULONG ulPatch;
  182. ULONG ulFirstRegionIdx;
  183. ULONG ulGlobalArtIdx; /* If zero the instrument does not have an articulation */
  184. ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the instrument */
  185. ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the instrument */
  186. ULONG ulFlags;
  187. } DMUS_INSTRUMENT;
  188. typedef struct _DMUS_REGION
  189. {
  190. RGNRANGE RangeKey;
  191. RGNRANGE RangeVelocity;
  192. USHORT fusOptions;
  193. USHORT usKeyGroup;
  194. ULONG ulRegionArtIdx; /* If zero the region does not have an articulation */
  195. ULONG ulNextRegionIdx; /* If zero no more regions */
  196. ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the region */
  197. WAVELINK WaveLink;
  198. WSMPL WSMP; /* If WSMP.cSampleLoops > 1 then a WLOOP is included */
  199. WLOOP WLOOP[1];
  200. } DMUS_REGION;
  201. typedef struct _DMUS_LFOPARAMS
  202. {
  203. PCENT pcFrequency;
  204. TCENT tcDelay;
  205. GCENT gcVolumeScale;
  206. PCENT pcPitchScale;
  207. GCENT gcMWToVolume;
  208. PCENT pcMWToPitch;
  209. } DMUS_LFOPARAMS;
  210. typedef struct _DMUS_VEGPARAMS
  211. {
  212. TCENT tcAttack;
  213. TCENT tcDecay;
  214. PERCENT ptSustain;
  215. TCENT tcRelease;
  216. TCENT tcVel2Attack;
  217. TCENT tcKey2Decay;
  218. } DMUS_VEGPARAMS;
  219. typedef struct _DMUS_PEGPARAMS
  220. {
  221. TCENT tcAttack;
  222. TCENT tcDecay;
  223. PERCENT ptSustain;
  224. TCENT tcRelease;
  225. TCENT tcVel2Attack;
  226. TCENT tcKey2Decay;
  227. PCENT pcRange;
  228. } DMUS_PEGPARAMS;
  229. typedef struct _DMUS_MSCPARAMS
  230. {
  231. PERCENT ptDefaultPan;
  232. } DMUS_MSCPARAMS;
  233. typedef struct _DMUS_ARTICPARAMS
  234. {
  235. DMUS_LFOPARAMS LFO;
  236. DMUS_VEGPARAMS VolEG;
  237. DMUS_PEGPARAMS PitchEG;
  238. DMUS_MSCPARAMS Misc;
  239. } DMUS_ARTICPARAMS;
  240. typedef struct _DMUS_ARTICULATION
  241. {
  242. ULONG ulArt1Idx; /* If zero no DLS Level 1 articulation chunk */
  243. ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the articulation */
  244. } DMUS_ARTICULATION;
  245. #define DMUS_MIN_DATA_SIZE 4
  246. /* The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK */
  247. typedef struct _DMUS_EXTENSIONCHUNK
  248. {
  249. ULONG cbSize; /* Size of extension chunk */
  250. ULONG ulNextExtCkIdx; /* If zero no more 3rd party entenstion chunks */
  251. FOURCC ExtCkID;
  252. BYTE byExtCk[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */
  253. } DMUS_EXTENSIONCHUNK;
  254. /* The actual number is determined by cbSize of struct _DMUS_COPYRIGHT */
  255. typedef struct _DMUS_COPYRIGHT
  256. {
  257. ULONG cbSize; /* Size of copyright information */
  258. BYTE byCopyright[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */
  259. } DMUS_COPYRIGHT;
  260. typedef struct _DMUS_WAVEDATA
  261. {
  262. ULONG cbSize;
  263. BYTE byData[DMUS_MIN_DATA_SIZE];
  264. } DMUS_WAVEDATA;
  265. typedef struct _DMUS_WAVE
  266. {
  267. ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the wave */
  268. ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the wave */
  269. WAVEFORMATEX WaveformatEx;
  270. DMUS_WAVEDATA WaveData; /* Wave data */
  271. } DMUS_WAVE;
  272. typedef struct _DMUS_NOTERANGE *LPDMUS_NOTERANGE;
  273. typedef struct _DMUS_NOTERANGE
  274. {
  275. DWORD dwLowNote; /* Sets the low note for the range of MIDI note events to which the instrument responds.*/
  276. DWORD dwHighNote; /* Sets the high note for the range of MIDI note events to which the instrument responds.*/
  277. } DMUS_NOTERANGE;
  278. /* Software synths are enumerated from under this registry key.
  279. */
  280. #define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
  281. interface IDirectMusicBuffer;
  282. interface IDirectMusicPort;
  283. interface IReferenceClock;
  284. interface IDirectMusicSynth;
  285. interface IDirectMusicSynthSink;
  286. #ifndef __cplusplus
  287. typedef interface IDirectMusicBuffer IDirectMusicBuffer;
  288. typedef interface IDirectMusicPort IDirectMusicPort;
  289. typedef interface IReferenceClock IReferenceClock;
  290. typedef interface IDirectMusicSynth IDirectMusicSynth;
  291. typedef interface IDirectMusicSynthSink IDirectMusicSynthSink;
  292. #endif
  293. #undef INTERFACE
  294. #define INTERFACE IDirectMusicSynth
  295. DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown)
  296. {
  297. /* IUnknown */
  298. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  299. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  300. STDMETHOD_(ULONG,Release) (THIS) PURE;
  301. /* IDirectMusicSynth */
  302. STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
  303. STDMETHOD(Close) (THIS) PURE;
  304. STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
  305. STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE;
  306. STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE;
  307. STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
  308. STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
  309. STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
  310. STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
  311. STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
  312. STDMETHOD(Activate) (THIS_ HWND hWnd, BOOL fEnable) PURE;
  313. STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE;
  314. STDMETHOD(Render) (THIS_ short *pBuffer, DWORD dwLength, DWORD dwPosition) PURE;
  315. };
  316. #undef INTERFACE
  317. #define INTERFACE IDirectMusicSynthSink
  318. DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown)
  319. {
  320. /* IUnknown */
  321. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  322. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  323. STDMETHOD_(ULONG,Release) (THIS) PURE;
  324. /* IDirectMusicSynthSink */
  325. STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE;
  326. STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX pWaveFormat) PURE;
  327. STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
  328. STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
  329. STDMETHOD(Activate) (THIS_ HWND hWnd, BOOL fEnable) PURE;
  330. STDMETHOD(SampleToRefTime) (THIS_ DWORD dwSampleTime,REFERENCE_TIME *prfTime) PURE;
  331. STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, DWORD *pdwSampleTime) PURE;
  332. };
  333. typedef IDirectMusicBuffer *LPDIRECTMUSICBUFFER;
  334. typedef IDirectMusicPort *LPDIRECTMUSICPORT;
  335. #undef INTERFACE
  336. #define INTERFACE IDirectMusic
  337. DECLARE_INTERFACE_(IDirectMusic, IUnknown)
  338. {
  339. /* IUnknown */
  340. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  341. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  342. STDMETHOD_(ULONG,Release) (THIS) PURE;
  343. /* IDirectMusic */
  344. STDMETHOD(EnumPort) (THIS_ DWORD dwIdx, LPDMUS_PORTCAPS pPortCaps) PURE;
  345. STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER *ppBuffer, LPUNKNOWN pUnkOuter) PURE;
  346. STDMETHOD(CreatePort) (THIS_ REFGUID rguidPort, REFGUID rguidSink, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE;
  347. STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
  348. STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock, IReferenceClock **ppReferenceClock) PURE;
  349. STDMETHOD(SetMasterClock) (THIS_ REFGUID guidClock) PURE;
  350. STDMETHOD(Activate) (THIS_ HWND hWnd, BOOL fEnable) PURE;
  351. STDMETHOD(GetPortProperty) (THIS_ REFGUID rguidPort, REFGUID rguidPropSet, UINT uId, LPVOID pPropertyData, ULONG ulDataLength, ULONG *pulBytesReturned) PURE;
  352. STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE;
  353. STDMETHOD(SetDefaultPort) (THIS_ REFGUID rguidPort) PURE;
  354. };
  355. #undef INTERFACE
  356. #define INTERFACE IDirectMusicBuffer
  357. DECLARE_INTERFACE_(IDirectMusicBuffer, IUnknown)
  358. {
  359. /* IUnknown */
  360. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  361. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  362. STDMETHOD_(ULONG,Release) (THIS) PURE;
  363. /* IDirectMusicBuffer */
  364. STDMETHOD(Flush) (THIS) PURE;
  365. STDMETHOD(TotalTime) (THIS_ LPREFERENCE_TIME prtTime) PURE;
  366. STDMETHOD(PackChannelMsg) (THIS_ REFERENCE_TIME rt,
  367. DWORD dwChannelGroup,
  368. DWORD dwChannelMessage) PURE;
  369. STDMETHOD(PackSysEx) (THIS_ REFERENCE_TIME rt,
  370. DWORD dwChannelGroup,
  371. DWORD cb,
  372. LPBYTE lpb) PURE;
  373. STDMETHOD(ResetReadPtr) (THIS) PURE;
  374. STDMETHOD(GetNextEvent) (THIS_ LPREFERENCE_TIME prt,
  375. LPDWORD pdwChannelGroup,
  376. LPDWORD pdwLength,
  377. LPBYTE *ppData) PURE;
  378. STDMETHOD(GetRawBufferPtr) (THIS_ LPBYTE *ppData) PURE;
  379. STDMETHOD(GetStartTime) (THIS_ LPREFERENCE_TIME prt) PURE;
  380. STDMETHOD(GetUsedBytes) (THIS_ LPDWORD pcb) PURE;
  381. STDMETHOD(GetMaxBytes) (THIS_ LPDWORD pcb) PURE;
  382. STDMETHOD(GetBufferFormat) (THIS_ LPGUID pGuidFormat) PURE;
  383. STDMETHOD(SetStartTime) (THIS_ REFERENCE_TIME rt) PURE;
  384. STDMETHOD(SetUsedBytes) (THIS_ DWORD cb) PURE;
  385. };
  386. #undef INTERFACE
  387. #define INTERFACE IDirectMusicInstrument
  388. DECLARE_INTERFACE_(IDirectMusicInstrument, IUnknown)
  389. {
  390. /* IUnknown */
  391. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  392. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  393. STDMETHOD_(ULONG,Release) (THIS) PURE;
  394. /* IDirectMusicInstrument */
  395. STDMETHOD(GetPatch) (THIS_ DWORD* pdwPatch) PURE;
  396. STDMETHOD(SetPatch) (THIS_ DWORD dwPatch) PURE;
  397. };
  398. #undef INTERFACE
  399. #define INTERFACE IDirectMusicDownloadedInstrument
  400. DECLARE_INTERFACE_(IDirectMusicDownloadedInstrument, IUnknown)
  401. {
  402. /* IUnknown */
  403. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  404. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  405. STDMETHOD_(ULONG,Release) (THIS) PURE;
  406. /* IDirectMusicDownloadedInstrument */
  407. /* None at this time */
  408. };
  409. #undef INTERFACE
  410. #define INTERFACE IDirectMusicCollection
  411. DECLARE_INTERFACE_(IDirectMusicCollection, IUnknown)
  412. {
  413. /* IUnknown */
  414. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  415. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  416. STDMETHOD_(ULONG,Release) (THIS) PURE;
  417. /* IDirectMusicCollection */
  418. STDMETHOD(GetInstrument) (THIS_ DWORD dwPatch, IDirectMusicInstrument** ppInstrument) PURE;
  419. STDMETHOD(EnumInstrument) (THIS_ DWORD dwIndex, DWORD* pdwPatch, LPWSTR pName, DWORD cwchName) PURE;
  420. };
  421. #undef INTERFACE
  422. #define INTERFACE IDirectMusicDownload
  423. DECLARE_INTERFACE_(IDirectMusicDownload , IUnknown)
  424. {
  425. /* IUnknown */
  426. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  427. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  428. STDMETHOD_(ULONG,Release) (THIS) PURE;
  429. /* IDirectMusicDownload */
  430. STDMETHOD(GetBuffer) (THIS_ void** ppvBuffer, DWORD* pdwSize) PURE;
  431. };
  432. #undef INTERFACE
  433. #define INTERFACE IDirectMusicPortDownload
  434. DECLARE_INTERFACE_(IDirectMusicPortDownload, IUnknown)
  435. {
  436. /* IUnknown */
  437. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  438. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  439. STDMETHOD_(ULONG,Release) (THIS) PURE;
  440. /* IDirectMusicPortDownload */
  441. STDMETHOD(GetBuffer) (THIS_ DWORD dwId, IDirectMusicDownload** pIDMDownload) PURE;
  442. STDMETHOD(AllocateBuffer) (THIS_ DWORD dwSize, IDirectMusicDownload** pIDMDownload) PURE;
  443. STDMETHOD(FreeBuffer) (THIS_ IDirectMusicDownload* pIDMDownload) PURE;
  444. STDMETHOD(GetDLId) (THIS_ DWORD* pdwStartDLId, DWORD dwCount) PURE;
  445. STDMETHOD(Download) (THIS_ IDirectMusicDownload* pIDMDownload) PURE;
  446. STDMETHOD(Unload) (THIS_ IDirectMusicDownload* pIDMDownload) PURE;
  447. };
  448. #undef INTERFACE
  449. #define INTERFACE IDirectMusicPort
  450. DECLARE_INTERFACE_(IDirectMusicPort, IUnknown)
  451. {
  452. /* IUnknown */
  453. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  454. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  455. STDMETHOD_(ULONG,Release) (THIS) PURE;
  456. /* IDirectMusicPort */
  457. /* */
  458. STDMETHOD(PlayBuffer) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE;
  459. STDMETHOD(SetReadNotificationHandle)
  460. (THIS_ HANDLE hEvent) PURE;
  461. STDMETHOD(Read) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE;
  462. STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument *pInstrument,
  463. IDirectMusicDownloadedInstrument **ppDownloadedInstrument,
  464. DMUS_NOTERANGE *pNoteRanges,
  465. DWORD dwNumNoteRanges) PURE;
  466. STDMETHOD(UnloadInstrument) (THIS_ IDirectMusicDownloadedInstrument *pInstrument) PURE;
  467. STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
  468. STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
  469. STDMETHOD(Compact) (THIS) PURE;
  470. STDMETHOD(GetCaps) (THIS_ LPDMUS_PORTCAPS pPortCaps) PURE;
  471. STDMETHOD(DeviceIoControl) (THIS_ DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize,
  472. LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) PURE;
  473. STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwChannelGroups) PURE;
  474. STDMETHOD(GetNumChannelGroups) (THIS_ LPDWORD pdwGroups) PURE;
  475. STDMETHOD(GetInterfaces) (THIS_ LPUNKNOWN *ppUnknownPort, LPUNKNOWN *ppUnknownSink) PURE;
  476. };
  477. #ifndef __IReferenceClock_INTERFACE_DEFINED__
  478. #define __IReferenceClock_INTERFACE_DEFINED__
  479. DEFINE_GUID(IID_IReferenceClock,0x56a86897,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70);
  480. #undef INTERFACE
  481. #define INTERFACE IReferenceClock
  482. DECLARE_INTERFACE_(IReferenceClock, IUnknown)
  483. {
  484. /* IUnknown */
  485. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  486. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  487. STDMETHOD_(ULONG,Release) (THIS) PURE;
  488. /* IReferenceClock */
  489. /* */
  490. /* get the time now */
  491. STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE;
  492. /* ask for an async notification that a time has elapsed */
  493. STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME baseTime, /* base time */
  494. REFERENCE_TIME streamTime, /* stream offset time */
  495. HANDLE hEvent, /* advise via this event */
  496. DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */
  497. /* ask for an async periodic notification that a time has elapsed */
  498. STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME startTime, /* starting at this time */
  499. REFERENCE_TIME periodTime, /* time between notifications */
  500. HANDLE hSemaphore, /* advise via a semaphore */
  501. DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */
  502. /* cancel a request for notification */
  503. STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE;
  504. };
  505. #endif /* __IReferenceClock_INTERFACE_DEFINED__ */
  506. /* Include IKsPropertySet if ksproxy.h is not included.
  507. */
  508. #ifndef _IKsPropertySet_
  509. #define _IKsPropertySet_
  510. DEFINE_GUID(IID_IKsPropertySet, 0x31EFAC30, 0x515C, 0x11d0, 0xA9, 0xAA, 0x00, 0xAA, 0x00, 0x61, 0xBE, 0x93);
  511. /* Flags returned in pulTypeSupport
  512. */
  513. #define KSPROPERTY_SUPPORT_GET 1
  514. #define KSPROPERTY_SUPPORT_SET 2
  515. #undef INTERFACE
  516. #define INTERFACE IKsPropertySet
  517. DECLARE_INTERFACE_(IKsPropertySet, IUnknown)
  518. {
  519. STDMETHOD (Set) (THIS_ REFGUID rguidPropSet,
  520. ULONG ulId,
  521. LPVOID pInstanceData,
  522. ULONG ulInstanceLength,
  523. LPVOID pPropertyData,
  524. ULONG ulDataLength) PURE;
  525. STDMETHOD (Get) (THIS_ REFGUID rguidPropSet,
  526. ULONG ulId,
  527. LPVOID pInstanceData,
  528. ULONG ulInstanceLength,
  529. LPVOID pPropertyData,
  530. ULONG ulDataLength,
  531. ULONG* pulBytesReturned) PURE;
  532. STDMETHOD (QuerySupported) (THIS_ REFGUID rguidPropSet,
  533. ULONG ulId,
  534. ULONG* pulTypeSupport) PURE;
  535. };
  536. #endif
  537. DEFINE_GUID(CLSID_DirectMusic,0x636b9f10,0x0c7d,0x11d1,0x95,0xb2,0x00,0x20,0xaf,0xdc,0x74,0x21);
  538. DEFINE_GUID(CLSID_DirectMusicCollection,0x480ff4b0, 0x28b2, 0x11d1, 0xbe, 0xf7, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
  539. DEFINE_GUID(CLSID_DirectMusicSynth,0x58C2B4D0,0x46E7,0x11D1,0x89,0xAC,0x00,0xA0,0xC9,0x05,0x41,0x29);
  540. DEFINE_GUID(CLSID_DirectMusicSynthSink,0xaec17ce3, 0xa514, 0x11d1, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
  541. DEFINE_GUID(IID_IDirectMusic,0xd2ac2876, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  542. DEFINE_GUID(IID_IDirectMusicBuffer,0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  543. DEFINE_GUID(IID_IDirectMusicPort, 0x55e2edd8, 0xcd7c, 0x11d1, 0xa7, 0x6f, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  544. DEFINE_GUID(IID_IDirectMusicPortDownload,0xd2ac287a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  545. DEFINE_GUID(IID_IDirectMusicDownload,0xd2ac287b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  546. DEFINE_GUID(IID_IDirectMusicCollection,0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  547. DEFINE_GUID(IID_IDirectMusicInstrument,0xd2ac287d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  548. DEFINE_GUID(IID_IDirectMusicDownloadedInstrument,0xd2ac287e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  549. DEFINE_GUID(IID_IDirectMusicSynth,0xf69b9165, 0xbb60, 0x11d1, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
  550. DEFINE_GUID(IID_IDirectMusicSynthSink,0xd2ac2880, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  551. /* Property Query GUID_DMUS_PROP_GM_Hardware
  552. * Property Query GUID_DMUS_PROP_GS_Hardware
  553. * Property Query GUID_DMUS_PROP_XG_Hardware
  554. * Property Query GUID_DMUS_PROP_DLS1_Hardware
  555. * Property Query GUID_DMUS_PROP_SynthSink_DSOUND
  556. * Property Query GUID_DMUS_PROP_SynthSink_WAVE
  557. *
  558. * Item 0: Supported
  559. * Returns a DWORD which is non-zero if the feature is supported
  560. */
  561. DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  562. DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  563. DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  564. DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  565. DEFINE_GUID(GUID_DMUS_PROP_SynthSink_DSOUND,0xaa97844, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  566. DEFINE_GUID(GUID_DMUS_PROP_SynthSink_WAVE,0xaa97845, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  567. /* Property Get GUID_DMUS_PROP_MemorySize
  568. *
  569. * Item 0: Memory size
  570. * Returns a DWORD containing the total number of bytes of sample RAM
  571. */
  572. DEFINE_GUID(GUID_DMUS_PROP_MemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
  573. /* Property Set GUID_DMUS_PROP_SetDSound
  574. *
  575. * Item 0: IDirectSound Interface
  576. * Sets the IDirectMusicSynthSink to use the specified DSound object.
  577. */
  578. DEFINE_GUID(GUID_DMUS_PROP_SetDSound,0xaa97842, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  579. /* Property Set GUID_DMUS_PROP_WriteBufferZone
  580. *
  581. * Item 0: Distance in milliseconds from the write pointer to the synth write.
  582. * Sets the IDirectMusicSynthSink to write this far behind the pointer.
  583. */
  584. DEFINE_GUID(GUID_DMUS_PROP_WriteBufferZone,0xaa97843, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
  585. #ifdef __cplusplus
  586. }; /* extern "C" */
  587. #endif
  588. #endif /* #ifndef _DMUSICC_ */