Author: silverblade Date: Fri Jul 11 18:45:12 2008 New Revision: 34431
URL: http://svn.reactos.org/svn/reactos?rev=34431&view=rev Log: Removed custom debug printing macros and replaced with DPRINTs.
Modified: branches/silverblade-audio/dll/win32/mmdrv/testing.c branches/silverblade-audio/dll/win32/sndblst/sndblst.c branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c
Modified: branches/silverblade-audio/dll/win32/mmdrv/testing.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/mmdr... ============================================================================== --- branches/silverblade-audio/dll/win32/mmdrv/testing.c [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/mmdrv/testing.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -212,11 +212,11 @@
/* Report the number of wave output devices */ NumWaveOuts = wodMessage(0, WODM_GETNUMDEVS, 0, 0, 0); - SOUND_DEBUG_HEX(NumWaveOuts); + DPRINT("Wave outs = %d\n", NumWaveOuts);
if ( NumWaveOuts < 1 ) { - SOUND_DEBUG(L"Nothing to do as no waveout devices!"); + DPRINT("Nothing to do as no waveout devices!"); return; }
Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/sndb... ============================================================================== --- branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -108,7 +108,8 @@
RemoveAllSoundDevices();
- SOUND_DEBUG_HEX(GetMemoryAllocations()); +// SOUND_DEBUG_HEX(GetMemoryAllocations()); + DPRINT("Leaving driver with %d memory allocations present\n", GetMemoryAllocations());
return 1L;
@@ -179,9 +180,9 @@ //SOUND_DEBUG(L"WODM_OPEN test 2"); OpenDesc.lpFormat = &Format; Result = wodMessage(0, WODM_OPEN, (DWORD) &InstanceData, (DWORD) &OpenDesc, 0); - SOUND_DEBUG_HEX(Result); - - SOUND_DEBUG(L"WODM_WRITE test"); + /*SOUND_DEBUG_HEX(Result);*/ + + POPUP("Click for WODM_WRITE test"); WaveHeaders[0].lpData = (PVOID) Buffer; WaveHeaders[0].dwBufferLength = 1000000; WaveHeaders[0].dwFlags = WHDR_PREPARED; @@ -216,9 +217,9 @@
// SOUND_DEBUG_HEX(Result);
- SOUND_DEBUG(L"WODM_CLOSE test"); + POPUP("Click for WODM_CLOSE test"); Result = wodMessage(0, WODM_CLOSE, (DWORD) InstanceData, (DWORD) 0, 0); - SOUND_DEBUG_HEX(Result); + /* SOUND_DEBUG_HEX(Result); */
/* DRV_UNLOAD */ DriverProc(0, 0, DRV_FREE, 0, 0);
Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/reacto... ============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -22,43 +22,12 @@ Hacky debug macro */
-#include <stdio.h> -#define SOUND_TRACE printf - -#define SOUND_DEBUG(x) \ - MessageBox(0, x, L"Debug", MB_OK | MB_TASKMODAL); - -#define SOUND_DEBUG_HEX(x) \ - { \ - WCHAR dbgmsg[1024], dbgtitle[1024]; \ - wsprintf(dbgtitle, L"%hS[%d]", __FILE__, __LINE__); \ - wsprintf(dbgmsg, L"%hS == %x", #x, x); \ - MessageBox(0, dbgmsg, dbgtitle, MB_OK | MB_TASKMODAL); \ - } - -#define SOUND_ASSERT(x) \ - { \ - if ( ! ( x ) ) \ - { \ - WCHAR dbgmsg[1024], dbgtitle[1024]; \ - wsprintf(dbgtitle, L"%hS[%d]", __FILE__, __LINE__); \ - wsprintf(dbgmsg, L"ASSERT FAILED:\n%hS", #x); \ - MessageBox(0, dbgmsg, dbgtitle, MB_OK | MB_TASKMODAL); \ - exit(1); \ - } \ - } +#define POPUP(msg) \ + MessageBoxA(0, msg, __FUNCTION__, MB_OK | MB_TASKMODAL)
/* Some memory allocation helper macros -*/ - -/* -#define AllocateMemory(size) \ - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size) - -#define FreeMemory(ptr) \ - HeapFree(GetProcessHeap(), 0, ptr) */
#define AllocateMemoryFor(thing) \
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -196,7 +196,7 @@ { if ( CurrentDevice == SoundDevice ) { - SOUND_ASSERT(PreviousDevice != NULL); + ASSERT(PreviousDevice != NULL); PreviousDevice->Next = CurrentDevice->Next;
break; @@ -526,17 +526,17 @@ DWORD AccessRights = GENERIC_READ; MMRESULT Result;
- SOUND_DEBUG(L"Default instance ctor"); - - SOUND_ASSERT(SoundDeviceInstance != NULL); + DPRINT("Default instance ctor"); + + ASSERT(SoundDeviceInstance != NULL); GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - SOUND_ASSERT(SoundDevice != NULL); + ASSERT(SoundDevice != NULL);
/* If this fails, we have an internal error somewhere */ Result = GetSoundDeviceType(SoundDevice, &DeviceType); if ( Result != MMSYSERR_NOERROR ) { - SOUND_ASSERT(Result != MMSYSERR_NOERROR); + ASSERT(Result != MMSYSERR_NOERROR); return MMSYSERR_ERROR; }
@@ -547,7 +547,7 @@ if ( Result != MMSYSERR_NOERROR ) return Result;
- SOUND_DEBUG(L"Returning from default ctor"); + DPRINT("Returning from default ctor");
return MMSYSERR_NOERROR; } @@ -560,11 +560,11 @@ PSOUND_DEVICE SoundDevice; MMRESULT Result;
- SOUND_DEBUG(L"Default instance dtor"); - - SOUND_ASSERT(SoundDeviceInstance); + DPRINT("Default instance dtor"); + + ASSERT(SoundDeviceInstance); GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - SOUND_ASSERT(SoundDevice); + ASSERT(SoundDevice);
Result = CloseKernelSoundDevice(SoundDevice);
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -66,9 +66,9 @@ { PSOUND_DEVICE_INSTANCE CurrentInstance = NULL;
- SOUND_ASSERT(SoundDevice != NULL); - SOUND_ASSERT(SoundDeviceInstance != NULL); - SOUND_ASSERT(SoundDeviceInstance->Device == NULL); + ASSERT(SoundDevice != NULL); + ASSERT(SoundDeviceInstance != NULL); + ASSERT(SoundDeviceInstance->Device == NULL);
SoundDeviceInstance->Device = SoundDevice;
@@ -161,9 +161,9 @@ Result = SoundDevice->Functions.Constructor(CreatedInstance); if ( Result != MMSYSERR_NOERROR ) { - SOUND_DEBUG(L"Custom ctor returned failure - unlisting"); + DPRINT("Custom ctor returned failure - unlisting"); UnlistSoundDeviceInstance(CreatedInstance); - SOUND_DEBUG(L"Freeing"); + DPRINT("Freeing"); FreeSoundDeviceInstance(CreatedInstance); CreatedInstance = NULL; //DestroySoundDeviceInstance(CreatedInstance);
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -30,13 +30,13 @@
if ( ! Handle ) { - MessageBox(0, L"Failed handle", L"kernel.c", MB_OK | MB_TASKMODAL); + DPRINT("No handle ptr\n"); return MMSYSERR_INVALPARAM; }
if ( ! DeviceName ) { - MessageBox(0, L"Failed devname", L"kernel.c", MB_OK | MB_TASKMODAL); + DPRINT("No device name\n"); return MMSYSERR_INVALPARAM; }
@@ -45,8 +45,7 @@ OpenFlags = FILE_FLAG_OVERLAPPED; }
- DPRINT("Attempting to open '%ws'\n", DeviceName); - MessageBox(0, DeviceName, L"Attempting to open", MB_OK | MB_TASKMODAL); + DPRINT("Attempting to open '%s'\n", DeviceName);
*Handle = CreateFile(DeviceName, AccessRights, @@ -58,6 +57,7 @@
if ( *Handle == INVALID_HANDLE_VALUE ) { + DPRINT("Failed to open\n"); return Win32ErrorToMmResult(GetLastError()); }
@@ -73,13 +73,13 @@
if ( ! SoundDevice ) { - SOUND_DEBUG(L"No sound device specified"); + DPRINT("No sound device specified"); return MMSYSERR_INVALPARAM; }
if ( SoundDevice->Handle != INVALID_HANDLE_VALUE ) { - SOUND_DEBUG(L"Already open?"); + DPRINT("Already open?"); return MMSYSERR_ERROR; /*MMSYSERR_ALLOC;*/ }
@@ -215,22 +215,21 @@ LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine, LPOVERLAPPED Overlapped) { - WCHAR msg[128]; if ( ( ! SoundDeviceInstance ) || ( ! Buffer ) || ( BufferSize == 0 ) ) { - SOUND_DEBUG(L"Invalid parameter!\n"); + DPRINT("Invalid parameter in WriteSoundDeviceBuffer!\n"); return MMSYSERR_INVALPARAM; }
/*wsprintf(msg, L"Writing to handle %x", SoundDeviceInstance->Device->Handle);*/ /*SOUND_DEBUG(msg);*/
- SOUND_TRACE("WriteFileEx(%p, %p, %d, %p, %p)\n", - SoundDeviceInstance->Device->Handle, - Buffer, - (int) BufferSize, - Overlapped, - CompletionRoutine); + DPRINT("WriteFileEx(%p, %p, %d, %p, %p)\n", + SoundDeviceInstance->Device->Handle, + Buffer, + (int) BufferSize, + Overlapped, + CompletionRoutine);
if ( ! WriteFileEx(SoundDeviceInstance->Device->Handle, Buffer, @@ -238,8 +237,7 @@ Overlapped, CompletionRoutine) ) { - wsprintf(msg, L"Win32 Error %d", GetLastError()); - SOUND_DEBUG(msg); + DPRINT("WriteFileEx -- Win32 Error %d", GetLastError()); return Win32ErrorToMmResult(GetLastError()); }
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mme/wodMessage.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -33,7 +33,7 @@ PSOUND_DEVICE_INSTANCE Instance = (PSOUND_DEVICE_INSTANCE)private_handle;
- SOUND_TRACE("wodMessageStub called\n"); + DPRINT("wodMessageStub called\n");
switch ( message ) { @@ -64,7 +64,7 @@ { WAVEOPENDESC* OpenParameters = (WAVEOPENDESC*) parameter1;
- SOUND_TRACE("In WODM_OPEN\n"); + DPRINT("In WODM_OPEN\n"); Result = GetSoundDevice(WAVE_OUT_DEVICE_TYPE, device_id, &Device); if ( Result != MMSYSERR_NOERROR ) return Result; @@ -105,12 +105,12 @@ case WODM_CLOSE : { //SOUND_DEBUG_HEX(Instance); - SOUND_ASSERT(Instance != NULL); + ASSERT(Instance != NULL);
/* TODO: Ensure its OK to close */
Result = DestroySoundDeviceInstance(Instance); - SOUND_DEBUG_HEX(Result); + /*SOUND_DEBUG_HEX(Result);*/
/* TODO: When do we send the callback? */
@@ -120,8 +120,8 @@
case WODM_WRITE : { - SOUND_ASSERT(Instance != NULL); - SOUND_ASSERT(parameter1 != 0); + ASSERT(Instance != NULL); + ASSERT(parameter1 != 0);
return QueueWaveDeviceBuffer(Instance, (PWAVEHDR) parameter1); }
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -22,9 +22,6 @@
#include <mmebuddy.h>
-/* HAX */ -#include <stdio.h> - static BOOLEAN ThreadRunning = FALSE; static HANDLE SoundThread = INVALID_HANDLE_VALUE; static HANDLE ReadyEvent = INVALID_HANDLE_VALUE; @@ -58,10 +55,10 @@ DPRINT("** I/O has completed\n");
SoundOverlapped = (PSOUND_THREAD_OVERLAPPED) lpOverlapped; - SOUND_ASSERT(SoundOverlapped); + ASSERT(SoundOverlapped);
CompletionData = SoundOverlapped->CompletionData; - SOUND_ASSERT(CompletionData); + ASSERT(CompletionData);
CompletionData->BytesTransferred = dwNumberOfBytesTransferred;
@@ -70,7 +67,7 @@ { DPRINT("First completion - making new head and tail\n"); /* This is the first completion */ - SOUND_ASSERT(CompletedIoListTail == NULL); + ASSERT(CompletedIoListTail);
CompletionData->Previous = NULL; CompletionData->Next = NULL; @@ -81,13 +78,13 @@ else { DPRINT("Not the first completion - making new tail\n"); - SOUND_ASSERT(CompletionData); + ASSERT(CompletionData); /* This is not the first completion */ CompletionData->Previous = CompletedIoListTail; CompletionData->Next = NULL;
/* Completion data gets made the new tail */ - SOUND_ASSERT(CompletedIoListTail); + ASSERT(CompletedIoListTail); CompletedIoListTail->Next = CompletionData; CompletedIoListTail = CompletionData; } @@ -179,8 +176,8 @@ { /* Process the request */
- SOUND_ASSERT(CurrentRequest.RequestHandler != NULL); - if ( CurrentRequest.RequestHandler != NULL ) + ASSERT(CurrentRequest.RequestHandler); + if ( CurrentRequest.RequestHandler ) { CurrentRequest.ReturnValue = CurrentRequest.RequestHandler( CurrentRequest.SoundDeviceInstance, @@ -201,42 +198,41 @@ PSOUND_THREAD_COMPLETED_IO CurrentCompletion;
/* Process the I/O Completion */ - SOUND_TRACE("Returned from I/O completion APC\n"); + DPRINT("Returned from I/O completion APC\n");
CurrentCompletion = CompletedIoListHead; - SOUND_ASSERT(CurrentCompletion); - - SOUND_TRACE("Beginning enumeration of completions\n"); + ASSERT(CurrentCompletion); + + DPRINT("Beginning enumeration of completions\n"); while ( CurrentCompletion ) { PSOUND_THREAD_COMPLETED_IO PreviousCompletion;
- SOUND_TRACE("Calling completion handler\n"); + DPRINT("Calling completion handler\n"); /* Call the completion handler */ CurrentCompletion->CompletionHandler( CurrentCompletion->SoundDeviceInstance, CurrentCompletion->Parameter, CurrentCompletion->BytesTransferred);
- SOUND_TRACE("Advancing to next completion\n"); + DPRINT("Advancing to next completion\n"); /* Get the next completion but destroy the previous */ PreviousCompletion = CurrentCompletion; CurrentCompletion = CurrentCompletion->Next; /*CompletedIoListHead = CurrentCompletion;*/
- SOUND_TRACE("Freeing memory\n"); FreeMemory(PreviousCompletion); }
/* Nothing in the completion queue/list now */ CompletedIoListHead = NULL; CompletedIoListTail = NULL; - SOUND_TRACE("Ended enumeration of completions\n"); + DPRINT("Ended enumeration of completions\n"); } else { /* Shouldn't happen! */ - SOUND_ASSERT(FALSE); + ASSERT(FALSE); } }
@@ -342,7 +338,7 @@ if ( ! RequestHandler ) return MMSYSERR_INVALPARAM;
- SOUND_ASSERT(SoundThread != INVALID_HANDLE_VALUE); + ASSERT(SoundThread != INVALID_HANDLE_VALUE); if ( SoundThread == INVALID_HANDLE_VALUE ) { return MMSYSERR_ERROR; @@ -371,7 +367,7 @@ { MMRESULT Result;
- SOUND_ASSERT(SoundThread != INVALID_HANDLE_VALUE); + ASSERT(SoundThread != INVALID_HANDLE_VALUE); if ( SoundThread == INVALID_HANDLE_VALUE ) { return MMSYSERR_ERROR; @@ -384,7 +380,7 @@ NULL);
/* Our request didn't get processed? */ - SOUND_ASSERT(Result != MMSYSERR_NOERROR); + ASSERT(Result != MMSYSERR_NOERROR); if ( Result != MMSYSERR_NOERROR ) return Result;
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -14,6 +14,7 @@
#include <windows.h> #include <mmsystem.h> +#include <debug.h>
#include <mmebuddy.h>
@@ -47,7 +48,8 @@ FreeMemory( IN PVOID Pointer) { - SOUND_ASSERT(ProcessHeapHandle != INVALID_HANDLE_VALUE); + ASSERT(ProcessHeapHandle != INVALID_HANDLE_VALUE); + ASSERT(Pointer);
HeapFree(ProcessHeapHandle, 0, Pointer);
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/so... ============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wavethread.c [iso-8859-1] Fri Jul 11 18:45:12 2008 @@ -67,13 +67,14 @@
DPRINT("PerformWaveIo\n");
- SOUND_ASSERT(SoundDeviceInstance); - - StreamInfo = &SoundDeviceInstance->Streaming.Wave; - - /* If we're out of buffers, do nothing */ + ASSERT(SoundDeviceInstance); + + StreamInfo = &SoundDeviceInstance->Streaming.Wave; + + /* If we're out of buffers, mark stream as stopped and do nothing */ if ( ! StreamInfo->CurrentBuffer ) { + DPRINT("*** NOTHING TO DO ***\n"); return 0; }
@@ -123,7 +124,7 @@ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { PWAVE_STREAM_INFO StreamInfo; - SOUND_ASSERT(SoundDeviceInstance); + ASSERT(SoundDeviceInstance);
StreamInfo = &SoundDeviceInstance->Streaming.Wave;
@@ -152,12 +153,12 @@ Parameter, (int) BytesWritten);
- SOUND_ASSERT(SoundDeviceInstance); + ASSERT(SoundDeviceInstance);
StreamInfo = &SoundDeviceInstance->Streaming.Wave;
/* Decrease the number of outstanding buffers */ - SOUND_ASSERT(StreamInfo->BuffersOutstanding > 0); + ASSERT(StreamInfo->BuffersOutstanding > 0); -- StreamInfo->BuffersOutstanding;
PerformWaveIo(SoundDeviceInstance);