add API to query signal value of audio-latency measurement

This commit is contained in:
Robin Gareus 2016-01-14 19:10:04 +01:00
parent 2386410e4a
commit aacf086246
2 changed files with 7 additions and 0 deletions

View file

@ -34,6 +34,7 @@ public:
int inv (void) { return _inv; }
double del (void) { return _del; }
double err (void) { return _err; }
float get_peak () { const float rv = _peak; _peak = 0; return rv; }
private:
class Freq {
@ -54,6 +55,7 @@ private:
int _cnt;
int _inv;
Freq _freq [13];
float _peak;
};
#endif /* __libardour_mtdm_h__ */

View file

@ -23,6 +23,7 @@
MTDM::MTDM (int fsamp)
: _cnt (0)
, _inv (0)
, _peak (0)
{
int i;
Freq *F;
@ -56,11 +57,13 @@ int MTDM::process (size_t len, float *ip, float *op)
int i;
float vip, vop, a, c, s;
Freq *F;
float peak = 0;
while (len--)
{
vop = 0.0f;
vip = *ip++;
if (fabsf(vip) > peak) { peak = vip; }
for (i = 0, F = _freq; i < 13; i++, F++)
{
a = 2 * (float) M_PI * (F->p & 65535) / 65536.0;
@ -86,6 +89,8 @@ int MTDM::process (size_t len, float *ip, float *op)
}
}
if (peak > _peak) { _peak = vip; }
return 0;
}