Sampler buffer reading/writing needs optimizing and testing for efficiency. Now written in a naive way.