Fix bugs in amx_wavein_start. These caused freqresp to hang.

New GCC version optimized code differently, which caused errors
in the timing-critical synchronization code. The code has been
modified to be more robust against compiler version changes.
Speed up freqresp measurement at frequency extremes.

Previously some frequencies might be measured multiple times.