comparison lib/legacy_dx/dmusicc.h @ 0:9c0607679772

init
author Ritor1
date Sat, 12 Jan 2013 09:45:18 +0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9c0607679772
1 /************************************************************************
2 * *
3 * dmusicc.h -- This module defines the DirectMusic core API's *
4 * *
5 * Copyright (c) Microsoft Corporation. All rights reserved. *
6 * *
7 ************************************************************************/
8
9 #ifndef _DMUSICC_
10 #define _DMUSICC_
11
12 #include <windows.h>
13
14 #define COM_NO_WINDOWS_H
15 #include <objbase.h>
16
17 #include <mmsystem.h>
18
19 #include "dls1.h"
20 #include "dmerror.h"
21 #include "dmdls.h"
22 #include "dsound.h"
23 #include "dmusbuff.h"
24
25 #include <pshpack8.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef ULONGLONG SAMPLE_TIME;
32 typedef ULONGLONG SAMPLE_POSITION;
33 typedef SAMPLE_TIME *LPSAMPLE_TIME;
34
35 #define DMUS_MAX_DESCRIPTION 128
36 #define DMUS_MAX_DRIVER 128
37
38 typedef struct _DMUS_BUFFERDESC *LPDMUS_BUFFERDESC;
39 typedef struct _DMUS_BUFFERDESC
40 {
41 DWORD dwSize;
42 DWORD dwFlags;
43 GUID guidBufferFormat;
44 DWORD cbBuffer;
45 } DMUS_BUFFERDESC;
46
47 /* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS
48 * and DMUS_PORTPARAMS.
49 */
50 #define DMUS_EFFECT_NONE 0x00000000
51 #define DMUS_EFFECT_REVERB 0x00000001
52 #define DMUS_EFFECT_CHORUS 0x00000002
53 #define DMUS_EFFECT_DELAY 0x00000004
54
55 /* For DMUS_PORTCAPS dwClass
56 */
57 #define DMUS_PC_INPUTCLASS (0)
58 #define DMUS_PC_OUTPUTCLASS (1)
59
60 /* For DMUS_PORTCAPS dwFlags
61 */
62 #define DMUS_PC_DLS (0x00000001) // Supports DLS downloading and DLS level 1.
63 #define DMUS_PC_EXTERNAL (0x00000002) // External MIDI module.
64 #define DMUS_PC_SOFTWARESYNTH (0x00000004) // Software synthesizer.
65 #define DMUS_PC_MEMORYSIZEFIXED (0x00000008) // Memory size is fixed.
66 #define DMUS_PC_GMINHARDWARE (0x00000010) // GM sound set is built in, no need to download.
67 #define DMUS_PC_GSINHARDWARE (0x00000020) // GS sound set is built in.
68 #define DMUS_PC_XGINHARDWARE (0x00000040) // XG sound set is built in.
69 #define DMUS_PC_DIRECTSOUND (0x00000080) // Connects to DirectSound via a DirectSound buffer.
70 #define DMUS_PC_SHAREABLE (0x00000100) // Synth can be actively shared by multiple apps at once.
71 #define DMUS_PC_DLS2 (0x00000200) // Supports DLS2 instruments.
72 #define DMUS_PC_AUDIOPATH (0x00000400) // Multiple outputs can be connected to DirectSound for audiopaths.
73 #define DMUS_PC_WAVE (0x00000800) // Supports streaming and one shot waves.
74
75 #define DMUS_PC_SYSTEMMEMORY (0x7FFFFFFF) // Sample memory is system memory.
76
77
78 typedef struct _DMUS_PORTCAPS
79 {
80 DWORD dwSize;
81 DWORD dwFlags;
82 GUID guidPort;
83 DWORD dwClass;
84 DWORD dwType;
85 DWORD dwMemorySize;
86 DWORD dwMaxChannelGroups;
87 DWORD dwMaxVoices;
88 DWORD dwMaxAudioChannels;
89 DWORD dwEffectFlags;
90 WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
91 } DMUS_PORTCAPS;
92
93 typedef DMUS_PORTCAPS *LPDMUS_PORTCAPS;
94
95 /* Values for DMUS_PORTCAPS dwType. This field indicates the underlying
96 * driver type of the port.
97 */
98 #define DMUS_PORT_WINMM_DRIVER (0)
99 #define DMUS_PORT_USER_MODE_SYNTH (1)
100 #define DMUS_PORT_KERNEL_MODE (2)
101
102 /* These flags (set in dwValidParams) indicate which other members of the */
103 /* DMUS_PORTPARAMS are valid. */
104 /* */
105 #define DMUS_PORTPARAMS_VOICES 0x00000001
106 #define DMUS_PORTPARAMS_CHANNELGROUPS 0x00000002
107 #define DMUS_PORTPARAMS_AUDIOCHANNELS 0x00000004
108 #define DMUS_PORTPARAMS_SAMPLERATE 0x00000008
109 #define DMUS_PORTPARAMS_EFFECTS 0x00000020
110 #define DMUS_PORTPARAMS_SHARE 0x00000040
111 #define DMUS_PORTPARAMS_FEATURES 0x00000080 /* DirectX 8.0 and above */
112
113 typedef struct _DMUS_PORTPARAMS
114 {
115 DWORD dwSize;
116 DWORD dwValidParams;
117 DWORD dwVoices;
118 DWORD dwChannelGroups;
119 DWORD dwAudioChannels;
120 DWORD dwSampleRate;
121 DWORD dwEffectFlags;
122 BOOL fShare;
123 } DMUS_PORTPARAMS7;
124
125 typedef struct _DMUS_PORTPARAMS8
126 {
127 DWORD dwSize;
128 DWORD dwValidParams;
129 DWORD dwVoices;
130 DWORD dwChannelGroups;
131 DWORD dwAudioChannels;
132 DWORD dwSampleRate;
133 DWORD dwEffectFlags;
134 BOOL fShare;
135 DWORD dwFeatures;
136 } DMUS_PORTPARAMS8;
137
138 #define DMUS_PORT_FEATURE_AUDIOPATH 0x00000001 /* Supports audiopath connection to DirectSound buffers. */
139 #define DMUS_PORT_FEATURE_STREAMING 0x00000002 /* Supports streaming waves through the synth. */
140
141
142 typedef DMUS_PORTPARAMS8 DMUS_PORTPARAMS;
143 typedef DMUS_PORTPARAMS *LPDMUS_PORTPARAMS;
144
145 typedef struct _DMUS_SYNTHSTATS *LPDMUS_SYNTHSTATS;
146 typedef struct _DMUS_SYNTHSTATS8 *LPDMUS_SYNTHSTATS8;
147 typedef struct _DMUS_SYNTHSTATS
148 {
149 DWORD dwSize; /* Size in bytes of the structure */
150 DWORD dwValidStats; /* Flags indicating which fields below are valid. */
151 DWORD dwVoices; /* Average number of voices playing. */
152 DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */
153 DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */
154 DWORD dwLostNotes; /* Number of notes lost in 1 second. */
155 DWORD dwFreeMemory; /* Free memory in bytes */
156 long lPeakVolume; /* Decibel level * 100. */
157 } DMUS_SYNTHSTATS;
158
159 typedef struct _DMUS_SYNTHSTATS8
160 {
161 DWORD dwSize; /* Size in bytes of the structure */
162 DWORD dwValidStats; /* Flags indicating which fields below are valid. */
163 DWORD dwVoices; /* Average number of voices playing. */
164 DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */
165 DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */
166 DWORD dwLostNotes; /* Number of notes lost in 1 second. */
167 DWORD dwFreeMemory; /* Free memory in bytes */
168 long lPeakVolume; /* Decibel level * 100. */
169 DWORD dwSynthMemUse; /* Memory used by synth wave data */
170 } DMUS_SYNTHSTATS8;
171
172 #define DMUS_SYNTHSTATS_VOICES (1 << 0)
173 #define DMUS_SYNTHSTATS_TOTAL_CPU (1 << 1)
174 #define DMUS_SYNTHSTATS_CPU_PER_VOICE (1 << 2)
175 #define DMUS_SYNTHSTATS_LOST_NOTES (1 << 3)
176 #define DMUS_SYNTHSTATS_PEAK_VOLUME (1 << 4)
177 #define DMUS_SYNTHSTATS_FREE_MEMORY (1 << 5)
178
179 #define DMUS_SYNTHSTATS_SYSTEMMEMORY DMUS_PC_SYSTEMMEMORY
180
181 typedef struct _DMUS_WAVES_REVERB_PARAMS
182 {
183 float fInGain; /* Input gain in dB (to avoid output overflows) */
184 float fReverbMix; /* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
185 Negative values gives less wet signal.
186 The coeficients are calculated so that the overall output level stays
187 (approximately) constant regardless of the ammount of reverb mix. */
188 float fReverbTime; /* The reverb decay time, in milliseconds. */
189 float fHighFreqRTRatio; /* The ratio of the high frequencies to the global reverb time.
190 Unless very 'splashy-bright' reverbs are wanted, this should be set to
191 a value < 1.0.
192 For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
193 decay time for high frequencies will be 100ms.*/
194
195 } DMUS_WAVES_REVERB_PARAMS;
196
197 /* Note: Default values for Reverb are:
198 fInGain = 0.0dB (no change in level)
199 fReverbMix = -10.0dB (a reasonable reverb mix)
200 fReverbTime = 1000.0ms (one second global reverb time)
201 fHighFreqRTRatio = 0.001 (the ratio of the high frequencies to the global reverb time)
202 */
203
204 typedef enum
205 {
206 DMUS_CLOCK_SYSTEM = 0,
207 DMUS_CLOCK_WAVE = 1
208 } DMUS_CLOCKTYPE;
209
210 #define DMUS_CLOCKF_GLOBAL 0x00000001
211
212 typedef struct _DMUS_CLOCKINFO7 *LPDMUS_CLOCKINFO7;
213 typedef struct _DMUS_CLOCKINFO7
214 {
215 DWORD dwSize;
216 DMUS_CLOCKTYPE ctType;
217 GUID guidClock; /* Identifies this time source */
218 WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
219 } DMUS_CLOCKINFO7;
220
221 typedef struct _DMUS_CLOCKINFO8 *LPDMUS_CLOCKINFO8;
222 typedef struct _DMUS_CLOCKINFO8
223 {
224 DWORD dwSize;
225 DMUS_CLOCKTYPE ctType;
226 GUID guidClock; /* Identifies this time source */
227 WCHAR wszDescription[DMUS_MAX_DESCRIPTION];
228 DWORD dwFlags;
229 } DMUS_CLOCKINFO8;
230
231 typedef DMUS_CLOCKINFO8 DMUS_CLOCKINFO;
232 typedef DMUS_CLOCKINFO *LPDMUS_CLOCKINFO;
233
234 /* Default bus identifiers
235 *
236 * The first 17 are direct mappings to the destinations defined in both
237 * the MMA DLS Level 2 specification and the Microsoft Multi-Channel audio
238 * specification.
239 */
240 #define DSBUSID_FIRST_SPKR_LOC 0
241 #define DSBUSID_FRONT_LEFT 0
242 #define DSBUSID_LEFT 0 /* Front left is also just left */
243 #define DSBUSID_FRONT_RIGHT 1
244 #define DSBUSID_RIGHT 1 /* Ditto front right */
245 #define DSBUSID_FRONT_CENTER 2
246 #define DSBUSID_LOW_FREQUENCY 3
247 #define DSBUSID_BACK_LEFT 4
248 #define DSBUSID_BACK_RIGHT 5
249 #define DSBUSID_FRONT_LEFT_OF_CENTER 6
250 #define DSBUSID_FRONT_RIGHT_OF_CENTER 7
251 #define DSBUSID_BACK_CENTER 8
252 #define DSBUSID_SIDE_LEFT 9
253 #define DSBUSID_SIDE_RIGHT 10
254 #define DSBUSID_TOP_CENTER 11
255 #define DSBUSID_TOP_FRONT_LEFT 12
256 #define DSBUSID_TOP_FRONT_CENTER 13
257 #define DSBUSID_TOP_FRONT_RIGHT 14
258 #define DSBUSID_TOP_BACK_LEFT 15
259 #define DSBUSID_TOP_BACK_CENTER 16
260 #define DSBUSID_TOP_BACK_RIGHT 17
261 #define DSBUSID_LAST_SPKR_LOC 17
262
263 #define DSBUSID_IS_SPKR_LOC(id) ( ((id) >= DSBUSID_FIRST_SPKR_LOC) && ((id) <= DSBUSID_LAST_SPKR_LOC) )
264
265 /* These bus identifiers are for the standard DLS effect sends
266 */
267 #define DSBUSID_REVERB_SEND 64
268 #define DSBUSID_CHORUS_SEND 65
269
270 /* Dynamic bus identifiers start here. See the documentation for how
271 * synthesizers map the output of voices to static and dynamic
272 * bus identifiers.
273 */
274 #define DSBUSID_DYNAMIC_0 512
275
276 /* Null bus, used to identify busses that have no function mapping.
277 */
278 #define DSBUSID_NULL 0xFFFFFFFF
279
280 interface IDirectMusic;
281 interface IDirectMusic8;
282 interface IDirectMusicBuffer;
283 interface IDirectMusicPort;
284 interface IDirectMusicThru;
285 interface IReferenceClock;
286
287 #ifndef __cplusplus
288
289 typedef interface IDirectMusic IDirectMusic;
290 typedef interface IDirectMusic8 IDirectMusic8;
291 typedef interface IDirectMusicPort IDirectMusicPort;
292 typedef interface IDirectMusicBuffer IDirectMusicBuffer;
293 typedef interface IDirectMusicThru IDirectMusicThru;
294 typedef interface IReferenceClock IReferenceClock;
295
296 #endif /* C++ */
297
298 typedef IDirectMusic *LPDIRECTMUSIC;
299 typedef IDirectMusic8 *LPDIRECTMUSIC8;
300 typedef IDirectMusicPort *LPDIRECTMUSICPORT;
301 typedef IDirectMusicBuffer *LPDIRECTMUSICBUFFER;
302
303 #undef INTERFACE
304 #define INTERFACE IDirectMusic
305 DECLARE_INTERFACE_(IDirectMusic, IUnknown)
306 {
307 /* IUnknown */
308 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
309 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
310 STDMETHOD_(ULONG,Release) (THIS) PURE;
311
312 /* IDirectMusic */
313 STDMETHOD(EnumPort) (THIS_ DWORD dwIndex,
314 LPDMUS_PORTCAPS pPortCaps) PURE;
315 STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc,
316 LPDIRECTMUSICBUFFER *ppBuffer,
317 LPUNKNOWN pUnkOuter) PURE;
318 STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort,
319 LPDMUS_PORTPARAMS pPortParams,
320 LPDIRECTMUSICPORT *ppPort,
321 LPUNKNOWN pUnkOuter) PURE;
322 STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex,
323 LPDMUS_CLOCKINFO lpClockInfo) PURE;
324 STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock,
325 IReferenceClock **ppReferenceClock) PURE;
326 STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE;
327 STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
328 STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE;
329 STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound,
330 HWND hWnd) PURE;
331 };
332
333 #undef INTERFACE
334 #define INTERFACE IDirectMusic8
335 DECLARE_INTERFACE_(IDirectMusic8, IDirectMusic)
336 {
337 /* IUnknown */
338 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
339 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
340 STDMETHOD_(ULONG,Release) (THIS) PURE;
341
342 /* IDirectMusic */
343 STDMETHOD(EnumPort) (THIS_ DWORD dwIndex,
344 LPDMUS_PORTCAPS pPortCaps) PURE;
345 STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc,
346 LPDIRECTMUSICBUFFER *ppBuffer,
347 LPUNKNOWN pUnkOuter) PURE;
348 STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort,
349 LPDMUS_PORTPARAMS pPortParams,
350 LPDIRECTMUSICPORT *ppPort,
351 LPUNKNOWN pUnkOuter) PURE;
352 STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex,
353 LPDMUS_CLOCKINFO lpClockInfo) PURE;
354 STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock,
355 IReferenceClock **ppReferenceClock) PURE;
356 STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE;
357 STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
358 STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE;
359 STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound,
360 HWND hWnd) PURE;
361 /* IDirectMusic8 */
362 STDMETHOD(SetExternalMasterClock)
363 (THIS_ IReferenceClock *pClock) PURE;
364 };
365
366 #undef INTERFACE
367 #define INTERFACE IDirectMusicBuffer
368 DECLARE_INTERFACE_(IDirectMusicBuffer, IUnknown)
369 {
370 /* IUnknown */
371 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
372 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
373 STDMETHOD_(ULONG,Release) (THIS) PURE;
374
375 /* IDirectMusicBuffer */
376 STDMETHOD(Flush) (THIS) PURE;
377 STDMETHOD(TotalTime) (THIS_ LPREFERENCE_TIME prtTime) PURE;
378
379 STDMETHOD(PackStructured) (THIS_ REFERENCE_TIME rt,
380 DWORD dwChannelGroup,
381 DWORD dwChannelMessage) PURE;
382
383 STDMETHOD(PackUnstructured) (THIS_ REFERENCE_TIME rt,
384 DWORD dwChannelGroup,
385 DWORD cb,
386 LPBYTE lpb) PURE;
387
388 STDMETHOD(ResetReadPtr) (THIS) PURE;
389 STDMETHOD(GetNextEvent) (THIS_ LPREFERENCE_TIME prt,
390 LPDWORD pdwChannelGroup,
391 LPDWORD pdwLength,
392 LPBYTE *ppData) PURE;
393
394 STDMETHOD(GetRawBufferPtr) (THIS_ LPBYTE *ppData) PURE;
395 STDMETHOD(GetStartTime) (THIS_ LPREFERENCE_TIME prt) PURE;
396 STDMETHOD(GetUsedBytes) (THIS_ LPDWORD pcb) PURE;
397 STDMETHOD(GetMaxBytes) (THIS_ LPDWORD pcb) PURE;
398 STDMETHOD(GetBufferFormat) (THIS_ LPGUID pGuidFormat) PURE;
399
400 STDMETHOD(SetStartTime) (THIS_ REFERENCE_TIME rt) PURE;
401 STDMETHOD(SetUsedBytes) (THIS_ DWORD cb) PURE;
402 };
403
404 typedef IDirectMusicBuffer IDirectMusicBuffer8;
405 typedef IDirectMusicBuffer8 *LPDIRECTMUSICBUFFER8;
406
407 #undef INTERFACE
408 #define INTERFACE IDirectMusicInstrument
409 DECLARE_INTERFACE_(IDirectMusicInstrument, IUnknown)
410 {
411 /* IUnknown */
412 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
413 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
414 STDMETHOD_(ULONG,Release) (THIS) PURE;
415
416 /* IDirectMusicInstrument */
417 STDMETHOD(GetPatch) (THIS_ DWORD* pdwPatch) PURE;
418 STDMETHOD(SetPatch) (THIS_ DWORD dwPatch) PURE;
419 };
420
421 typedef IDirectMusicInstrument IDirectMusicInstrument8;
422 typedef IDirectMusicInstrument8 *LPDIRECTMUSICINSTRUMENT8;
423
424 #undef INTERFACE
425 #define INTERFACE IDirectMusicDownloadedInstrument
426 DECLARE_INTERFACE_(IDirectMusicDownloadedInstrument, IUnknown)
427 {
428 /* IUnknown */
429 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
430 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
431 STDMETHOD_(ULONG,Release) (THIS) PURE;
432
433 /* IDirectMusicDownloadedInstrument */
434 /* None at this time */
435 };
436
437 typedef IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument8;
438 typedef IDirectMusicDownloadedInstrument8 *LPDIRECTMUSICDOWNLOADEDINSTRUMENT8;
439
440 #undef INTERFACE
441 #define INTERFACE IDirectMusicCollection
442 DECLARE_INTERFACE_(IDirectMusicCollection, IUnknown)
443 {
444 /* IUnknown */
445 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
446 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
447 STDMETHOD_(ULONG,Release) (THIS) PURE;
448
449 /* IDirectMusicCollection */
450 STDMETHOD(GetInstrument) (THIS_ DWORD dwPatch,
451 IDirectMusicInstrument** ppInstrument) PURE;
452 STDMETHOD(EnumInstrument) (THIS_ DWORD dwIndex,
453 DWORD* pdwPatch,
454 LPWSTR pwszName,
455 DWORD dwNameLen) PURE;
456 };
457
458 typedef IDirectMusicCollection IDirectMusicCollection8;
459 typedef IDirectMusicCollection8 *LPDIRECTMUSICCOLLECTION8;
460
461 #undef INTERFACE
462 #define INTERFACE IDirectMusicDownload
463 DECLARE_INTERFACE_(IDirectMusicDownload , IUnknown)
464 {
465 /* IUnknown */
466 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
467 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
468 STDMETHOD_(ULONG,Release) (THIS) PURE;
469
470 /* IDirectMusicDownload */
471 STDMETHOD(GetBuffer) (THIS_ void** ppvBuffer,
472 DWORD* pdwSize) PURE;
473 };
474
475 typedef IDirectMusicDownload IDirectMusicDownload8;
476 typedef IDirectMusicDownload8 *LPDIRECTMUSICDOWNLOAD8;
477
478 #undef INTERFACE
479 #define INTERFACE IDirectMusicPortDownload
480 DECLARE_INTERFACE_(IDirectMusicPortDownload, IUnknown)
481 {
482 /* IUnknown */
483 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
484 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
485 STDMETHOD_(ULONG,Release) (THIS) PURE;
486
487 /* IDirectMusicPortDownload */
488 STDMETHOD(GetBuffer) (THIS_ DWORD dwDLId,
489 IDirectMusicDownload** ppIDMDownload) PURE;
490 STDMETHOD(AllocateBuffer) (THIS_ DWORD dwSize,
491 IDirectMusicDownload** ppIDMDownload) PURE;
492 STDMETHOD(GetDLId) (THIS_ DWORD* pdwStartDLId,
493 DWORD dwCount) PURE;
494 STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
495 STDMETHOD(Download) (THIS_ IDirectMusicDownload* pIDMDownload) PURE;
496 STDMETHOD(Unload) (THIS_ IDirectMusicDownload* pIDMDownload) PURE;
497 };
498
499 typedef IDirectMusicPortDownload IDirectMusicPortDownload8;
500 typedef IDirectMusicPortDownload8 *LPDIRECTMUSICPORTDOWNLOAD8;
501
502 /* Standard values for voice priorities. Numerically higher priorities are higher in priority.
503 * These priorities are used to set the voice priority for all voices on a channel. They are
504 * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the
505 * lpwPriority parameter of pdwPriority.
506 *
507 * These priorities are shared with DirectSound.
508 */
509
510 #ifndef _DIRECTAUDIO_PRIORITIES_DEFINED_
511 #define _DIRECTAUDIO_PRIORITIES_DEFINED_
512
513 #define DAUD_CRITICAL_VOICE_PRIORITY (0xF0000000)
514 #define DAUD_HIGH_VOICE_PRIORITY (0xC0000000)
515 #define DAUD_STANDARD_VOICE_PRIORITY (0x80000000)
516 #define DAUD_LOW_VOICE_PRIORITY (0x40000000)
517 #define DAUD_PERSIST_VOICE_PRIORITY (0x10000000)
518
519 /* These are the default priorities assigned if not overridden. By default priorities are
520 * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as
521 * channel 5 on channel group 2).
522 *
523 * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16
524 * except for 10.
525 */
526 #define DAUD_CHAN1_VOICE_PRIORITY_OFFSET (0x0000000E)
527 #define DAUD_CHAN2_VOICE_PRIORITY_OFFSET (0x0000000D)
528 #define DAUD_CHAN3_VOICE_PRIORITY_OFFSET (0x0000000C)
529 #define DAUD_CHAN4_VOICE_PRIORITY_OFFSET (0x0000000B)
530 #define DAUD_CHAN5_VOICE_PRIORITY_OFFSET (0x0000000A)
531 #define DAUD_CHAN6_VOICE_PRIORITY_OFFSET (0x00000009)
532 #define DAUD_CHAN7_VOICE_PRIORITY_OFFSET (0x00000008)
533 #define DAUD_CHAN8_VOICE_PRIORITY_OFFSET (0x00000007)
534 #define DAUD_CHAN9_VOICE_PRIORITY_OFFSET (0x00000006)
535 #define DAUD_CHAN10_VOICE_PRIORITY_OFFSET (0x0000000F)
536 #define DAUD_CHAN11_VOICE_PRIORITY_OFFSET (0x00000005)
537 #define DAUD_CHAN12_VOICE_PRIORITY_OFFSET (0x00000004)
538 #define DAUD_CHAN13_VOICE_PRIORITY_OFFSET (0x00000003)
539 #define DAUD_CHAN14_VOICE_PRIORITY_OFFSET (0x00000002)
540 #define DAUD_CHAN15_VOICE_PRIORITY_OFFSET (0x00000001)
541 #define DAUD_CHAN16_VOICE_PRIORITY_OFFSET (0x00000000)
542
543
544 #define DAUD_CHAN1_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN1_VOICE_PRIORITY_OFFSET)
545 #define DAUD_CHAN2_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN2_VOICE_PRIORITY_OFFSET)
546 #define DAUD_CHAN3_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN3_VOICE_PRIORITY_OFFSET)
547 #define DAUD_CHAN4_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN4_VOICE_PRIORITY_OFFSET)
548 #define DAUD_CHAN5_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN5_VOICE_PRIORITY_OFFSET)
549 #define DAUD_CHAN6_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN6_VOICE_PRIORITY_OFFSET)
550 #define DAUD_CHAN7_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN7_VOICE_PRIORITY_OFFSET)
551 #define DAUD_CHAN8_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN8_VOICE_PRIORITY_OFFSET)
552 #define DAUD_CHAN9_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN9_VOICE_PRIORITY_OFFSET)
553 #define DAUD_CHAN10_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN10_VOICE_PRIORITY_OFFSET)
554 #define DAUD_CHAN11_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN11_VOICE_PRIORITY_OFFSET)
555 #define DAUD_CHAN12_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN12_VOICE_PRIORITY_OFFSET)
556 #define DAUD_CHAN13_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN13_VOICE_PRIORITY_OFFSET)
557 #define DAUD_CHAN14_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN14_VOICE_PRIORITY_OFFSET)
558 #define DAUD_CHAN15_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN15_VOICE_PRIORITY_OFFSET)
559 #define DAUD_CHAN16_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN16_VOICE_PRIORITY_OFFSET)
560
561 #endif /* _DIRECTAUDIO_PRIORITIES_DEFINED_ */
562
563
564 #undef INTERFACE
565 #define INTERFACE IDirectMusicPort
566 DECLARE_INTERFACE_(IDirectMusicPort, IUnknown)
567 {
568 /* IUnknown */
569 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
570 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
571 STDMETHOD_(ULONG,Release) (THIS) PURE;
572
573 /* IDirectMusicPort */
574 /* */
575 STDMETHOD(PlayBuffer) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE;
576 STDMETHOD(SetReadNotificationHandle) (THIS_ HANDLE hEvent) PURE;
577 STDMETHOD(Read) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE;
578 STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument *pInstrument,
579 IDirectMusicDownloadedInstrument **ppDownloadedInstrument,
580 DMUS_NOTERANGE *pNoteRanges,
581 DWORD dwNumNoteRanges) PURE;
582 STDMETHOD(UnloadInstrument) (THIS_ IDirectMusicDownloadedInstrument *pDownloadedInstrument) PURE;
583 STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
584 STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
585 STDMETHOD(Compact) (THIS) PURE;
586 STDMETHOD(GetCaps) (THIS_ LPDMUS_PORTCAPS pPortCaps) PURE;
587 STDMETHOD(DeviceIoControl) (THIS_ DWORD dwIoControlCode,
588 LPVOID lpInBuffer,
589 DWORD nInBufferSize,
590 LPVOID lpOutBuffer,
591 DWORD nOutBufferSize,
592 LPDWORD lpBytesReturned,
593 LPOVERLAPPED lpOverlapped) PURE;
594 STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwChannelGroups) PURE;
595 STDMETHOD(GetNumChannelGroups) (THIS_ LPDWORD pdwChannelGroups) PURE;
596 STDMETHOD(Activate) (THIS_ BOOL fActive) PURE;
597 STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
598 STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
599 STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
600 STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) PURE;
601 };
602
603 typedef IDirectMusicPort IDirectMusicPort8;
604 typedef IDirectMusicPort8 *LPDIRECTMUSICPORT8;
605
606 #undef INTERFACE
607 #define INTERFACE IDirectMusicThru
608 DECLARE_INTERFACE_(IDirectMusicThru, IUnknown)
609 {
610 /* IUnknown */
611 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
612 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
613 STDMETHOD_(ULONG,Release) (THIS) PURE;
614
615 /* IDirectMusicThru
616 */
617 STDMETHOD(ThruChannel) (THIS_ DWORD dwSourceChannelGroup,
618 DWORD dwSourceChannel,
619 DWORD dwDestinationChannelGroup,
620 DWORD dwDestinationChannel,
621 LPDIRECTMUSICPORT pDestinationPort) PURE;
622 };
623
624 typedef IDirectMusicThru IDirectMusicThru8;
625 typedef IDirectMusicThru8 *LPDIRECTMUSICTHRU8;
626
627 #ifndef __IReferenceClock_INTERFACE_DEFINED__
628 #define __IReferenceClock_INTERFACE_DEFINED__
629
630 DEFINE_GUID(IID_IReferenceClock,0x56a86897,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70);
631
632 #undef INTERFACE
633 #define INTERFACE IReferenceClock
634 DECLARE_INTERFACE_(IReferenceClock, IUnknown)
635 {
636 /* IUnknown */
637 STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
638 STDMETHOD_(ULONG,AddRef) (THIS) PURE;
639 STDMETHOD_(ULONG,Release) (THIS) PURE;
640
641 /* IReferenceClock */
642 /* */
643
644 /* get the time now */
645 STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE;
646
647 /* ask for an async notification that a time has elapsed */
648 STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME baseTime, /* base time */
649 REFERENCE_TIME streamTime, /* stream offset time */
650 HANDLE hEvent, /* advise via this event */
651 DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */
652
653 /* ask for an async periodic notification that a time has elapsed */
654 STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME startTime, /* starting at this time */
655 REFERENCE_TIME periodTime, /* time between notifications */
656 HANDLE hSemaphore, /* advise via a semaphore */
657 DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */
658
659 /* cancel a request for notification */
660 STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE;
661 };
662
663 #endif /* __IReferenceClock_INTERFACE_DEFINED__ */
664
665 DEFINE_GUID(CLSID_DirectMusic,0x636b9f10,0x0c7d,0x11d1,0x95,0xb2,0x00,0x20,0xaf,0xdc,0x74,0x21);
666 DEFINE_GUID(CLSID_DirectMusicCollection,0x480ff4b0, 0x28b2, 0x11d1, 0xbe, 0xf7, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
667 DEFINE_GUID(CLSID_DirectMusicSynth,0x58C2B4D0,0x46E7,0x11D1,0x89,0xAC,0x00,0xA0,0xC9,0x05,0x41,0x29);
668
669 DEFINE_GUID(IID_IDirectMusic,0x6536115a,0x7b2d,0x11d2,0xba,0x18,0x00,0x00,0xf8,0x75,0xac,0x12);
670 DEFINE_GUID(IID_IDirectMusicBuffer,0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
671 DEFINE_GUID(IID_IDirectMusicPort, 0x08f2d8c9,0x37c2,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12);
672 DEFINE_GUID(IID_IDirectMusicThru, 0xced153e7, 0x3606, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
673 DEFINE_GUID(IID_IDirectMusicPortDownload,0xd2ac287a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
674 DEFINE_GUID(IID_IDirectMusicDownload,0xd2ac287b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
675 DEFINE_GUID(IID_IDirectMusicCollection,0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
676 DEFINE_GUID(IID_IDirectMusicInstrument,0xd2ac287d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
677 DEFINE_GUID(IID_IDirectMusicDownloadedInstrument,0xd2ac287e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
678
679
680 /* Alternate interface ID for IID_IDirectMusic, available in DX7 release and after. */
681 DEFINE_GUID(IID_IDirectMusic2,0x6fc2cae1, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
682
683 DEFINE_GUID(IID_IDirectMusic8,0x2d3629f7,0x813d,0x4939,0x85,0x08,0xf0,0x5c,0x6b,0x75,0xfd,0x97);
684
685 #define IID_IDirectMusicThru8 IID_IDirectMusicThru
686 #define IID_IDirectMusicPortDownload8 IID_IDirectMusicPortDownload
687 #define IID_IDirectMusicDownload8 IID_IDirectMusicDownload
688 #define IID_IDirectMusicCollection8 IID_IDirectMusicCollection
689 #define IID_IDirectMusicInstrument8 IID_IDirectMusicInstrument
690 #define IID_IDirectMusicDownloadedInstrument8 IID_IDirectMusicDownloadedInstrument
691 #define IID_IDirectMusicPort8 IID_IDirectMusicPort
692
693
694 /* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download
695 * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download
696 * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download
697 * Property Query GUID_DMUS_PROP_DLS1 - Support DLS level 1
698 * Property Query GUID_DMUS_PROP_INSTRUMENT2 - Support new INSTRUMENT2 download format
699 * Property Query GUID_DMUS_PROP_XG_Capable - Support minimum requirements of XG
700 * Property Query GUID_DMUS_PROP_GS_Capable - Support minimum requirements of GS
701 * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DirectSound
702 * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device
703 *
704 * Item 0: Supported
705 * Returns a DWORD which is non-zero if the feature is supported
706 */
707 DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
708 DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
709 DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
710 DEFINE_GUID(GUID_DMUS_PROP_XG_Capable, 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
711 DEFINE_GUID(GUID_DMUS_PROP_GS_Capable, 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
712 DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
713 DEFINE_GUID(GUID_DMUS_PROP_DLS2, 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
714 DEFINE_GUID(GUID_DMUS_PROP_INSTRUMENT2, 0x865fd372, 0x9f67, 0x11d2, 0x87, 0x2a, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
715 DEFINE_GUID(GUID_DMUS_PROP_SynthSink_DSOUND,0xaa97844, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
716 DEFINE_GUID(GUID_DMUS_PROP_SynthSink_WAVE,0xaa97845, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
717 DEFINE_GUID(GUID_DMUS_PROP_SampleMemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
718 DEFINE_GUID(GUID_DMUS_PROP_SamplePlaybackRate, 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8);
719
720 /* Property Get/Set GUID_DMUS_PROP_WriteLatency
721 *
722 * Item 0: Synth buffer write latency, in milliseconds
723 * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written.
724 */
725 DEFINE_GUID(GUID_DMUS_PROP_WriteLatency,0x268a0fa0, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
726
727 /* Property Get/Set GUID_DMUS_PROP_WritePeriod
728 *
729 * Item 0: Synth buffer write period, in milliseconds
730 * Get/Set SynthSink buffer write period, time span between successive writes.
731 */
732 DEFINE_GUID(GUID_DMUS_PROP_WritePeriod,0x268a0fa1, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
733
734 /* Property Get GUID_DMUS_PROP_MemorySize
735 *
736 * Item 0: Memory size
737 * Returns a DWORD containing the total number of bytes of sample RAM
738 */
739 DEFINE_GUID(GUID_DMUS_PROP_MemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
740
741 /* Property Set GUID_DMUS_PROP_WavesReverb
742 *
743 * Item 0: DMUS_WAVES_REVERB structure
744 * Sets reverb parameters
745 */
746 DEFINE_GUID(GUID_DMUS_PROP_WavesReverb,0x4cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6);
747
748 /* Property Set GUID_DMUS_PROP_Effects
749 *
750 * Item 0: DWORD with effects flags.
751 * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS:
752 * DMUS_EFFECT_NONE
753 * DMUS_EFFECT_REVERB
754 * DMUS_EFFECT_CHORUS
755 */
756 DEFINE_GUID(GUID_DMUS_PROP_Effects, 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd);
757
758 /* Property Set GUID_DMUS_PROP_LegacyCaps
759 *
760 * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported
761 * by ports which wrap WinMM devices.
762 */
763
764 DEFINE_GUID(GUID_DMUS_PROP_LegacyCaps,0xcfa7cdc2, 0x00a1, 0x11d2, 0xaa, 0xd5, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
765
766 /* Property Set GUID_DMUS_PROP_Volume
767 *
768 * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume
769 *
770 */
771 DEFINE_GUID(GUID_DMUS_PROP_Volume, 0xfedfae25L, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12);
772
773 /* Min and Max values for setting volume with GUID_DMUS_PROP_Volume */
774
775 #define DMUS_VOLUME_MAX 2000 /* +20 dB */
776 #define DMUS_VOLUME_MIN -20000 /* -200 dB */
777
778 #ifdef __cplusplus
779 }; /* extern "C" */
780 #endif
781
782 #include <poppack.h>
783
784 #endif /* #ifndef _DMUSICC_ */