# HG changeset patch # User uau # Date 1196486228 0 # Node ID 1aec672af2d216f611675d77ac93237957fd8f09 # Parent e816d546c4fed2c1fe4683a96b6522d87b1a16ee Fix ao_null with float samples ao_null accepts float input, but the code calculating ao_data.bps only checked for 1-byte formats and used samplesize 2 for everything else. Because ao_null uses the bps value in its timing calculations this effectively made "playback" advance at half the correct speed. Fixed by calculating samplesize with af_fmt2bits() instead. diff -r e816d546c4fe -r 1aec672af2d2 libao2/ao_null.c --- a/libao2/ao_null.c Sat Dec 01 01:39:39 2007 +0000 +++ b/libao2/ao_null.c Sat Dec 01 05:17:08 2007 +0000 @@ -50,7 +50,7 @@ // return: 1=success 0=fail static int init(int rate,int channels,int format,int flags){ - int samplesize = (format == AF_FORMAT_U8 || format == AF_FORMAT_S8) ? 1: 2; + int samplesize = af_fmt2bits(format) / 8; ao_data.outburst = 256 * channels * samplesize; // A "buffer" for about 0.2 seconds of audio ao_data.buffersize = (int)(rate * 0.2 / 256 + 1) * ao_data.outburst;