I rewrote the wave form generation routine to fit into 32 bit integer, with the highest fixed point precision for the range of all possible parameters. To retrieve the sine values, we use a small lookup table with a resolution of 1024 entries (we need to store the first quarter only, since the rest is symmetric).
I extensively tested these routines (on iMac G5 / AMD K6, gcc 3 / gcc 4) to ensure, that the final sample values differ at most by +/-1 from their double float calculated counterparts. This difference doesn't seem to be much, but when comparing directly, you can hear a minor noise for frequencies below 200 Hz. Maybe it also depends a bit on the speakers used.
However, this approach should still be sufficient for our purpose. Most programs don't use too low frequencies, and if they do, people probably won't notice.
Just test the attached patch yourselves Jo. Sebastian Kaliszewski wrote:
One more note about that. PC-speaker generates just plain square wave not sine wave, so this would be more realistic. Then fixed point calculation (16 bit integer part and 16 bit fractional) is easy without all those sin calculation.
-- Joachim Henke http://he-jo.net/
pc_speaker.diff.gz
Description: GNU Zip compressed data
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel