Since sample-rate will not change during a recording, store it into a member variable.