ReactOS 0.4.15-dev-7834-g00c4b3d
format.c
Go to the documentation of this file.
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/wave/format.c
5 *
6 * PURPOSE: Queries and sets wave device format (sample rate, etc.)
7 *
8 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
9*/
10
11#include "precomp.h"
12
15 IN PSOUND_DEVICE SoundDevice,
17 IN DWORD FormatSize)
18{
22
23 SND_TRACE(L"Querying wave format support\n");
24
27 VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) );
28
29 Result = GetSoundDeviceType(SoundDevice, &DeviceType);
31
32 /* Ensure we have a wave device (TODO: check if this applies to wavein as well) */
34
35 /* Obtain the function table */
38
39 if ( ! MMSUCCESS(Result) )
41
42 if ( ! FunctionTable->QueryWaveFormatSupport )
44
45 return FunctionTable->QueryWaveFormatSupport(SoundDevice, Format, FormatSize);
46}
47
50 IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
51 IN DWORD DeviceId,
53 IN DWORD FormatSize)
54{
58 PSOUND_DEVICE SoundDevice;
59
60 SND_TRACE(L"Setting wave format\n");
61
63
64 Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
65 if ( ! MMSUCCESS(Result) )
67
68 Result = GetSoundDeviceType(SoundDevice, &DeviceType);
71 {
73 VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) );
74 }
75
76 /* Ensure we have a wave device (TODO: check if this applies to wavein as well) */
78
79 /* Obtain the function table */
82
83 if ( ! MMSUCCESS(Result) )
85
86 if ( ! FunctionTable->SetWaveFormat )
88
89 return FunctionTable->SetWaveFormat(SoundDeviceInstance, DeviceId, Format, FormatSize);
90}
unsigned long DWORD
Definition: ntddk_ex.h:95
DeviceType
Definition: mmdrv.h:42
BOOLEAN IsValidSoundDevice(IN PSOUND_DEVICE SoundDevice)
Definition: devicelist.c:87
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
MMRESULT GetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, OUT PMMFUNCTION_TABLE *FunctionTable)
Definition: functiontable.c:47
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
BOOLEAN IsValidSoundDeviceInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
#define SND_TRACE(...)
#define SND_ASSERT(condition)
UINT MMRESULT
Definition: mmsystem.h:962
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define L(x)
Definition: ntvdm.h:50
MMRESULT SetWaveDeviceFormat(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN DWORD DeviceId, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: format.c:49
MMRESULT QueryWaveDeviceFormatSupport(IN PSOUND_DEVICE SoundDevice, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: format.c:14
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28
@ WAVE_OUT_DEVICE_TYPE
Definition: sndtypes.h:29
#define IS_MIDI_DEVICE_TYPE(x)
Definition: sndtypes.h:49
#define IS_WAVE_DEVICE_TYPE(x)
Definition: sndtypes.h:46
#define IS_MIXER_DEVICE_TYPE(x)
Definition: sndtypes.h:55
#define IN
Definition: typedefs.h:39
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:722
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409