Allow buffer size to be set at runtime; improve latency calculation.

Latency is now calculated by adding the input and output latencies, instead of
just using the output latency.