Re: [AD] Allegro's mixer

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


long long should be fine in interrupt context - as long as the data isn't modified both inside and outside the interrupt simultaneously. At this point, it would be possible for half the operation to break. As long as the operation result isn't committed to memory, there shouldn't be any problems though, as registers are saved across interrupts.

That said, there's no way to force the compiler to store intermediaries in registers, so unless we explicitly provide locks on the sample data, we should either: - Keep the code 386 compatible, for all 3 people on the planet who still use those.
- Make the behavior explicitly undefined.


Chris wrote:

Ben Davis wrote:

DUMB manages to combine 24-bit samples with a 16-bit volume:

#define MULSC(a, b) ((int)((LONG_LONG)((a) << 4) * ((b) << 12) >> 32))

Wouldn't ((int)((LONG_LONG)(a) * (b) >> 16)) be faster? And that code uses LONG_LONG, which is 64-bit. Those are dangerous to use in interrupts/timers. DUMB is fine since it's poll-driven, but Allegro's mixer runs in a timer or interrupt, depending on the driver. Unless I'm missing something, we need to stick with 32-bit integer arithmetic in the mixer.

- Kitty Cat


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click




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