[ros-kernel] mmTaskCreate patch - For you sound junkys
Andrew Greenwood
lists at silverblade.co.uk
Sun Jul 18 23:49:24 CEST 2004
That patch will come in handy.
When I was working on sound, I did get stuck with the mm/mmio routines. I
ended up using threads (which is what the mm routines seemed to do
anyway...)
----- Original Message -----
From: "Filip Navara" <xnavara at volny.cz>
To: "ReactOS Kernel List" <ros-kernel at reactos.com>
Cc: <pouech-eric at wanadoo.fr>
Sent: Wednesday, July 14, 2004 5:27 PM
Subject: Re: [ros-kernel] mmTaskCreate patch - For you sound junkys
> Steven Edwards wrote:
>
> >If you are interested in getting sound working on ReactOS this patch
> >will let you load the Wine Winmm.dll under Windows NT 4. Our winmm.dll
> >needs to be resync'd with winehq so this patch will apply cleanly but
> >anyone wanting to work on sound could go ahead and hack it in. I would
> >recommend trying to load Windows mmdrv.dll under ReactOS with our
> >wimmm.dll to see if you can get working sound.
> >
> >Thanks
> >Steven
> >
> >
> Here is more correct version of that patch. It's against the ReactOS
> CVS. I can produce one against Wine CVS on request.
>
> Regards,
> Filip
>
>
----------------------------------------------------------------------------
----
> Index: include/mmddk.h
> ===================================================================
> --- include/mmddk.h (revision 1)
> +++ include/mmddk.h (working copy)
> @@ -449,6 +449,16 @@
> BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev,
> UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
>
> +typedef void (*LPTASKCALLBACK)(DWORD dwInst);
> +
> +#define TASKERR_NOTASKSUPPORT 1
> +#define TASKERR_OUTOFMEMORY 2
> +MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK, HANDLE*, DWORD);
> +void WINAPI mmTaskBlock(HANDLE);
> +BOOL WINAPI mmTaskSignal(HANDLE);
> +void WINAPI mmTaskYield(void);
> +HANDLE WINAPI mmGetCurrentTask(void);
> +
> #ifdef __WINESRC__
> #define WAVE_DIRECTSOUND 0x0080
> #endif
> Index: winmm/winmm.spec
> ===================================================================
> --- winmm/winmm.spec (revision 1)
> +++ winmm/winmm.spec (working copy)
> @@ -135,6 +135,7 @@
> @ stdcall mmioStringToFOURCCW(wstr long)
> @ stdcall mmioWrite(long ptr long)
> @ stdcall mmsystemGetVersion()
> +@ stdcall mmTaskCreate(ptr ptr long)
> @ stdcall sndPlaySoundA(ptr long)
> @ stdcall sndPlaySoundW(ptr long)
> @ stdcall timeBeginPeriod(long)
> Index: winmm/winmm.c
> ===================================================================
> --- winmm/winmm.c (revision 1)
> +++ winmm/winmm.c (working copy)
> @@ -102,8 +102,9 @@
> * inside WINMM_IData */
> CloseHandle(WINMM_IData->psStopEvent);
> CloseHandle(WINMM_IData->psLastEvent);
> + WINMM_IData->cs.DebugInfo = NULL;
> DeleteCriticalSection(&WINMM_IData->cs);
> - HeapFree(GetProcessHeap(), 0, WINMM_IData);
> + HeapFree(GetProcessHeap(), 0, WINMM_IData);
> WINMM_IData = NULL;
> }
> }
> @@ -3176,3 +3177,44 @@
>
> return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
> }
> +
> +struct mm_starter
> +{
> + LPTASKCALLBACK cb;
> + DWORD client;
> + HANDLE event;
> +};
> +
> +DWORD WINAPI mmTaskRun(void* pmt)
> +{
> + struct mm_starter mms;
> +
> + memcpy(&mms, pmt, sizeof(struct mm_starter));
> + HeapFree(GetProcessHeap(), 0, pmt);
> + mms.cb(mms.client);
> + if (mms.event) SetEvent(mms.event);
> + return 0;
> +}
> +
> +MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client)
> +{
> + HANDLE h;
> + struct mm_starter *mms;
> +
> + mms = HeapAlloc(GetProcessHeap(), 0, sizeof(struct mm_starter));
> + if (mms == NULL) { return TASKERR_OUTOFMEMORY; }
> +
> + mms->cb = cb;
> + mms->client = client;
> + if (ph) {
> + mms->event = CreateEvent(NULL, FALSE, FALSE, NULL);
> + } else {
> + mms->event = NULL;
> + }
> +
> + h = CreateThread(0, 0, mmTaskRun, (LPVOID)&mms, 0, NULL);
> + if (!h) return TASKERR_OUTOFMEMORY;
> + if (ph) *ph = mms->event;
> + CloseHandle(h);
> + return 0;
> +}
>
----------------------------------------------------------------------------
----
> _______________________________________________
> Ros-kernel mailing list
> Ros-kernel at reactos.com
> http://reactos.com/mailman/listinfo/ros-kernel
More information about the Ros-kernel
mailing list