Fixed build by including the correct header this time!
[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 MmeEnqueueWaveHeader(private_handle, header) \
311 EnqueueWaveHeader((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);
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_DEVICE_INSTANCE SoundDeviceInstance,
442 IN SOUND_THREAD_REQUEST_HANDLER RequestHandler,
443 IN PVOID Parameter OPTIONAL);
444
445
446 /*
447 utility.c
448 */
449
450 PVOID
451 AllocateMemory(
452 IN UINT Size);
453
454 VOID
455 FreeMemory(
456 IN PVOID Pointer);
457
458 UINT
459 GetMemoryAllocationCount();
460
461 UINT
462 GetDigitCount(
463 IN UINT Number);
464
465 MMRESULT
466 Win32ErrorToMmResult(
467 IN UINT ErrorCode);
468
469 MMRESULT
470 TranslateInternalMmResult(
471 IN MMRESULT Result);
472
473
474 /*
475 wave/format.c
476 */
477
478 MMRESULT
479 QueryWaveDeviceFormatSupport(
480 IN PSOUND_DEVICE SoundDevice,
481 IN LPWAVEFORMATEX Format,
482 IN DWORD FormatSize);
483
484 MMRESULT
485 SetWaveDeviceFormat(
486 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
487 IN LPWAVEFORMATEX Format,
488 IN DWORD FormatSize);
489
490
491 /*
492 wave/header.c
493 */
494
495 MMRESULT
496 PrepareWaveHeader(
497 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
498 IN PWAVEHDR Header);
499
500 MMRESULT
501 UnprepareWaveHeader(
502 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
503 IN PWAVEHDR Header);
504
505 MMRESULT
506 EnqueueWaveHeader(
507 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
508 IN PWAVEHDR Header);
509
510
511 /*
512 kernel.c
513 */
514
515 #if 0
516 #define QueryDevice(h, ctl, o, o_size, xfer, ovl) \
517 Win32ErrorToMmResult( \
518 DeviceIoControl(h, ctl, NULL, 0, o, o_size, xfer, ovl) != 0 \
519 ? ERROR_SUCCESS : GetLastError() \
520 )
521
522 #define ControlDevice(h, ctl, i, i_size, xfer, ovl) \
523 Win32ErrorToMmResult( \
524 DeviceIoControl(h, ctl, i, i_size, NULL, 0, xfer, ovl) != 0 \
525 ? ERROR_SUCCESS : GetLastError() \
526 )
527
528 #define QuerySoundDevice(sd, ctl, o, o_size, xfer) \
529 SoundDeviceIoControl(sd, ctl, NULL, 0, o, o_size, xfer)
530
531 #define ControlSoundDevice(sd, ctl, i, i_size, xfer) \
532 SoundDeviceIoControl(sd, ctl, i, i_size, NULL, 0, xfer)
533 #endif
534
535 MMRESULT
536 OpenKernelSoundDeviceByName(
537 IN PWSTR DevicePath,
538 IN BOOLEAN ReadOnly,
539 OUT PHANDLE Handle);
540
541 MMRESULT
542 OpenKernelSoundDevice(
543 IN PSOUND_DEVICE SoundDevice,
544 IN BOOLEAN ReadOnly,
545 OUT PHANDLE Handle);
546
547 MMRESULT
548 CloseKernelSoundDevice(
549 IN HANDLE Handle);
550
551 MMRESULT
552 SyncOverlappedDeviceIoControl(
553 IN HANDLE SoundDeviceInstance,
554 IN DWORD IoControlCode,
555 IN LPVOID InBuffer,
556 IN DWORD InBufferSize,
557 OUT LPVOID OutBuffer,
558 IN DWORD OutBufferSize,
559 OUT LPDWORD BytesTransferred OPTIONAL);
560
561
562 #if 0
563
564 typedef UCHAR MMDEVICE_TYPE, *PMMDEVICE_TYPE;
565
566 struct _SOUND_DEVICE;
567 struct _SOUND_DEVICE_INSTANCE;
568
569
570 /*
571 Rather than pass caps structures around as a PVOID, this can be
572 used instead.
573 */
574
575 typedef union _UNIVERSAL_CAPS
576 {
577 WAVEOUTCAPS WaveOut;
578 WAVEINCAPS WaveIn;
579 MIDIOUTCAPS MidiOut;
580 MIDIINCAPS MidiIn;
581 } UNIVERSAL_CAPS, *PUNIVERSAL_CAPS;
582
583
584
585 /* New sound thread code */
586
587 typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)(
588 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
589 IN OPTIONAL PVOID Parameter);
590
591 typedef struct _SOUND_THREAD_REQUEST
592 {
593 /* The sound device instance this request relates to */
594 struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance;
595 /* What function to call */
596 SOUND_THREAD_REQUEST_HANDLER RequestHandler;
597 /* Caller-defined parameter */
598 PVOID Parameter;
599 /* This will contain the return code of the request function */
600 MMRESULT ReturnValue;
601 } SOUND_THREAD_REQUEST, *PSOUND_THREAD_REQUEST;
602
603 typedef VOID (*SOUND_THREAD_IO_COMPLETION_HANDLER)(
604 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
605 IN PVOID Parameter OPTIONAL,
606 IN DWORD BytesWritten);
607
608 typedef struct _SOUND_THREAD_COMPLETED_IO
609 {
610 struct _SOUND_THREAD_COMPLETED_IO* Previous;
611 struct _SOUND_THREAD_COMPLETED_IO* Next;
612
613 struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance;
614 SOUND_THREAD_IO_COMPLETION_HANDLER CompletionHandler;
615 PVOID Parameter;
616 DWORD BytesTransferred;
617 } SOUND_THREAD_COMPLETED_IO, *PSOUND_THREAD_COMPLETED_IO;
618
619 typedef struct _SOUND_THREAD_OVERLAPPED
620 {
621 OVERLAPPED General;
622
623 /* Pointer to structure to fill with completion data */
624 PSOUND_THREAD_COMPLETED_IO CompletionData;
625 } SOUND_THREAD_OVERLAPPED, *PSOUND_THREAD_OVERLAPPED;
626
627 /*
628 Audio device function table
629 */
630
631 typedef MMRESULT (*MMCREATEINSTANCE_FUNC)(
632 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance);
633
634 typedef VOID (*MMDESTROYINSTANCE_FUNC)(
635 IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance);
636
637 typedef MMRESULT (*MMGETCAPS_FUNC)(
638 IN struct _SOUND_DEVICE* Device,
639 OUT PUNIVERSAL_CAPS Capabilities);
640
641 typedef MMRESULT (*MMWAVEQUERYFORMAT_FUNC)(
642 IN struct _SOUND_DEVICE* Device,
643 IN PWAVEFORMATEX WaveFormat,
644 IN DWORD WaveFormatSize);
645
646 typedef MMRESULT (*MMWAVESETFORMAT_FUNC)(
647 IN struct _SOUND_DEVICE_INSTANCE* Instance,
648 IN PWAVEFORMATEX WaveFormat,
649 IN DWORD WaveFormatSize);
650
651 typedef MMRESULT (*MMWAVEQUEUEBUFFER_FUNC)(
652 IN struct _SOUND_DEVICE_INSTANCE* Instance,
653 IN PWAVEHDR WaveHeader);
654
655 typedef MMRESULT (*MMGETWAVESTATE_FUNC)(
656 IN struct _SOUND_DEVICE_INSTANCE* Instance,
657 OUT PULONG State);
658
659 typedef MMRESULT (*MMSETWAVESTATE_FUNC)(
660 IN struct _SOUND_DEVICE_INSTANCE* Instance);
661
662 typedef struct _MMFUNCTION_TABLE
663 {
664 MMCREATEINSTANCE_FUNC Constructor;
665 MMDESTROYINSTANCE_FUNC Destructor;
666 MMGETCAPS_FUNC GetCapabilities;
667
668 MMWAVEQUERYFORMAT_FUNC QueryWaveFormat;
669 MMWAVESETFORMAT_FUNC SetWaveFormat;
670 MMWAVEQUEUEBUFFER_FUNC QueueWaveBuffer;
671
672 MMGETWAVESTATE_FUNC GetWaveDeviceState;
673 MMSETWAVESTATE_FUNC PauseWaveDevice;
674 MMSETWAVESTATE_FUNC RestartWaveDevice;
675 MMSETWAVESTATE_FUNC ResetWaveDevice;
676 MMSETWAVESTATE_FUNC BreakWaveDeviceLoop;
677 } MMFUNCTION_TABLE, *PMMFUNCTION_TABLE;
678
679
680 /*
681 Represents an audio device
682 */
683
684 #define SOUND_DEVICE_TAG "SndD"
685
686 typedef struct _SOUND_DEVICE
687 {
688 struct _SOUND_DEVICE* Next;
689 struct _SOUND_DEVICE_INSTANCE* FirstInstance;
690 UCHAR DeviceType;
691 LPWSTR DevicePath;
692 MMFUNCTION_TABLE Functions;
693 } SOUND_DEVICE, *PSOUND_DEVICE;
694
695
696 /*
697 Represents an individual instance of an audio device
698 */
699
700 #define WAVE_STREAM_INFO_TAG "WavS"
701
702 typedef struct _WAVE_STREAM_INFO
703 {
704 /* Buffer queue head and tail */
705 PWAVEHDR BufferQueueHead;
706 PWAVEHDR BufferQueueTail;
707 /* The buffer currently being processed */
708 PWAVEHDR CurrentBuffer;
709 /* How far into the current buffer we've gone */
710 DWORD BufferOffset;
711 /* How many I/O operations have been submitted */
712 DWORD BuffersOutstanding;
713 /* Looping */
714 PWAVEHDR LoopHead;
715 DWORD LoopsRemaining;
716 } WAVE_STREAM_INFO, *PWAVE_STREAM_INFO;
717
718
719 #define SOUND_DEVICE_INSTANCE_TAG "SndI"
720
721 typedef struct _SOUND_DEVICE_INSTANCE
722 {
723 struct _SOUND_DEVICE_INSTANCE* Next;
724 PSOUND_DEVICE Device;
725
726 /* The currently opened handle to the device */
727 HANDLE Handle;
728 /* PSOUND_THREAD Thread;*/
729
730
731 /* Device-specific parameters */
732 union
733 {
734 WAVE_STREAM_INFO Wave;
735 } Streaming;
736 } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
737
738 #endif
739
740 #endif