Refactor handing of sound buffer.