Save and restore gain settings between sessions.

Closes issue #90.