[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame Mixer Crackle noise not an SDL_Mixer problem



On Wed, Apr 23, 2008 at 7:24 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
==== From around line 160 in mixer.c ===============
    /*make chunk a power of 2*/
    for (i = 0; 1 << i < chunk; ++i); //yes, semicolon on for loop
    chunk = MAX (1 << i, 256);
==== To around line 167 ============================
    /*make chunk a power of 2*/
    for (i = 0; 1 << i < chunk; ++i) {
    chunk = MAX (1 << i, 256);
    }

wow... the way I read the broken code, it means that pygame 1.8 is always using 256 for the chunksize argument to Mix_OpenAudio (would be setting chunk to 256 when i=0) meaning it always played from a 256 byte buffer... it's pretty impressive that neither the waveout backend nor many computers have a problem with such a small number...

Also, the fixed code means the default chunksize of 3072 is actually 4096.