Small changes.

Optimizations, more comments, layed groundwork for changing wave shapes
via gui.  Added support for pulse waves.  Bits of refactoring to make
logic clearer.  Removed input logging (maybe add it back later?)