Re: [AD] Allegro's mixer

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wednesday 17 March 2004 19:23, Chris wrote:
> Ben Davis wrote:
> >Nope. It's only GCC's division helper routine that's dangerous, because
> > the memory it resides in can't be locked. The above code compiles only to
> > instructions, no calls to routines anywhere, so it's perfectly safe.
>
> I see. Will that code also be useable for 32-bit samples? If I'm
> understanding it right:
> ((int)((LONG_LONG)(s32) * ((v16) << 16) >> 32))

That wouldn't work, I'm afraid. For the expression to work at all, the sample 
value would have to be centred around zero, and therefore, signed. So the 
volume has to be signed as well, and shifting anything greater than 32767 by 
16 will cause an overflow.

> I wouldn't object to adding 32-bit audio output support. However,
> without using a 64-bit buffer, you'll still hit clamping issues.

Sorry, I should have made it clearer what I meant. What DUMB does is use 
32-bit integers but only use 24 bits' worth of range. There's room for a 256x 
'overflow' before you get wrapping.

And check your clock - your e-mails are all appearing too far up and out of 
order in my program :)

Ben




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/