Reorganized audio sample buffer code