From 8deb379f59b3b405acb6c99cfcff16ae8955e261 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 11 Oct 1998 10:51:17 +0000 Subject: [PATCH] Added win32 enhanced functionality to timer callbacks. --- include/mmsystem.h | 7 +++++-- include/multimedia.h | 2 +- multimedia/init.c | 8 ++++---- multimedia/time.c | 32 +++++++++++++++++++++----------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/include/mmsystem.h b/include/mmsystem.h index bf34f1719c4..28affc09f9d 100644 --- a/include/mmsystem.h +++ b/include/mmsystem.h @@ -753,8 +753,11 @@ typedef void (CALLBACK *LPTIMECALLBACK16)(UINT16 uTimerID, UINT16 uMessage, DWOR typedef void (CALLBACK *LPTIMECALLBACK32)(UINT32 uTimerID, UINT32 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2); DECL_WINELIB_TYPE(LPTIMECALLBACK) -#define TIME_ONESHOT 0 /* program timer for single event */ -#define TIME_PERIODIC 1 /* program for continuous periodic event */ +#define TIME_ONESHOT 0x0000 /* program timer for single event */ +#define TIME_PERIODIC 0x0001 /* program for continuous periodic event */ +#define TIME_CALLBACK_FUNCTION 0x0000 /* callback is function */ +#define TIME_CALLBACK_EVENT_SET 0x0010 /* callback is event - use SetEvent */ +#define TIME_CALLBACK_EVENT_PULSE 0x0020/* callback is event - use PulseEvent */ typedef struct { UINT16 wPeriodMin; /* minimum period supported */ diff --git a/include/multimedia.h b/include/multimedia.h index 843228dbf8e..b1ccca7aff7 100644 --- a/include/multimedia.h +++ b/include/multimedia.h @@ -11,7 +11,7 @@ #include "mmsystem.h" -#define MAX_MIDIINDRV (1) +#define MAX_MIDIINDRV (16) /* For now I'm making 16 the maximum number of midi devices one can * have. This should be more than enough for everybody. But as a purist, * I intend to make it unbounded in the future, as soon as I figure diff --git a/multimedia/init.c b/multimedia/init.c index 0e3e0b08e76..78e81997e32 100644 --- a/multimedia/init.c +++ b/multimedia/init.c @@ -92,8 +92,8 @@ BOOL32 MULTIMEDIA_Init(void) } if (numsynthdevs > MAX_MIDIOUTDRV) { - ERR(midi, "MAX_MIDIOUTDRV was enough for the number of devices. " - "Some FM devices will not be available.\n"); + ERR(midi, "MAX_MIDIOUTDRV (%d) was enough for the number of devices (%d). " + "Some FM devices will not be available.\n",MAX_MIDIOUTDRV,numsynthdevs); numsynthdevs = MAX_MIDIOUTDRV; } @@ -167,8 +167,8 @@ BOOL32 MULTIMEDIA_Init(void) } if (nummididevs > MAX_MIDIINDRV) { - ERR(midi, "MAX_MIDIINDRV was not enough for the number of devices. " - "Some MIDI devices will not be available.\n"); + ERR(midi, "MAX_MIDIINDRV (%d) was not enough for the number of devices (%d). " + "Some MIDI devices will not be available.\n",MAX_MIDIINDRV,nummididevs); nummididevs = MAX_MIDIINDRV; } diff --git a/multimedia/time.c b/multimedia/time.c index b4b6eb010d6..ce9bc14fdcd 100644 --- a/multimedia/time.c +++ b/multimedia/time.c @@ -72,13 +72,25 @@ static void TIME_TriggerCallBack(LPTIMERENTRY lpTimer, DWORD dwCurrent) * PostMessage), and must reside in DLL (therefore uses stack of active application). So I * guess current implementation via SetTimer has to be improved upon. */ - if (lpTimer->isWin32) - lpTimer->lpFunc(lpTimer->wTimerID,0,lpTimer->dwUser,0,0); - else - Callbacks->CallTimeFuncProc(lpTimer->lpFunc, - lpTimer->wTimerID,0, - lpTimer->dwUser,0,0); - + switch (lpTimer->wFlags & 0x30) { + case TIME_CALLBACK_FUNCTION: + if (lpTimer->isWin32) + lpTimer->lpFunc(lpTimer->wTimerID,0,lpTimer->dwUser,0,0); + else + Callbacks->CallTimeFuncProc(lpTimer->lpFunc, + lpTimer->wTimerID,0, + lpTimer->dwUser,0,0); + break; + case TIME_CALLBACK_EVENT_SET: + SetEvent((HANDLE32)lpTimer->lpFunc); + break; + case TIME_CALLBACK_EVENT_PULSE: + PulseEvent((HANDLE32)lpTimer->lpFunc); + break; + default: + FIXME(mmtime,"Unknown callback type 0x%04x for mmtime callback (%p),ignored.\n",lpTimer->wFlags,lpTimer->lpFunc); + break; + } TRACE(mmtime, "after CallBack16 !\n"); fflush(stdout); } @@ -327,13 +339,13 @@ MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod) DWORD WINAPI timeGetTime() { DWORD dwNewTick = GetTickCount(); - + + StartMMTime(); #ifdef USE_FAKE_MM_TIMERS if (bUseFakeTimers) { if (wInCallBackLoop++) { DWORD dwDelta; - StartMMTime(); if (dwNewTick < dwLastCBTick) { ERR(mmtime, "dwNewTick(%lu) < dwLastCBTick(%lu)\n", dwNewTick, dwLastCBTick); @@ -357,7 +369,5 @@ DWORD WINAPI timeGetTime() wInCallBackLoop--; } #endif - TRACE(mmtime, "Time = %ld\n", dwNewTick); - return dwNewTick; }