Commit 421aac43 authored by Cedric Roux's avatar Cedric Roux

add skip_delay parameter to the framelog

not very clean, might be reworked at some point
the idea is to compute much less 'log' than what
was done
parent 30ffc8d2
......@@ -15,6 +15,11 @@ struct framelog {
float *x;
float *buffer;
int blength;
int skip_delay; /* one frame over 'skip_delay' is truly processed
* 0 to disable (process all data)
*/
int skip_current; /* internal data for the skip mechanism */
int skip_on; /* internal data for the skip mechanism */
};
static void _event(void *p, event e)
......@@ -30,6 +35,18 @@ static void _event(void *p, event e)
buffer = e.e[l->buffer_arg].b;
bsize = e.e[l->buffer_arg].bsize;
if (l->skip_delay != 0) {
if (subframe == 0) {
l->skip_current++;
if (l->skip_current >= l->skip_delay) {
l->skip_on = 0;
l->skip_current = 0;
} else
l->skip_on = 1;
}
}
if (l->skip_on) return;
nsamples = bsize / (2*sizeof(int16_t));
if (l->blength != nsamples * 10) {
......@@ -110,3 +127,16 @@ logger *new_framelog(event_handler *h, void *database,
return ret;
}
/****************************************************************************/
/* public functions */
/****************************************************************************/
void framelog_set_skip(logger *_this, int skip_delay)
{
struct framelog *l = _this;
/* TODO: protect with a lock? */
l->skip_delay = skip_delay;
l->skip_current = 0;
l->skip_on = 0;
}
......@@ -12,6 +12,8 @@ logger *new_ttilog(void *event_handler, void *database,
char *data_varname, int convert_to_dB);
logger *new_timelog(void *event_handler, void *database, char *event_name);
void framelog_set_skip(logger *_this, int skip_delay);
#include "view/view.h"
void logger_add_view(logger *l, view *v);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment