DSOUND: prevent assertion in mixer.c

Alex Villací­s Lasso a_villacis at palosanto.com
Tue Aug 2 15:22:28 CDT 2005

Felix Nawothnig wrote:

> Alex Villací­s Lasso wrote:
>> wine-pthread: mixer.c:386: DSOUND_MixInBuffer: Assertion 
>> `adjusted_remainder >= 0' failed.
>> wine: Unhandled exception (thread 000a), starting debugger...
>> WineDbg starting on pid 0x8
> I guess this is preluded by some "length not a multiple of block size" 
> errors? I've been experiencing those errors with the same failed 
> assertion in another game and came up with a similar patch but didn't 
> submit since I think this just hides another bug as it should *not* 
> happen that buf_mixpos becomes greater than buflen (and this >= above 
> should probably be ==) at any time.
> IMHO you should at least add an ERR to that branch.
The "length not a multiple of block size" errors you mention is what 
happens *instead* of the failed assertion when this patch is applied. 
Since the error of "length not a multiple of block size" is nonfatal, 
unlike the assertion, I submitted the patch as it is. I will need to 
read more of both DirectSound and the source code in order to understand 
the implications of the non-multiple error, since there is another game 
from the same source (LittleWitch/FloatingFrameDirector) that displays 
the same non-multiple errors without triggering the assertion. What kind 
of setup or error needs to happen in an DirectSound application in order 
to trigger this non-multiple warning?

>> --- wine-20050725-cvs/dlls/dsound/mixer.c    2005-06-21 
>> 04:43:29.000000000 -0500
>> +++ wine-20050725-cvs-patch/dlls/dsound/mixer.c    2005-08-01 
>> 02:16:42.000000000 -0500
>> @@ -491,6 +491,7 @@
>>              if (dsb->leadin && (dsb->startpos <= dsb->buf_mixpos))
>>                  dsb->leadin = FALSE; /* HACK: see above */
>>          }
>> +        else dsb->buf_mixpos = 0; /* %= dsb->buflen; */
> And shouldn't it be "%= dsb->buflen;"? I'd think that this causes 
> looping until new stuff is mixed in...
> Felix
I tested with the particular game, and it made no difference. The 
comment is there so it is evident that I tested both.

More information about the wine-devel mailing list