Re: [AD] Allegro's mixer, update |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Robert Jr Ohannessian wrote:
For benchmarking, I could recommend the following:
- Create a NULL sound driver. This will basically just eat up all
commands sent its way.
- Give the mixer the ability to run entirely polled; nothing runs on
timers.
Then, benchmarking would be as simple as just running some loop that
polls the mixer. It would also be much more accurate.
Actually, it appears the mixer can be run polled now, but the audio
driver needs to support it. What the audio drivers basically do is call
_mix_some_samples in a 50Hz timer (it also does some "magic" around
this, but the idea still holds).
For example, the direct sound driver, the one that uses Allegro's mixer,
calls digi_dsoundmix_mixer_callback 50 times a second in a timer. All
you'd have to do is remove that timer and call the function yourself.
You'd need to add a 'void (*poll)(void);' function pointer to the
digi_driver struct, make this function:
void poll_sound(void)
{
if(digi_driver && digi_driver->poll)
digi_driver->poll();
}
Then for drivers that can support it, set digi_driver->poll to the
callback function and call remove_int(digi_driver->poll);. Voila..
polling Allegro sound. :)
- Kitty Cat