Re: [AD] Sound API

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


Korval wrote:
Is there no reasonable heuristic to deal with the clipping issue? Like, if
you knew what the maximum range of a group of 5 samples was, you would know
what volume would guarentee no clipping? Or would guarentee it some
percentage of the time?

Is it possible to do some analysis of the samples to deal with this issue
automatically?

You *could* analyze the post-mix buffer and decrease the volume it so the maximum sample is within the 24-bit spectrum (before scaling), and save the divisor.. then for everytime after that, decrease the divisor a little and check that it doesn't need to be increased (so the volume gradually rises and isn't so jumpy). That seems a bit evil to do in a real interrupt though (which is what it is in DOS), or a signal interrupt (which it could be under Linux without pthreads). Or really even a timer in general since there's only one thread for all the installed timers. A timer is supposed to be as fast as possible, don't forget.

- Kitty Cat




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