Issue #167 - fix for truncated signals:

- ensure only *unique* transitions are actually kept in memory;
- make sure the last sample always corresponds to the actual
  length of the signal.