WaveHdr prepare/unprepare/submit now gets handled within the context of the
[reactos.git] / reactos / lib / drivers / sound / mmebuddy / functiontable.c
1 /*
2 * PROJECT: ReactOS Sound System "MME Buddy" Library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/drivers/sound/mmebuddy/functiontable.c
5 *
6 * PURPOSE: Routes function calls through a function table, calling
7 * implementation-defined routines or a default function, depending
8 * on configuration.
9 *
10 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
11 */
12
13 #include <windows.h>
14 #include <mmsystem.h>
15 #include <mmddk.h>
16 #include <mmebuddy.h>
17
18 /*
19 Attaches a function table to a sound device. Any NULL entries in this
20 table are automatically set to point to a default routine to handle
21 the appropriate function.
22 */
23 MMRESULT
24 SetSoundDeviceFunctionTable(
25 IN PSOUND_DEVICE SoundDevice,
26 IN PMMFUNCTION_TABLE FunctionTable)
27 {
28 VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
29 VALIDATE_MMSYS_PARAMETER( FunctionTable );
30
31 /* Zero out the existing function table (if present) */
32 ZeroMemory(&SoundDevice->FunctionTable, sizeof(MMFUNCTION_TABLE));
33
34 if ( ! FunctionTable )
35 return MMSYSERR_INVALPARAM;
36
37 /* Fill in the client-supplied functions */
38 CopyMemory(&SoundDevice->FunctionTable,
39 FunctionTable,
40 sizeof(MMFUNCTION_TABLE));
41
42 return MMSYSERR_NOERROR;
43 }
44
45 /*
46 Retrieves the function table for a sound device, as previously set using
47 SetSoundDeviceFunctionTable.
48 */
49 MMRESULT
50 GetSoundDeviceFunctionTable(
51 IN PSOUND_DEVICE SoundDevice,
52 OUT PMMFUNCTION_TABLE* FunctionTable)
53 {
54 VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
55 VALIDATE_MMSYS_PARAMETER( FunctionTable );
56
57 *FunctionTable = &SoundDevice->FunctionTable;
58
59 return MMSYSERR_NOERROR;
60 }