implemented changing gain and offset with keyboard