I'm not familiar with avifil32, but I don't see any obvious errors here, except:
``` + //afmt.wf.wBitsPerSample = afmt.wf.nChannels * 2 * 8; ```
That line should probably be uncommented or removed. (Also, "bits per sample" usually also means per channel, at least in other APIs?)