Implemnt ring buffer for storing samples.