On Tue, Dec 8, 2009 at 9:07 PM, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote: > On Tue, Dec 08, 2009 at 08:29:14PM +0000, Tom Evans wrote: >> Discovered the problem, reverting the following diff fixes it: >> >> ------------------------------------------------------------------------ >> r29750 | cladisch | 2009-10-05 08:42:02 +0100 (Mon, 05 Oct 2009) | 1 line >> >> fix calculation of ao_data.bps for sample formats with more than 16 bits >> ------------------------------------------------------------------------ >> Index: libao2/ao_oss.c >> =================================================================== >> --- libao2/ao_oss.c ? ? (revision 29749) >> +++ libao2/ao_oss.c ? ? (revision 29750) >> @@ -396,8 +396,19 @@ >> ? ?} >> >> ? ?ao_data.bps=ao_data.channels; >> - ?if(ao_data.format != AF_FORMAT_U8 && ao_data.format != AF_FORMAT_S8) >> + ?switch (ao_data.format & AF_FORMAT_BITS_MASK) { >> + ?case AF_FORMAT_8BIT: >> + ? ?break; >> + ?case AF_FORMAT_16BIT: >> ? ? ?ao_data.bps*=2; >> + ? ?break; >> + ?case AF_FORMAT_24BIT: >> + ? ?ao_data.bps*=3; >> + ? ?break; >> + ?case AF_FORMAT_32BIT: >> + ? ?ao_data.bps*=4; >> + ? ?break; >> + ?} >> >> ? ?ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down >> ? ?ao_data.bps*=ao_data.samplerate; >> >> >> In this case, .format is AF_FORMAT_AC3 (256), which gets masked out >> for this switch, and matches the AF_FORMAT_8BIT (0) case, and so >> doesn't get doubled. I don't know much about sound formats and their >> ilk, so wouldn't like to speculate on what the correct fix would be, >> but to get a working version I've reverted it for now. > > Could you try this patch and check if it breaks something (it's probably a good idea to do a make clean): > Index: libaf/af_format.h > =================================================================== > --- libaf/af_format.h ? (revision 29976) > +++ libaf/af_format.h ? (working copy) > @@ -59,7 +59,7 @@ > ?#define AF_FORMAT_MU_LAW ? ? ? (1<<6) > ?#define AF_FORMAT_A_LAW ? ? ? ? ? ? ? ?(2<<6) > ?#define AF_FORMAT_MPEG2 ? ? ? ? ? ? ? ?(3<<6) // MPEG(2) audio > -#define AF_FORMAT_AC3 ? ? ? ? ?(4<<6) // Dolby Digital AC3 > +#define AF_FORMAT_AC3 ? ? ? ? ?((4<<6)|AF_FORMAT_16BIT) // Dolby Digital AC3 > ?#define AF_FORMAT_IMA_ADPCM ? ?(5<<6) > ?#define AF_FORMAT_SPECIAL_MASK (7<<6) > Thanks, I've rebuilt with this change and will test it on as many types as I can tonight :) Cheers Tom