> It reports amplitude more or less in the place of a chain where
> -ev -evp can be found. This is probably by itself is not bad, though
> we are interested in possible clipping at the output, aren't we ?

that's correct (reports status at a specific position in the chain).
Originally I've used "-ev" to tune the input gain of live recording
sources, so that's what "-ev"'s clipping is most useful.

Agreed, that's definitely misleading. This follows from my original use of
"-ev". With a ADC outputting fixed integer samples, it's impossible it's
to identify actual clipping from max-amplitude valid values. So "-ev" will
report values that are close to maximum as clipped (chainops process float
buffers, so it's values within 0.006% of max amplitude).

This was developed in 2000, when basicly all Linux sound drivers were
limited to 16bit fixed samples. The code still works today, but the
constants chosen of course are based on dated assumptions.

Nowadays, many soundcards (and their Linux drivers) can report clipping
via separate channels, making clipping detection much more reliable.

So one option would be to remove the "clipping detection" code altogether
from ecasound (as it's not as useful anymore, and potentially misleading).
An alternative implementation would be to relocate the code to
input/output stages (where samples are converted from/to to the internal
float sample format).

> 2) no conversion is made on sound yet, so there is no source of clipping
> in the chain yet;
> 3) there can be no higher than allowed amplitude from FLAC decoder
> because its output is short signed integer, not floating point.

Yes, this is true. When you have a source that cannot produce clipped
samples (like the flac decoder), "-ev" will report clipped samples
although the signal is fine. This is actually very likely for streams that
have normalized amplitude.