[DSOUND] little patch

Raphael fenix at club-internet.fr
Fri Mar 11 15:15:41 CST 2005


Hi

On Friday 11 March 2005 03:40, Robert Reif wrote:
> Raphael wrote:
> >Hi
> >
> >Changelog:
> > - try to have better match caps with hw caps so games can active more hw
> >support
> >
> >Regards,
> >Raphael
> >
> >
> >
> >-	This->lock.DebugInfo->Spare[1] = 0;
> >+	/*This->lock.DebugInfo->Spare[1] = 0;*/
> > 	DeleteCriticalSection(&(This->lock));
>
> You have to zero this out or DeleteCriticalSection will try
> to delete that static memory.

How ?
At opposite it produce DebugInfo leaks
as seen in RtlDeleteCriticalSection (dlls/ntdll/critsection.c line 197)
<snip>
    if (crit->DebugInfo)
    {
        /* only free the ones we made in here */
        if (!crit->DebugInfo->Spare[1])
        {
            RtlFreeHeap( GetProcessHeap(), 0, crit->DebugInfo );
            crit->DebugInfo = NULL;
        }
    }
<snip>
i will provide a WINE_DEBUG_UNSET_CS_NAME for this problem

> >+    if (pDS->drvcaps.dwFlags | DSCAPS_PRIMARYMONO)  pDS->pwfx->nChannels
> > = 1; +    if (pDS->drvcaps.dwFlags | DSCAPS_PRIMARY16BIT)
> > pDS->pwfx->wBitsPerSample = 16; +    pDS->pwfx->nBlockAlign     =
> > pDS->pwfx->wBitsPerSample * pDS->pwfx->nChannels / 8; +   
> > pDS->pwfx->nAvgBytesPerSec = pDS->pwfx->nSamplesPerSec *
> > pDS->pwfx->nBlockAlign; +
>
> You can't do this and be compatible with windows.

How ?
Since i have this code (ie use better caps from my sound card)
i have few latency problems on dsound (ie fewer buffer underruns)

I don't think windows always use sound cards as 22Kh mono channels 

> >+#ifndef __WINE_DSOUND_PRIVATE_H
> >+#define __WINE_DSOUND_PRIVATE_H
>
> You can't include this more than once because there is only one .h file
> so it's not really necessary.

Yes, but it cost nothing to do
and its more robust

> >+#define WINE_SET_CS_NAME(cs, name) (cs)->DebugInfo->Spare[1] = (DWORD)
> > name +#define WINE_GET_CS_NAME(cs) (const char*)
> > (cs)->lock.DebugInfo->Spare[1]
>
> This is a wine specific trick and should probably be put somewhere global
> so all users can be consistent.  The name should have DEBUG in it
> somewhere.

Yes, it should be better
but i prefered to centralize it on dsound before moving it to wine/debug.h


Regards,
Raphael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050311/6d13b7be/attachment.pgp


More information about the wine-devel mailing list