Author: janderwald
Date: Wed Oct 7 11:10:00 2009
New Revision: 43318
URL:
http://svn.reactos.org/svn/reactos?rev=43318&view=rev
Log:
- Implement support for reading from waveIn devices
Modified:
trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c
Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Wed Oct 7 11:10:00 2009
@@ -435,8 +435,12 @@
IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
{
HANDLE Handle;
+ MMRESULT Result;
WDMAUD_DEVICE_INFO DeviceInfo;
-
+ PSOUND_DEVICE SoundDevice;
+ MMDEVICE_TYPE DeviceType;
+ BOOL Ret;
+ DWORD BytesTransferred;
VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance );
VALIDATE_MMSYS_PARAMETER( OffsetPtr );
@@ -445,28 +449,46 @@
GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
+
+ Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
+
+ if ( ! MMSUCCESS(Result) )
+ {
+ return TranslateInternalMmResult(Result);
+ }
+
+ Result = GetSoundDeviceType(SoundDevice, &DeviceType);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
SND_ASSERT(Handle);
ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO));
+
DeviceInfo.Header.FrameExtent = Length;
- DeviceInfo.Header.DataUsed = Length;
+ if (DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ DeviceInfo.Header.DataUsed = Length;
+ }
DeviceInfo.Header.Data = OffsetPtr;
- DeviceInfo.Header.Size = sizeof(KSSTREAM_HEADER);
+ DeviceInfo.Header.Size = sizeof(WDMAUD_DEVICE_INFO);
DeviceInfo.Header.PresentationTime.Numerator = 1;
DeviceInfo.Header.PresentationTime.Denominator = 1;
DeviceInfo.hDevice = Handle;
- DeviceInfo.DeviceType = WAVE_OUT_DEVICE_TYPE; //FIXME
+ DeviceInfo.DeviceType = DeviceType;
Overlap->Standard.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
- if ( ! WriteFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO),
(LPOVERLAPPED)Overlap, CompletionRoutine))
- {
- SND_TRACE(L"WriteFileEx failed with %x\n", GetLastError());
- }
- else
- {
- WaitForSingleObjectEx (KernelHandle, INFINITE, TRUE);
-
+ if (DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ Ret = WriteFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO),
(LPOVERLAPPED)Overlap, CompletionRoutine);
+ if (Ret)
+ WaitForSingleObjectEx (KernelHandle, INFINITE, TRUE);
+ }
+ else if (DeviceType == WAVE_IN_DEVICE_TYPE)
+ {
+ Ret = ReadFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO),
(LPOVERLAPPED)Overlap, CompletionRoutine);
+ if (Ret)
+ WaitForSingleObjectEx (KernelHandle, INFINITE, TRUE);
}
return MMSYSERR_NOERROR;