41 if ( SoundDeviceInstance->OutstandingBuffers >= SoundDeviceInstance->BufferCount )
43 SND_TRACE(
L"DoWaveStreaming: No available buffers to stream with - doing nothing\n");
48 Header = SoundDeviceInstance->HeadWaveHeader;
52 SND_TRACE(
L"DoWaveStreaming: No work to do - doing nothing\n");
62 SoundDeviceInstance->LoopsRemaining =
Header->dwLoops;
67 SND_WARN(
L"Looping multiple headers is UNIMPLEMENTED. Will play once only\n");
72 while ( ( SoundDeviceInstance->OutstandingBuffers < SoundDeviceInstance->BufferCount ) &&
73 (
Header ) && SoundDeviceInstance->ResetInProgress ==
FALSE)
98 DWORD BytesRemaining, BytesToCommit;
108 BytesToCommit = BytesRemaining > SoundDeviceInstance->FrameSize ?
109 SoundDeviceInstance->FrameSize :
126 ++ SoundDeviceInstance->OutstandingBuffers;
141 -- SoundDeviceInstance->OutstandingBuffers;
170 IN DWORD dwNumberOfBytesTransferred,
210 dwNumberOfBytesTransferred -=
Bytes;
239 WaveHdr = WaveHdr->
lpNext;
252 }
while(dwNumberOfBytesTransferred);
307 SoundDeviceInstance->ResetInProgress =
TRUE;
327 while(SoundDeviceInstance->OutstandingBuffers)
329 SND_TRACE(
L"StopStreamingInSoundThread OutStandingBufferCount %lu\n", SoundDeviceInstance->OutstandingBuffers);
335 while( SoundDeviceInstance->HeadWaveHeader )
337 SND_TRACE(
L"StopStreamingInSoundThread: Completing Header %p\n", SoundDeviceInstance->HeadWaveHeader);
342 SND_ASSERT(SoundDeviceInstance->OutstandingBuffers == 0);
353 SoundDeviceInstance->ResetInProgress =
FALSE;
static VOID FreeMemory(PCREATE_DATA Data)
BOOL WINAPI WriteFileEx(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
VOID WINAPI ExitThread(IN DWORD uExitCode)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
struct _WAVEHDR_EXTENSION * PWAVEHDR_EXTENSION
struct _SOUND_OVERLAPPED * PSOUND_OVERLAPPED
MMRESULT CallSoundThread(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN SOUND_THREAD_REQUEST_HANDLER RequestHandler, IN PVOID Parameter OPTIONAL)
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
#define AllocateStruct(thing)
MMRESULT GetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, OUT PMMFUNCTION_TABLE *FunctionTable)
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
VOID CompleteWaveHeader(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PWAVEHDR Header)
#define MMSUCCESS(result)
BOOLEAN IsValidSoundDeviceInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
#define SND_ASSERT(condition)
struct wavehdr_tag * PWAVEHDR
#define MMSYSERR_NOTSUPPORTED
#define MMSYSERR_INVALHANDLE
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
_In_ ULONG _In_ ULONG _In_ ULONG Length
MMRESULT WriteFileEx_Committer(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
VOID DoWaveStreaming(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
VOID InitiateSoundStreaming(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
MMRESULT StopStreaming(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
MMRESULT StopStreamingInSoundThread(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Parameter)
DWORD WINAPI WaveActivateSoundStreaming(IN PVOID lpParameter)
VOID CALLBACK CompleteIO(IN DWORD dwErrorCode, IN DWORD dwNumberOfBytesTransferred, IN LPOVERLAPPED lpOverlapped)
MMRESULT PerformWaveStreaming(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Parameter)
struct _SOUND_DEVICE_INSTANCE * SoundDeviceInstance
struct wavehdr_tag * lpNext
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
#define OK(condition, fail_message,...)
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
void(CALLBACK * LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPOVERLAPPED)
static WLX_DISPATCH_VERSION_1_4 FunctionTable
_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
_Inout_opt_ PVOID Parameter