178ccb7731bef4bbd852612d25318c404373fe9d
[reactos.git] / reactos / include / reactos / libs / sound / mmebuddy.h
1 /*
2 * PROJECT: ReactOS Sound System "MME Buddy" Library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: include/reactos/libs/sound/mmebuddy.h
5 *
6 * PURPOSE: Header for the "MME Buddy" helper library (located in
7 * lib/drivers/sound/mmebuddy)
8 *
9 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
10 *
11 * HISTORY: 4 July 2008 - Created
12 * 31 Dec 2008 - Split off NT4-specific code into a separate library
13 *
14 * NOTES: MME Buddy was the best name I could come up with...
15 * The structures etc. here should be treated as internal to the
16 * library so should not be directly accessed elsewhere.
17 */
18
19 #ifndef ROS_AUDIO_MMEBUDDY_H
20 #define ROS_AUDIO_MMEBUDDY_H
21
22 /*
23 Hacky debug macro
24 */
25
26 #define POPUP(...) \
27 { \
28 WCHAR dbg_popup_msg[1024], dbg_popup_title[256]; \
29 wsprintf(dbg_popup_title, L"%hS(%d)", __FILE__, __LINE__); \
30 wsprintf(dbg_popup_msg, __VA_ARGS__); \
31 MessageBox(0, dbg_popup_msg, dbg_popup_title, MB_OK | MB_TASKMODAL); \
32 }
33
34 #ifdef DEBUG_NT4
35 #define SND_ERR(...) \
36 { \
37 WCHAR dbg_popup_msg[1024]; \
38 wsprintf(dbg_popup_msg, __VA_ARGS__); \
39 OutputDebugString(dbg_popup_msg); \
40 }
41 #define SND_WARN(...) \
42 { \
43 WCHAR dbg_popup_msg[1024]; \
44 wsprintf(dbg_popup_msg, __VA_ARGS__); \
45 OutputDebugString(dbg_popup_msg); \
46 }
47 #define SND_TRACE(...) \
48 { \
49 WCHAR dbg_popup_msg[1024]; \
50 wsprintf(dbg_popup_msg, __VA_ARGS__); \
51 OutputDebugString(dbg_popup_msg); \
52 }
53
54 #define SND_ASSERT(condition) \
55 { \
56 if ( ! ( condition ) ) \
57 { \
58 SND_ERR(L"ASSERT FAILED: %hS\n", #condition); \
59 POPUP(L"ASSERT FAILED: %hS\n", #condition); \
60 ExitProcess(1); \
61 } \
62 }
63
64 #else
65 #define SND_ERR(...) while ( 0 ) do {}
66 #define SND_WARN(...) while ( 0 ) do {}
67 #define SND_TRACE(...) while ( 0 ) do {}
68 #define SND_ASSERT(condition) while ( 0 ) do {}
69 #endif
70
71 /*
72 Some memory allocation helper macros
73 */
74
75 #define AllocateStruct(thing) \
76 (thing*) AllocateMemory(sizeof(thing))
77
78 #define StringLengthToBytes(chartype, string_length) \
79 ( ( string_length + 1 ) * sizeof(chartype) )
80
81 #define AllocateWideString(string_length) \
82 (PWSTR) AllocateMemory(StringLengthToBytes(WCHAR, string_length))
83
84 #define ZeroWideString(string) \
85 ZeroMemory(string, StringLengthToBytes(WCHAR, wcslen(string)))
86
87 #define CopyWideString(dest, source) \
88 CopyMemory(dest, source, StringLengthToBytes(WCHAR, wcslen(source)))
89
90
91 /*
92 Helps find the minimum/maximum of two values
93 */
94
95 #define MinimumOf(value_a, value_b) \
96 ( value_a < value_b ? value_a : value_b )
97
98 #define MaximumOf(value_a, value_b) \
99 ( value_a > value_b ? value_a : value_b )
100
101
102 /*
103 Convert a device type into a zero-based array index
104 */
105
106 #define SOUND_DEVICE_TYPE_TO_INDEX(x) \
107 ( x - MIN_SOUND_DEVICE_TYPE )
108
109 #define INDEX_TO_SOUND_DEVICE_TYPE(x) \
110 ( x + MIN_SOUND_DEVICE_TYPE )
111
112
113 /*
114 Validation
115 */
116
117 #define IsValidSoundDeviceType IS_VALID_SOUND_DEVICE_TYPE
118
119 #define VALIDATE_MMSYS_PARAMETER(parameter_condition) \
120 { \
121 if ( ! (parameter_condition) ) \
122 { \
123 SND_ERR(L"FAILED parameter check: %hS\n", #parameter_condition); \
124 return MMSYSERR_INVALPARAM; \
125 } \
126 }
127
128 #define MMSUCCESS(result) \
129 ( result == MMSYSERR_NOERROR )
130
131
132 /*
133 Types and Structures
134 */
135
136 typedef UCHAR MMDEVICE_TYPE, *PMMDEVICE_TYPE;
137 struct _SOUND_DEVICE;
138 struct _SOUND_DEVICE_INSTANCE;
139
140
141 #define DEFINE_GETCAPS_FUNCTYPE(func_typename, caps_type) \
142 typedef MMRESULT (*func_typename)( \
143 IN struct _SOUND_DEVICE* SoundDevice, \
144 OUT caps_type Capabilities, \
145 IN DWORD CapabilitiesSize);
146
147 /* This one is for those of us who don't care */
148 DEFINE_GETCAPS_FUNCTYPE(MMGETCAPS_FUNC, PVOID);
149
150 /* These are for those of us that do */
151 DEFINE_GETCAPS_FUNCTYPE(MMGETWAVEOUTCAPS_FUNC, LPWAVEOUTCAPS);
152 DEFINE_GETCAPS_FUNCTYPE(MMGETWAVEINCAPS_FUNC, LPWAVEINCAPS );
153 DEFINE_GETCAPS_FUNCTYPE(MMGETMIDIOUTCAPS_FUNC, LPMIDIOUTCAPS);
154 DEFINE_GETCAPS_FUNCTYPE(MMGETMIDIINCAPS_FUNC, LPMIDIINCAPS );
155
156 struct _SOUND_DEVICE;
157 struct _SOUND_DEVICE_INSTANCE;
158
159 typedef MMRESULT (*MMWAVEQUERYFORMATSUPPORT_FUNC)(
160 IN struct _SOUND_DEVICE* Device,
161 IN PWAVEFORMATEX WaveFormat,
162 IN DWORD WaveFormatSize);
163
164 typedef MMRESULT (*MMWAVESETFORMAT_FUNC)(
165 IN struct _SOUND_DEVICE_INSTANCE* Instance,
166 IN PWAVEFORMATEX WaveFormat,
167 IN DWORD WaveFormatSize);
168
169 typedef MMRESULT (*MMOPEN_FUNC)(
170 IN struct _SOUND_DEVICE* SoundDevice,
171 OUT PVOID* Handle);
172
173 typedef MMRESULT (*MMCLOSE_FUNC)(
174 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
175 IN PVOID Handle); /* not sure about this */
176
177 typedef MMRESULT (*MMWAVEHEADER_FUNC)(
178 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
179 IN PWAVEHDR WaveHeader);
180
181 typedef struct _MMFUNCTION_TABLE
182 {
183 union
184 {
185 MMGETCAPS_FUNC GetCapabilities;
186 MMGETWAVEOUTCAPS_FUNC GetWaveOutCapabilities;
187 MMGETWAVEINCAPS_FUNC GetWaveInCapabilities;
188 MMGETMIDIOUTCAPS_FUNC GetMidiOutCapabilities;
189 MMGETMIDIINCAPS_FUNC GetMidiInCapabilities;
190 };
191
192 MMOPEN_FUNC Open;
193 MMCLOSE_FUNC Close;
194
195 MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport;
196 MMWAVESETFORMAT_FUNC SetWaveFormat;
197
198 MMWAVEHEADER_FUNC PrepareWaveHeader;
199 MMWAVEHEADER_FUNC UnprepareWaveHeader;
200 MMWAVEHEADER_FUNC SubmitWaveHeader;
201 } MMFUNCTION_TABLE, *PMMFUNCTION_TABLE;
202
203 typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)(
204 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
205 IN PVOID Parameter);
206
207 typedef struct _SOUND_THREAD
208 {
209 HANDLE Handle;
210 BOOL Running;
211
212 struct
213 {
214 HANDLE Ready;
215 HANDLE Request;
216 HANDLE Done;
217 } Events;
218
219 struct
220 {
221 SOUND_THREAD_REQUEST_HANDLER Handler;
222 struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance;
223 PVOID Parameter;
224 MMRESULT Result;
225 } Request;
226 } SOUND_THREAD, *PSOUND_THREAD;
227
228 typedef struct _SOUND_DEVICE
229 {
230 struct _SOUND_DEVICE* Next;
231 struct _SOUND_DEVICE_INSTANCE* HeadInstance;
232 struct _SOUND_DEVICE_INSTANCE* TailInstance;
233 MMDEVICE_TYPE Type;
234 PVOID Identifier; /* Path for NT4 drivers */
235 /*PWSTR Path;*/
236 MMFUNCTION_TABLE FunctionTable;
237 } SOUND_DEVICE, *PSOUND_DEVICE;
238
239 typedef struct _SOUND_DEVICE_INSTANCE
240 {
241 struct _SOUND_DEVICE_INSTANCE* Next;
242 struct _SOUND_DEVICE* Device;
243 PVOID Handle;
244 struct _SOUND_THREAD* Thread;
245
246 /* Stuff generously donated to us from WinMM */
247 struct
248 {
249 HDRVR Handle;
250 DWORD Flags;
251 DWORD ClientCallback;
252 DWORD ClientCallbackInstanceData;
253 } WinMM;
254 } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
255
256 /*
257 reentrancy.c
258 */
259
260 MMRESULT
261 InitEntrypointMutexes();
262
263 VOID
264 CleanupEntrypointMutexes();
265
266 VOID
267 AcquireEntrypointMutex(
268 IN MMDEVICE_TYPE DeviceType);
269
270 VOID
271 ReleaseEntrypointMutex(
272 IN MMDEVICE_TYPE DeviceType);
273
274
275 /*
276 mme.c
277 */
278
279 VOID
280 NotifyMmeClient(
281 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
282 IN DWORD Message,
283 IN DWORD Parameter);
284
285 MMRESULT
286 MmeGetSoundDeviceCapabilities(
287 IN MMDEVICE_TYPE DeviceType,
288 IN DWORD DeviceId,
289 IN PVOID Capabilities,
290 IN DWORD CapabilitiesSize);
291
292 MMRESULT
293 MmeOpenWaveDevice(
294 IN MMDEVICE_TYPE DeviceType,
295 IN DWORD DeviceId,
296 IN LPWAVEOPENDESC OpenParameters,
297 IN DWORD Flags,
298 OUT DWORD* PrivateHandle);
299
300 MMRESULT
301 MmeCloseDevice(
302 IN DWORD PrivateHandle);
303
304 #define MmePrepareWaveHeader(private_handle, header) \
305 PrepareWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header)
306
307 #define MmeUnprepareWaveHeader(private_handle, header) \
308 UnprepareWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header)
309
310 #define MmeSubmitWaveHeader(private_handle, header) \
311 SubmitWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header)
312
313
314 /*
315 capabilities.c
316 */
317
318 MMRESULT
319 GetSoundDeviceCapabilities(
320 IN PSOUND_DEVICE SoundDevice,
321 OUT PVOID Capabilities,
322 IN DWORD CapabilitiesSize);
323
324
325 /*
326 devicelist.c
327 */
328
329 ULONG
330 GetSoundDeviceCount(
331 IN MMDEVICE_TYPE DeviceType);
332
333 BOOLEAN
334 IsValidSoundDevice(
335 IN PSOUND_DEVICE SoundDevice);
336
337 MMRESULT
338 ListSoundDevice(
339 IN MMDEVICE_TYPE DeviceType,
340 IN PVOID Identifier OPTIONAL,
341 OUT PSOUND_DEVICE* SoundDevice OPTIONAL);
342
343 MMRESULT
344 UnlistSoundDevice(
345 IN MMDEVICE_TYPE DeviceType,
346 IN PSOUND_DEVICE SoundDevice);
347
348 MMRESULT
349 UnlistSoundDevices(
350 IN MMDEVICE_TYPE DeviceType);
351
352 VOID
353 UnlistAllSoundDevices();
354
355 MMRESULT
356 GetSoundDevice(
357 IN MMDEVICE_TYPE DeviceType,
358 IN DWORD DeviceIndex,
359 OUT PSOUND_DEVICE* Device);
360
361 MMRESULT
362 GetSoundDeviceIdentifier(
363 IN PSOUND_DEVICE SoundDevice,
364 OUT PVOID* Identifier);
365
366 MMRESULT
367 GetSoundDeviceType(
368 IN PSOUND_DEVICE SoundDevice,
369 OUT PMMDEVICE_TYPE DeviceType);
370
371
372 /*
373 functiontable.c
374 */
375
376 MMRESULT
377 SetSoundDeviceFunctionTable(
378 IN PSOUND_DEVICE SoundDevice,
379 IN PMMFUNCTION_TABLE FunctionTable OPTIONAL);
380
381 MMRESULT
382 GetSoundDeviceFunctionTable(
383 IN PSOUND_DEVICE SoundDevice,
384 OUT PMMFUNCTION_TABLE* FunctionTable);
385
386
387 /*
388 deviceinstance.c
389 */
390
391 BOOLEAN
392 IsValidSoundDeviceInstance(
393 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
394
395 MMRESULT
396 CreateSoundDeviceInstance(
397 IN PSOUND_DEVICE SoundDevice,
398 OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance);
399
400 MMRESULT
401 DestroySoundDeviceInstance(
402 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
403
404 MMRESULT
405 DestroyAllSoundDeviceInstances(
406 IN PSOUND_DEVICE SoundDevice);
407
408 MMRESULT
409 GetSoundDeviceFromInstance(
410 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
411 OUT PSOUND_DEVICE* SoundDevice);
412
413 MMRESULT
414 GetSoundDeviceInstanceHandle(
415 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
416 OUT PVOID* Handle);
417
418 MMRESULT
419 SetSoundDeviceInstanceMmeData(
420 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
421 IN HDRVR MmeHandle,
422 IN DWORD ClientCallback,
423 IN DWORD ClientCallbackData,
424 IN DWORD Flags);
425
426
427 /*
428 thread.c
429 */
430
431 MMRESULT
432 CreateSoundThread(
433 OUT PSOUND_THREAD* Thread);
434
435 MMRESULT
436 DestroySoundThread(
437 IN PSOUND_THREAD Thread);
438
439 MMRESULT
440 CallSoundThread(
441 IN PSOUND_THREAD Thread,
442 IN SOUND_THREAD_REQUEST_HANDLER RequestHandler,
443 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance OPTIONAL,
444 IN PVOID Parameter OPTIONAL);
445
446
447 /*
448 utility.c
449 */
450
451 PVOID
452 AllocateMemory(
453 IN UINT Size);
454
455 VOID
456 FreeMemory(
457 IN PVOID Pointer);
458
459 UINT
460 GetMemoryAllocationCount();
461
462 UINT
463 GetDigitCount(
464 IN UINT Number);
465
466 MMRESULT
467 Win32ErrorToMmResult(
468 IN UINT ErrorCode);
469
470 MMRESULT
471 TranslateInternalMmResult(
472 IN MMRESULT Result);
473
474
475 /*
476 wave/format.c
477 */
478
479 MMRESULT
480 QueryWaveDeviceFormatSupport(
481 IN PSOUND_DEVICE SoundDevice,
482 IN LPWAVEFORMATEX Format,
483 IN DWORD FormatSize);
484
485 MMRESULT
486 SetWaveDeviceFormat(
487 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
488 IN LPWAVEFORMATEX Format,
489 IN DWORD FormatSize);
490
491
492 /*
493 wave/header.c
494 */
495
496 MMRESULT
497 PrepareWaveHeader(
498 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
499 IN PWAVEHDR Header);
500
501 MMRESULT
502 UnprepareWaveHeader(
503 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
504 IN PWAVEHDR Header);
505
506 MMRESULT
507 SubmitWaveHeader(
508 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
509 IN PWAVEHDR Header);
510
511
512 /*
513 kernel.c
514 */
515
516 #if 0
517 #define QueryDevice(h, ctl, o, o_size, xfer, ovl) \
518 Win32ErrorToMmResult( \
519 DeviceIoControl(h, ctl, NULL, 0, o, o_size, xfer, ovl) != 0 \
520 ? ERROR_SUCCESS : GetLastError() \
521 )
522
523 #define ControlDevice(h, ctl, i, i_size, xfer, ovl) \
524 Win32ErrorToMmResult( \
525 DeviceIoControl(h, ctl, i, i_size, NULL, 0, xfer, ovl) != 0 \
526 ? ERROR_SUCCESS : GetLastError() \
527 )
528
529 #define QuerySoundDevice(sd, ctl, o, o_size, xfer) \
530 SoundDeviceIoControl(sd, ctl, NULL, 0, o, o_size, xfer)
531
532 #define ControlSoundDevice(sd, ctl, i, i_size, xfer) \
533 SoundDeviceIoControl(sd, ctl, i, i_size, NULL, 0, xfer)
534 #endif
535
536 MMRESULT
537 OpenKernelSoundDeviceByName(
538 IN PWSTR DevicePath,
539 IN BOOLEAN ReadOnly,
540 OUT PHANDLE Handle);
541
542 MMRESULT
543 OpenKernelSoundDevice(
544 IN PSOUND_DEVICE SoundDevice,
545 IN BOOLEAN ReadOnly,
546 OUT PHANDLE Handle);
547
548 MMRESULT
549 CloseKernelSoundDevice(
550 IN HANDLE Handle);
551
552 MMRESULT
553 SyncOverlappedDeviceIoControl(
554 IN HANDLE SoundDeviceInstance,
555 IN DWORD IoControlCode,
556 IN LPVOID InBuffer,
557 IN DWORD InBufferSize,
558 OUT LPVOID OutBuffer,
559 IN DWORD OutBufferSize,
560 OUT LPDWORD BytesTransferred OPTIONAL);
561
562
563 #if 0
564
565 typedef UCHAR MMDEVICE_TYPE, *PMMDEVICE_TYPE;
566
567 struct _SOUND_DEVICE;
568 struct _SOUND_DEVICE_INSTANCE;
569
570
571 /*
572 Rather than pass caps structures around as a PVOID, this can be
573 used instead.
574 */
575
576 typedef union _UNIVERSAL_CAPS
577 {
578 WAVEOUTCAPS WaveOut;
579 WAVEINCAPS WaveIn;
580 MIDIOUTCAPS MidiOut;
581 MIDIINCAPS MidiIn;
582 } UNIVERSAL_CAPS, *PUNIVERSAL_CAPS;
583
584
585
586 /* New sound thread code */
587
588 typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)(
589 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
590 IN OPTIONAL PVOID Parameter);
591
592 typedef struct _SOUND_THREAD_REQUEST
593 {
594 /* The sound device instance this request relates to */
595 struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance;
596 /* What function to call */
597 SOUND_THREAD_REQUEST_HANDLER RequestHandler;
598 /* Caller-defined parameter */
599 PVOID Parameter;
600 /* This will contain the return code of the request function */
601 MMRESULT ReturnValue;
602 } SOUND_THREAD_REQUEST, *PSOUND_THREAD_REQUEST;
603
604 typedef VOID (*SOUND_THREAD_IO_COMPLETION_HANDLER)(
605 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
606 IN PVOID Parameter OPTIONAL,
607 IN DWORD BytesWritten);
608
609 typedef struct _SOUND_THREAD_COMPLETED_IO
610 {
611 struct _SOUND_THREAD_COMPLETED_IO* Previous;
612 struct _SOUND_THREAD_COMPLETED_IO* Next;
613
614 struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance;
615 SOUND_THREAD_IO_COMPLETION_HANDLER CompletionHandler;
616 PVOID Parameter;
617 DWORD BytesTransferred;
618 } SOUND_THREAD_COMPLETED_IO, *PSOUND_THREAD_COMPLETED_IO;
619
620 typedef struct _SOUND_THREAD_OVERLAPPED
621 {
622 OVERLAPPED General;
623
624 /* Pointer to structure to fill with completion data */
625 PSOUND_THREAD_COMPLETED_IO CompletionData;
626 } SOUND_THREAD_OVERLAPPED, *PSOUND_THREAD_OVERLAPPED;
627
628 /*
629 Audio device function table
630 */
631
632 typedef MMRESULT (*MMCREATEINSTANCE_FUNC)(
633 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance);
634
635 typedef VOID (*MMDESTROYINSTANCE_FUNC)(
636 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance);
637
638 typedef MMRESULT (*MMGETCAPS_FUNC)(
639 IN struct _SOUND_DEVICE* Device,
640 OUT PUNIVERSAL_CAPS Capabilities);
641
642 typedef MMRESULT (*MMWAVEQUERYFORMAT_FUNC)(
643 IN struct _SOUND_DEVICE* Device,
644 IN PWAVEFORMATEX WaveFormat,
645 IN DWORD WaveFormatSize);
646
647 typedef MMRESULT (*MMWAVESETFORMAT_FUNC)(
648 IN struct _SOUND_DEVICE_INSTANCE* Instance,
649 IN PWAVEFORMATEX WaveFormat,
650 IN DWORD WaveFormatSize);
651
652 typedef MMRESULT (*MMWAVEQUEUEBUFFER_FUNC)(
653 IN struct _SOUND_DEVICE_INSTANCE* Instance,
654 IN PWAVEHDR WaveHeader);
655
656 typedef MMRESULT (*MMGETWAVESTATE_FUNC)(
657 IN struct _SOUND_DEVICE_INSTANCE* Instance,
658 OUT PULONG State);
659
660 typedef MMRESULT (*MMSETWAVESTATE_FUNC)(
661 IN struct _SOUND_DEVICE_INSTANCE* Instance);
662
663 typedef struct _MMFUNCTION_TABLE
664 {
665 MMCREATEINSTANCE_FUNC Constructor;
666 MMDESTROYINSTANCE_FUNC Destructor;
667 MMGETCAPS_FUNC GetCapabilities;
668
669 MMWAVEQUERYFORMAT_FUNC QueryWaveFormat;
670 MMWAVESETFORMAT_FUNC SetWaveFormat;
671 MMWAVEQUEUEBUFFER_FUNC QueueWaveBuffer;
672
673 MMGETWAVESTATE_FUNC GetWaveDeviceState;
674 MMSETWAVESTATE_FUNC PauseWaveDevice;
675 MMSETWAVESTATE_FUNC RestartWaveDevice;
676 MMSETWAVESTATE_FUNC ResetWaveDevice;
677 MMSETWAVESTATE_FUNC BreakWaveDeviceLoop;
678 } MMFUNCTION_TABLE, *PMMFUNCTION_TABLE;
679
680
681 /*
682 Represents an audio device
683 */
684
685 #define SOUND_DEVICE_TAG "SndD"
686
687 typedef struct _SOUND_DEVICE
688 {
689 struct _SOUND_DEVICE* Next;
690 struct _SOUND_DEVICE_INSTANCE* FirstInstance;
691 UCHAR DeviceType;
692 LPWSTR DevicePath;
693 MMFUNCTION_TABLE Functions;
694 } SOUND_DEVICE, *PSOUND_DEVICE;
695
696
697 /*
698 Represents an individual instance of an audio device
699 */
700
701 #define WAVE_STREAM_INFO_TAG "WavS"
702
703 typedef struct _WAVE_STREAM_INFO
704 {
705 /* Buffer queue head and tail */
706 PWAVEHDR BufferQueueHead;
707 PWAVEHDR BufferQueueTail;
708 /* The buffer currently being processed */
709 PWAVEHDR CurrentBuffer;
710 /* How far into the current buffer we've gone */
711 DWORD BufferOffset;
712 /* How many I/O operations have been submitted */
713 DWORD BuffersOutstanding;
714 /* Looping */
715 PWAVEHDR LoopHead;
716 DWORD LoopsRemaining;
717 } WAVE_STREAM_INFO, *PWAVE_STREAM_INFO;
718
719
720 #define SOUND_DEVICE_INSTANCE_TAG "SndI"
721
722 typedef struct _SOUND_DEVICE_INSTANCE
723 {
724 struct _SOUND_DEVICE_INSTANCE* Next;
725 PSOUND_DEVICE Device;
726
727 /* The currently opened handle to the device */
728 HANDLE Handle;
729 /* PSOUND_THREAD Thread;*/
730
731
732 /* Device-specific parameters */
733 union
734 {
735 WAVE_STREAM_INFO Wave;
736 } Streaming;
737 } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
738
739 #endif
740
741 #endif