... This was motivated by punch and roll recording: it appears most convenient
to pin the head for recording purposes, and drag it near the right, but when
stopping and finding the splice point for the correction, it is better to
scrub unpinned.
Logic changed to delay pause by one frame, if there is a need to fade out.
So we calculate whether we are already faded out, and if we are pause, otherwise delay the real pause for one frame.
Now we show "11:07:29 +" for a time 100 years, 11 hours, 7 mins and 29 seconds in the future, rather than ASSERTing.
The + should probably be mentioned in the manual. "In the countdown, times more than 24 hours ahead aren't shown fully. A '+' sign after the time indicates that it is more than a day ahead."
Problem: When using WASAPI on Windows, the last "latency buffer length" of a selection is not played. This is a fairly nasty bug for those relying on playback when making fine adjustments to the position of the cursor, or the start or end of selection.
During playback the "latency buffer length" has no effect on the actual latency of the playback, but the playback cursor is positioned as if the "latency buffer length" did have an effect, that is, it is positioned by this amount after the audio being played.
So an obvious workaround is for the user to set the latency buffer length to zero when using WASAPI. However they then have to remember to change it if they use another audio host.
Fix: The real problem is presumably a portaudio bug, but this fix just hard codes the workaround given above. For playback, when using WASAPI, set the suggested latency to 0, regardless of user setting.
... but we don't need to make it as precise, using steady_clock.
Do this so that the Audio thread doesn't read the same polling message twice,
halting the scrub. It's all right that it might miss one of the messages
instead.
... Instead there is just a message buffer where the polling thread leaves last
observed state, not requiring each state to be processed before it is
overwritten. The thread doing FillBuffers is now responsible instead for the
complete interpretation of the message whenever it is reinvoked, which happens
at very regular time intervals.
In fact the separate polling thread might be eliminated, having FillBuffers
invoking the polling of the mouse directly in its own wake-ups -- unless the
platform really allows ::wxMouseState to be called safely only from the UI
thread, as appears to be the case in Linux.
Note that this complicated rewrite is accomplished incrementally in the commits
of this merge branch, not all of which leave scrubbing in a working state.